Documentation
¶
Overview ¶
Package imageops 提供渲染期的纯图片像素运算:透明度、掩码合成、内容边界、裁图及印章白底透明化。
本包不依赖 OFD 模型、绘制后端或资源缓存。输入图片与掩码均视为只读;需要修改 像素时分配独立结果。不透明度不变时可直接返回原图,保留懒解码和原编码内嵌。 裁剪路径的栅格化、页面坐标及是否应用印章白底策略由调用方负责。
Index ¶
- func ApplyAlpha(img image.Image, alpha uint8) image.Image
- func ApplyMaskAlpha(img image.Image, mask *image.Alpha, alpha uint8) image.Image
- func ApplyResourceMask(img, mask image.Image) image.Image
- func ContentBounds(img image.Image) (float64, float64, float64, float64)
- func Crop(img image.Image, x0, y0, x1, y1 int) image.Image
- func CropNRGBA(img image.Image, region image.Rectangle) image.Image
- func SealTransparentBackground(img image.Image) image.Image
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAlpha ¶
ApplyAlpha 将整张图片的不透明度乘以 alpha,不修改原图,255 时直接返回原图。
func ApplyMaskAlpha ¶
ApplyMaskAlpha 一次合成源 Alpha、覆盖率掩码和对象 Alpha。掩码左上角对应原图 左上角,尺寸须覆盖原图;返回独立 NRGBA,不修改共享图片或掩码。
func ApplyResourceMask ¶
ApplyResourceMask 将资源掩码的亮度合成到原图透明度,尺寸不同时按比例取样。 掩码完全透明的像素视为零覆盖,缺失或空掩码保持原图。
func ContentBounds ¶
ContentBounds 返回 Alpha 大于 8 的内容像素包围盒,保留图像原点,右下边界不包含。 空白图片返回全零,阈值与渲染器测量复合单元的既有行为一致。
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.