Documentation
¶
Index ¶
- func CreateImage(width, height int, background color.Color) *image.RGBA
- func DrawAntiAliasedCircle(img *image.RGBA, centerX, centerY, radius float64, color color.RGBA, ...)
- func DrawAntiAliasedCircleOutline(img *image.RGBA, centerX, centerY, radius int, c color.Color)
- func DrawAntiAliasedEllipse(img *image.RGBA, centerX, centerY, radiusX, radiusY float64, color color.RGBA, ...)
- func DrawAntiAliasedEllipseOutline(img *image.RGBA, centerX, centerY, radiusX, radiusY int, c color.Color)
- func DrawAntiAliasedFilledCircle(img *image.RGBA, centerX, centerY, radius int, c color.Color)
- func DrawAntiAliasedFilledEllipse(img *image.RGBA, centerX, centerY, radiusX, radiusY int, c color.Color)
- func DrawAntiAliasedLine(img *image.RGBA, x0, y0, x1, y1 float64, c color.Color, strokeWidth float64)
- func DrawAntiAliasedPixel(img *image.RGBA, x, y float64, c color.Color, alpha float64)
- func DrawCircle(img *image.RGBA, centerX, centerY, radius int, c color.Color, fill bool)
- func DrawEllipse(img *image.RGBA, centerX, centerY, radiusX, radiusY int, c color.Color, ...)
- func DrawLine(img *image.RGBA, x0, y0, x1, y1 int, c color.Color)
- func DrawPixel(img *image.RGBA, x, y int, c color.Color)
- func DrawRect(img *image.RGBA, x, y, width, height int, c color.Color, fill bool)
- func FillCircle(img *image.RGBA, centerX, centerY, radius int, c color.Color)
- func NewImage(width, height int) *image.RGBA
- func RenderDocument(doc *types.Document, width, height int) (*image.RGBA, error)
- func RenderElement(img *image.RGBA, element types.Element) error
- type AntiAliasedPathRenderer
- type AntiAliasedRenderer
- func (r *AntiAliasedRenderer) DrawAntiAliasedCircle(img *image.RGBA, centerX, centerY float64, radius float64, c color.RGBA)
- func (r *AntiAliasedRenderer) DrawAntiAliasedCircleWithWidth(img *image.RGBA, centerX, centerY, radius float64, color color.RGBA, ...)
- func (r *AntiAliasedRenderer) DrawAntiAliasedEllipse(img *image.RGBA, centerX, centerY, radiusX, radiusY float64, c color.RGBA)
- func (r *AntiAliasedRenderer) DrawAntiAliasedEllipseWithWidth(img *image.RGBA, centerX, centerY, radiusX, radiusY float64, color color.RGBA, ...)
- func (r *AntiAliasedRenderer) FillAntiAliasedCircle(img *image.RGBA, centerX, centerY float64, radius float64, c color.RGBA)
- func (r *AntiAliasedRenderer) FillAntiAliasedEllipse(img *image.RGBA, centerX, centerY, radiusX, radiusY float64, c color.RGBA)
- type EdgeInfo
- type GIFRenderer
- func (g *GIFRenderer) RenderAnimationFrames(frames []*types.Document, width, height int, delay int) (*gif.GIF, error)
- func (g *GIFRenderer) RenderAnimationToGIF(frames []*types.Document, width, height int, delay int, filename string) error
- func (g *GIFRenderer) SaveGIF(gifAnim *gif.GIF, filename string) error
- type ImageRenderer
- func (r *ImageRenderer) FillPath(img *image.RGBA, points []types.Point, fillColor color.RGBA)
- func (r *ImageRenderer) FillSubPathsWithWindingRule(img *image.RGBA, subPaths [][]types.Point, fillColor color.RGBA)
- func (r *ImageRenderer) Render(doc *types.Document, width, height int) (*image.RGBA, error)
- type IntersectionInfo
- type PathBounds
- type StrokeCapStyle
- type StrokeJoinStyle
- type TrueStrokePathGenerator
- type TrueStrokeRenderer
- type WebLevelStrokeRenderer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateImage ¶
CreateImage 创建指定大小和背景色的图像
func DrawAntiAliasedCircle ¶
func DrawAntiAliasedCircle(img *image.RGBA, centerX, centerY, radius float64, color color.RGBA, strokeWidth float64)
DrawAntiAliasedCircle 绘制抗锯齿圆形(描边模式)
func DrawAntiAliasedCircleOutline ¶
DrawAntiAliasedCircleOutline 绘制抗锯齿圆形轮廓 / Draw anti-aliased circle outline
func DrawAntiAliasedEllipse ¶
func DrawAntiAliasedEllipse(img *image.RGBA, centerX, centerY, radiusX, radiusY float64, color color.RGBA, strokeWidth float64)
DrawAntiAliasedEllipse 绘制抗锯齿椭圆(描边模式)
func DrawAntiAliasedEllipseOutline ¶
func DrawAntiAliasedEllipseOutline(img *image.RGBA, centerX, centerY, radiusX, radiusY int, c color.Color)
DrawAntiAliasedEllipseOutline 绘制抗锯齿椭圆轮廓 / Draw anti-aliased ellipse outline
func DrawAntiAliasedFilledCircle ¶
DrawAntiAliasedFilledCircle 绘制抗锯齿填充圆形 / Draw anti-aliased filled circle
func DrawAntiAliasedFilledEllipse ¶
func DrawAntiAliasedFilledEllipse(img *image.RGBA, centerX, centerY, radiusX, radiusY int, c color.Color)
DrawAntiAliasedFilledEllipse 绘制抗锯齿填充椭圆 / Draw anti-aliased filled ellipse
func DrawAntiAliasedLine ¶
func DrawAntiAliasedLine(img *image.RGBA, x0, y0, x1, y1 float64, c color.Color, strokeWidth float64)
DrawAntiAliasedLine 绘制抗锯齿直线
func DrawAntiAliasedPixel ¶
DrawAntiAliasedPixel 绘制抗锯齿像素
func DrawCircle ¶
DrawCircle 在图像上绘制圆形(支持填充和描边)/ Draw circle with fill or stroke support
func DrawEllipse ¶
DrawEllipse 在图像上绘制椭圆(支持填充和描边)/ Draw ellipse with fill or stroke support
func FillCircle ¶
FillCircle 在图像上绘制填充圆形
func RenderDocument ¶
RenderDocument 渲染整个文档(为了兼容测试)
Types ¶
type AntiAliasedPathRenderer ¶
type AntiAliasedPathRenderer struct {
*AntiAliasedRenderer
}
AntiAliasedPathRenderer 抗锯齿路径渲染器 / Anti-aliased path renderer
func NewAntiAliasedPathRenderer ¶
func NewAntiAliasedPathRenderer() *AntiAliasedPathRenderer
NewAntiAliasedPathRenderer 创建抗锯齿路径渲染器 / Create anti-aliased path renderer
type AntiAliasedRenderer ¶
type AntiAliasedRenderer struct {
*ImageRenderer
}
AntiAliasedRenderer 抗锯齿渲染器 / Anti-aliased renderer
func NewAntiAliasedRenderer ¶
func NewAntiAliasedRenderer() *AntiAliasedRenderer
NewAntiAliasedRenderer 创建抗锯齿渲染器 / Create anti-aliased renderer
func (*AntiAliasedRenderer) DrawAntiAliasedCircle ¶
func (r *AntiAliasedRenderer) DrawAntiAliasedCircle(img *image.RGBA, centerX, centerY float64, radius float64, c color.RGBA)
DrawAntiAliasedCircle 绘制抗锯齿圆形描边 / Draw anti-aliased circle stroke
func (*AntiAliasedRenderer) DrawAntiAliasedCircleWithWidth ¶
func (r *AntiAliasedRenderer) DrawAntiAliasedCircleWithWidth(img *image.RGBA, centerX, centerY, radius float64, color color.RGBA, strokeWidth float64)
DrawAntiAliasedCircleWithWidth 绘制带描边宽度的抗锯齿圆形
func (*AntiAliasedRenderer) DrawAntiAliasedEllipse ¶
func (r *AntiAliasedRenderer) DrawAntiAliasedEllipse(img *image.RGBA, centerX, centerY, radiusX, radiusY float64, c color.RGBA)
DrawAntiAliasedEllipse 绘制抗锯齿椭圆描边 / Draw anti-aliased ellipse stroke
func (*AntiAliasedRenderer) DrawAntiAliasedEllipseWithWidth ¶
func (r *AntiAliasedRenderer) DrawAntiAliasedEllipseWithWidth(img *image.RGBA, centerX, centerY, radiusX, radiusY float64, color color.RGBA, strokeWidth float64)
DrawAntiAliasedEllipseWithWidth 绘制带描边宽度的抗锯齿椭圆
func (*AntiAliasedRenderer) FillAntiAliasedCircle ¶
func (r *AntiAliasedRenderer) FillAntiAliasedCircle(img *image.RGBA, centerX, centerY float64, radius float64, c color.RGBA)
FillAntiAliasedCircle 填充抗锯齿圆形 / Fill anti-aliased circle
func (*AntiAliasedRenderer) FillAntiAliasedEllipse ¶
func (r *AntiAliasedRenderer) FillAntiAliasedEllipse(img *image.RGBA, centerX, centerY, radiusX, radiusY float64, c color.RGBA)
FillAntiAliasedEllipse 填充抗锯齿椭圆 / Fill anti-aliased ellipse
type EdgeInfo ¶
type EdgeInfo struct {
X1, Y1, X2, Y2 float64 // 边的起点和终点 / Edge start and end points
Direction int // 边的方向:1表示向上,-1表示向下 / Edge direction: 1 for up, -1 for down
}
EdgeInfo 存储边的信息用于缠绕规则计算 / Edge information for winding rule calculation
type GIFRenderer ¶
type GIFRenderer struct {
// contains filtered or unexported fields
}
GIFRenderer GIF动画渲染器
func (*GIFRenderer) RenderAnimationFrames ¶
func (g *GIFRenderer) RenderAnimationFrames(frames []*types.Document, width, height int, delay int) (*gif.GIF, error)
RenderAnimationFrames 渲染动画帧序列为GIF
func (*GIFRenderer) RenderAnimationToGIF ¶
func (g *GIFRenderer) RenderAnimationToGIF(frames []*types.Document, width, height int, delay int, filename string) error
RenderAnimationToGIF 直接渲染动画序列为GIF文件
type ImageRenderer ¶
type ImageRenderer struct {
}
ImageRenderer 表示SVG到图像的渲染器
func (*ImageRenderer) FillSubPathsWithWindingRule ¶
func (r *ImageRenderer) FillSubPathsWithWindingRule(img *image.RGBA, subPaths [][]types.Point, fillColor color.RGBA)
FillSubPathsWithWindingRule 公开的填充多个子路径方法 / Public fill multiple sub-paths method
type IntersectionInfo ¶
type IntersectionInfo struct {
X float64 // 交点的x坐标 / X coordinate of intersection
Direction int // 边的方向 / Edge direction
}
IntersectionInfo 交点信息 / Intersection information
type PathBounds ¶
type PathBounds struct {
MinX, MinY, MaxX, MaxY float64
}
PathBounds 路径边界框结构 / Path bounds structure
type StrokeCapStyle ¶
type StrokeCapStyle int
StrokeCapStyle 线帽样式 / Stroke cap style
const ( CapButt StrokeCapStyle = iota // 平头线帽 / Butt cap CapRound // 圆形线帽 / Round cap CapSquare // 方形线帽 / Square cap )
type StrokeJoinStyle ¶
type StrokeJoinStyle int
StrokeJoinStyle 线段连接样式 / Stroke join style
const ( JoinMiter StrokeJoinStyle = iota // 尖角连接 / Miter join JoinRound // 圆角连接 / Round join JoinBevel // 斜角连接 / Bevel join )
type TrueStrokePathGenerator ¶
type TrueStrokePathGenerator struct {
CapStyle StrokeCapStyle // 线帽样式 / Cap style
JoinStyle StrokeJoinStyle // 连接样式 / Join style
MiterLimit float64 // 尖角限制 / Miter limit
}
TrueStrokePathGenerator 真正的描边路径生成器 / True stroke path generator
func NewTrueStrokePathGenerator ¶
func NewTrueStrokePathGenerator() *TrueStrokePathGenerator
NewTrueStrokePathGenerator 创建新的描边路径生成器 / Create new stroke path generator
func (*TrueStrokePathGenerator) GenerateStrokePath ¶
func (g *TrueStrokePathGenerator) GenerateStrokePath(path []types.Point, strokeWidth float64, closePath bool) []types.Point
GenerateStrokePath 生成真正的描边路径 / Generate true stroke path
type TrueStrokeRenderer ¶
type TrueStrokeRenderer struct {
*AntiAliasedPathRenderer
PathGenerator *TrueStrokePathGenerator
}
TrueStrokeRenderer 真正的描边渲染器 / True stroke renderer
func NewTrueStrokeRenderer ¶
func NewTrueStrokeRenderer() *TrueStrokeRenderer
NewTrueStrokeRenderer 创建新的真正描边渲染器 / Create new true stroke renderer
func (*TrueStrokeRenderer) RenderTrueStroke ¶
func (r *TrueStrokeRenderer) RenderTrueStroke(img *image.RGBA, path []types.Point, strokeColor color.RGBA, strokeWidth float64, closePath bool)
RenderTrueStroke 渲染真正的描边 / Render true stroke
func (*TrueStrokeRenderer) RenderTrueStrokeComplexPath ¶
func (r *TrueStrokeRenderer) RenderTrueStrokeComplexPath(img *image.RGBA, subPaths [][]types.Point, strokeColor color.RGBA, strokeWidth float64, closeSubPaths []bool)
RenderTrueStrokeComplexPath 渲染复杂路径的真正描边 / Render true stroke for complex path
type WebLevelStrokeRenderer ¶
type WebLevelStrokeRenderer struct {
*AntiAliasedPathRenderer
}
WebLevelStrokeRenderer Web级别描边抗锯齿渲染器
func NewWebLevelStrokeRenderer ¶
func NewWebLevelStrokeRenderer() *WebLevelStrokeRenderer
NewWebLevelStrokeRenderer 创建Web级别描边抗锯齿渲染器