Help us shape the future of Go! Take the 2026 Go Developer Survey

image

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package image 计算图片放置矩阵、边框和局部裁剪,不解码资源或执行绘制。 输入模型与共享路径均视为只读。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Border

func Border(width, height, rx, ry float64) *geom.Path

Border 生成局部 Y 向上的图片边框,从左上角顺时针绕行。 对应 GB/T 33190—2016 §10 表43 的边框半径及虚线起点约定。

func BorderPath

func BorderPath(object models.ImageObject, pageHeight float64, parent *models.CTM) *geom.Path

BorderPath 将 Boundary 中的边框映射到页面画布,并应用容器的父级变换。 图像 CTM 用于单位图像放置;边框半径与线宽是 Boundary 空间中的毫米值, 不应再套用该单位图像缩放。参见 GB/T 33190—2016 §8.4 表34、§10 表43。

func CTM

func CTM(object models.ImageObject) models.CTM

CTM 返回图片放置使用的矩阵;缺省时以 Boundary 宽高缩放单位图像。 此合成矩阵仅用于图片放置,不能作为对象显式 CTM 应用于毫米裁剪路径。

func Clip

func Clip(clip *geom.Path, matrix geom.Matrix, width, height int) *geom.Path

Clip 将页面裁剪转换到图片像素空间,供原生路径裁剪及位图掩码共同使用。 nil 表示无需裁剪;保留既有非有限或退化放置矩阵的跳过行为。逆矩阵溢出时 返回空路径以隐藏图片,避免泄露裁剪外内容。返回的非空路径为独立副本。

func Matrix

func Matrix(box models.StBox, img image.Image, ctm models.CTM, pageHeight float64) geom.Matrix

Matrix 将图片的像素坐标映射到 Y 向上的页面画布,不读取像素。

func MatrixWH

func MatrixWH(box models.StBox, w, h float64, ctm models.CTM, pageHeight float64) geom.Matrix

MatrixWH 将宽高为 w、h 的 Y 向下坐标空间映射到页面画布。 用于位图、SVG 和离屏结果的相同放置规则,调用方负责检查计算结果的有限性。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL