Documentation
¶
Overview ¶
Package composite 计算复合图元的兼容内容范围、保守墨迹边界与重采样计划。 本包不加载资源或执行绘制,输入模型及共享路径均视为只读。
Index ¶
- func ContentExtent(object spec.CompositeObject) (float64, float64, bool)
- func ExtentMismatch(declared, extent float64) bool
- func InkRect(unit *spec.CompositeGraphicUnit, w, h float64) (spec.StBox, bool)
- func Resample(ink geom.Rect, w, h, dpi float64, box spec.StBox, outDPI float64) (geom.Rect, float64, bool)
- func SingleFillPath(unit *spec.CompositeGraphicUnit) (*geom.Path, spec.StBox)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentExtent ¶
func ContentExtent(object spec.CompositeObject) (float64, float64, bool)
ContentExtent 由 Boundary 与轴向 CTM 反推内容范围;旋转或错切时不做反推。 GB/T 33190—2016 §13 表50 定义单元宽高;此函数用于兼容声明尺寸与实际 对象范围不符的文档,不改变模型中的声明尺寸。
func ExtentMismatch ¶
ExtentMismatch 判断声明尺寸与反推范围的相对误差是否超过既有兼容阈值。
func InkRect ¶
InkRect 保守估算单元内容的画布边界(毫米,Y 向下),并预留字形与取整边距。 描边、旋转、图片及嵌套内容无法可靠随画布平移时,返回 false 以沿用完整画布。 路径使用实际轮廓,文字使用 Boundary;结果只用于优化,空白重画回退由调用方处理。
func Resample ¶
func Resample(ink geom.Rect, w, h, dpi float64, box spec.StBox, outDPI float64) (geom.Rect, float64, bool)
Resample 根据首遍图像的墨迹像素边界计算重画画布(毫米,Y 向下)和 DPI。 仅当内容面积足够小且分辨率至少提升两成时返回计划,最高 1200 DPI。 调用方须在重画前计入预算,并在重画为空时保留首遍结果。
func SingleFillPath ¶ added in v0.2.3
SingleFillPath 构建单条纯色填充路径,返回单元坐标中的墨迹范围(毫米)。 返回 nil 表示需要通用绘制或实测墨迹。路径非 nil 但范围为空表示路径没有面积。 返回的路径由调用方独占,可直接变换到页面坐标。
Types ¶
This section is empty.