mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 17:27:08 +08:00
1 parent
c3908819bb
commit
d9046af3b0
2 files changed
+36
-1
No files matched your search
@@ -115,6 +115,15 @@ func imageBorderObject(object ImageObject, box Box) PathObject {
|
||||
// 返回: error 裁剪转换错误
|
||||
func (c *semanticCompiler) addImage(img image.Image, matrix Matrix, clip *GeometryPath) error {
|
||||
command := RasterCommand{Image: img, Transform: RasterMatrix(matrix.Values())}
|
||||
if clip != nil {
|
||||
if box, ok := geometryRectangleBounds(*clip); ok {
|
||||
bounds := img.Bounds()
|
||||
visible := matrix.TransformBox(Box{X: float64(bounds.Min.X), Y: float64(bounds.Min.Y), W: float64(bounds.Dx()), H: float64(bounds.Dy())})
|
||||
if box.X <= visible.X && box.Y <= visible.Y && visible.X+visible.W <= box.X+box.W && visible.Y+visible.H <= box.Y+box.H {
|
||||
clip = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
if clip != nil {
|
||||
var err error
|
||||
command.Clip, err = c.segments(*clip)
|
||||
|
||||
Reference in new issue
Block a user