Documentation
¶
Overview ¶
Package advancegg provides a simple API for rendering 2D graphics in pure Go.
Index ¶
- Constants
- Variables
- func AnimateColor(start, end color.RGBA, t float64, easing EasingFunc) color.RGBA
- func AnimateProperty(start, end, t float64, easing EasingFunc) float64
- func ClearAllCaches()
- func ClearPools()
- func DebugAssert(condition bool, message string)
- func DebugLog(format string, args ...interface{})
- func Degrees(radians float64) float64
- func EaseBounce(t float64) float64
- func EaseElastic(t float64) float64
- func EaseIn(t float64) float64
- func EaseInCubic(t float64) float64
- func EaseInOut(t float64) float64
- func EaseInOutCubic(t float64) float64
- func EaseLinear(t float64) float64
- func EaseOut(t float64) float64
- func EaseOutCubic(t float64) float64
- func EdgeDetection(img image.Image) image.Image
- func Emboss(img image.Image) image.Image
- func FastGrayscale(img image.Image) image.Image
- func GenerateFontKey(fontPath string, size float64, params ...interface{}) string
- func GenerateImageKey(operation string, params ...interface{}) string
- func GeneratePathKey(pathData string, transform Matrix) string
- func GetCacheStats() map[string]CacheStats
- func GetFontFormat(path string) (string, error)
- func Grayscale(img image.Image) image.Image
- func HandleError(err error)
- func Invert(img image.Image) image.Image
- func IsDebugMode() bool
- func IsEmoji(r rune) bool
- func LoadBMP(path string) (image.Image, error)
- func LoadFontFace(path string, points float64) (font.Face, error)
- func LoadGIF(path string) (image.Image, error)
- func LoadImage(path string) (image.Image, error)
- func LoadJPG(path string) (image.Image, error)
- func LoadOTFFace(path string, points float64) (font.Face, error)
- func LoadPNG(path string) (image.Image, error)
- func LoadTIFF(path string) (image.Image, error)
- func LoadTTFFace(path string, points float64) (font.Face, error)
- func LoadWebP(path string) (image.Image, error)
- func ParseFontFace(fontBytes []byte, points float64) (font.Face, error)
- func ParseFontFaceWithOptions(fontBytes []byte, options *truetype.Options) (font.Face, error)
- func Radians(degrees float64) float64
- func RecoverFromPanic() error
- func ReleaseContext(ctx *Context)
- func ReleasePath2D(path *Path2D)
- func ResizeImage(img image.Image, newWidth, newHeight int) image.Image
- func ResizeImageFill(img image.Image, width, height int) image.Image
- func ResizeImageFit(img image.Image, maxWidth, maxHeight int) image.Image
- func ResizeImageWithAlgorithm(img image.Image, newWidth, newHeight int, algo ResizeAlgorithm) image.Image
- func SIMDAlphaBlend(dst, src *image.RGBA)
- func SIMDBlur(img *image.RGBA, radius int) *image.RGBA
- func SIMDColorTransform(img *image.RGBA, transform func(r, g, b, a uint8) (uint8, uint8, uint8, uint8)) *image.RGBA
- func SIMDConvolution(img *image.RGBA, kernel [][]float64) *image.RGBA
- func SIMDMemCopy(dst, src []byte)
- func SIMDResize(img *image.RGBA, newWidth, newHeight int) *image.RGBA
- func SafeExecute(operation string, fn func() error) error
- func SaveBMP(path string, im image.Image) error
- func SaveGIF(path string, im image.Image) error
- func SaveJPEG(path string, im image.Image, quality int) error
- func SaveJPG(path string, im image.Image, quality int) error
- func SavePNG(path string, im image.Image) error
- func SaveTIFF(path string, im image.Image) error
- func ScaleImage(img image.Image, factor float64) image.Image
- func Sepia(img image.Image) image.Image
- func SetCacheConfig(config CacheConfig)
- func SetDebugConfig(config DebugConfig)
- func SetDebugMode(mode DebugMode)
- func SetErrorHandler(handler ErrorHandler)
- func SetPoolConfig(config PoolConfig)
- func Sharpen(img image.Image) image.Image
- func ValidateImageBounds(x, y, width, height int) error
- func ValidateNotNil(name string, value interface{}) error
- func ValidatePositive(name string, value float64) error
- func ValidateRange(name string, value, min, max float64) error
- type AdvanceError
- func NewError(errorType ErrorType, message string) *AdvanceError
- func NewFileNotFoundError(filepath string) *AdvanceError
- func NewInvalidFormatError(filepath string, expectedFormats []string) *AdvanceError
- func NewInvalidParameterError(paramName string, value interface{}, expected string) *AdvanceError
- func NewInvalidStateError(operation string, currentState string, requiredState string) *AdvanceError
- func NewMemoryError(operation string, requestedSize int64) *AdvanceError
- func NewOutOfBoundsError(operation string, value, min, max interface{}) *AdvanceError
- func NewRenderError(operation string, details string) *AdvanceError
- func NewUnsupportedOperationError(operation string, reason string) *AdvanceError
- type Align
- type AlignmentTarget
- func AlignTargetsBottom(targets []AlignmentTarget) []AlignmentTarget
- func AlignTargetsCenterHorizontal(targets []AlignmentTarget) []AlignmentTarget
- func AlignTargetsCenterVertical(targets []AlignmentTarget) []AlignmentTarget
- func AlignTargetsLeft(targets []AlignmentTarget) []AlignmentTarget
- func AlignTargetsRight(targets []AlignmentTarget) []AlignmentTarget
- func AlignTargetsTop(targets []AlignmentTarget) []AlignmentTarget
- func DistributeHorizontally(targets []AlignmentTarget) []AlignmentTarget
- func DistributeVertically(targets []AlignmentTarget) []AlignmentTarget
- type AnimationFrame
- type AnimationSequence
- func AnimRotate(duration time.Duration, fromAngle, toAngle float64, render func(ctx *Context)) *AnimationSequence
- func AnimScale(duration time.Duration, fromScale, toScale float64, render func(ctx *Context)) *AnimationSequence
- func FadeIn(duration time.Duration, render func(ctx *Context)) *AnimationSequence
- func FadeOut(duration time.Duration, render func(ctx *Context)) *AnimationSequence
- func NewAnimationSequence() *AnimationSequence
- func Pulse(duration time.Duration, minScale, maxScale float64, render func(ctx *Context)) *AnimationSequence
- func SlideIn(duration time.Duration, direction string, render func(ctx *Context)) *AnimationSequence
- type AnimationStep
- type Animator
- type ArabicForm
- type Batch
- type BatchCircle
- type BatchImage
- type BatchLine
- type BatchOpType
- type BatchOperation
- type BatchRectangle
- type BatchText
- type BidiRun
- type BlendMode
- type BlurOperation
- type Bounds
- type BrightnessOperation
- func (op *BrightnessOperation) Apply(img *image.RGBA) *image.RGBA
- func (op *BrightnessOperation) Clone() EditOperation
- func (op *BrightnessOperation) GetParameters() map[string]interface{}
- func (op *BrightnessOperation) GetType() string
- func (op *BrightnessOperation) SetParameters(params map[string]interface{})
- type ByteSlicePool
- type CMYK
- type Cache
- type CacheConfig
- type CacheEntry
- type CacheStats
- type CircleShape
- type Color
- type ColorConverter
- type ColorEmojiFont
- type ColorSpace
- type ConditionalBatch
- type Context
- func CreateNew(width, height int, backgroundColor color.Color) *Context
- func CreateNewGrayscale(width, height int, gray uint8) *Context
- func CreateNewRGB(width, height int, r, g, b uint8) *Context
- func CreateNewRGBA(width, height int, r, g, b, a uint8) *Context
- func CreateNewTransparent(width, height int) *Context
- func NewContext(width, height int) *Context
- func NewContextForImage(im image.Image) *Context
- func NewContextForRGBA(im *image.RGBA) *Context
- func PooledContext(width, height int) *Context
- func (dc *Context) AddEditOperation(op EditOperation)
- func (dc *Context) AddGuide(position float64, orientation GuideOrientation) *Guide
- func (dc *Context) AddLayer(name string) *Layer
- func (dc *Context) ApplyFilter(filter Filter)
- func (dc *Context) ApplyNonDestructiveEdits()
- func (dc *Context) AsMask() *image.Alpha
- func (dc *Context) BatchCircles(circles []BatchCircle)
- func (dc *Context) BatchImages(images []BatchImage)
- func (dc *Context) BatchLines(lines []BatchLine)
- func (dc *Context) BatchRectangles(rectangles []BatchRectangle)
- func (dc *Context) BatchTexts(texts []BatchText)
- func (dc *Context) BeginBatch() *Batch
- func (dc *Context) Clear()
- func (dc *Context) ClearPath()
- func (dc *Context) ClearShadow()
- func (dc *Context) Clip()
- func (dc *Context) ClipPath2D(path2d *Path2D)
- func (dc *Context) ClipPreserve()
- func (dc *Context) ClosePath()
- func (dc *Context) CompositeImage(src image.Image, dstX, dstY int, blendMode draw.Op)
- func (dc *Context) CompositeToImage()
- func (dc *Context) ConvertToColorSpace(targetProfile *ICCProfile)
- func (dc *Context) CreateImageData(width, height int) *ImageData
- func (dc *Context) CubicTo(x1, y1, x2, y2, x3, y3 float64)
- func (dc *Context) DisableLayers()
- func (dc *Context) DrawAlignedText(text string, x, y, width float64, hAlign, vAlign Align)
- func (dc *Context) DrawArc(x, y, r, angle1, angle2 float64)
- func (dc *Context) DrawCachedCircle(x, y, radius float64, fill bool)
- func (dc *Context) DrawCachedText(text string, x, y float64)
- func (dc *Context) DrawCircle(x, y, r float64)
- func (dc *Context) DrawCircleOnImage(x, y, r float64)
- func (dc *Context) DrawCircleWithBorder(x, y, r float64, fillColor, borderColor color.Color, borderWidth float64)
- func (dc *Context) DrawCircleWithShadow(x, y, r float64)
- func (dc *Context) DrawDashedLine(x1, y1, x2, y2 float64, pattern []float64)
- func (dc *Context) DrawDonut(x, y, outerRadius, innerRadius float64)
- func (dc *Context) DrawEllipse(x, y, rx, ry float64)
- func (dc *Context) DrawEllipseOnImage(x, y, rx, ry float64)
- func (dc *Context) DrawEllipseWithShadow(x, y, rx, ry float64)
- func (dc *Context) DrawEllipticalArc(x, y, rx, ry, angle1, angle2 float64)
- func (dc *Context) DrawFilledCircle(x, y, r float64)
- func (dc *Context) DrawGradientLine(x1, y1, x2, y2 float64, stops []StrokeGradientStop)
- func (dc *Context) DrawImage(im image.Image, x, y int)
- func (dc *Context) DrawImageAnchored(im image.Image, x, y int, ax, ay float64)
- func (dc *Context) DrawImageAnchoredWithShadow(im image.Image, x, y int, ax, ay float64)
- func (dc *Context) DrawImageWithShadow(im image.Image, x, y int)
- func (dc *Context) DrawLine(x1, y1, x2, y2 float64)
- func (dc *Context) DrawPath2D(path2d *Path2D)
- func (dc *Context) DrawPieSlice(x, y, radius, startAngle, endAngle float64)
- func (dc *Context) DrawPoint(x, y, r float64)
- func (dc *Context) DrawPolygon(x, y, radius float64, sides int)
- func (dc *Context) DrawRectangle(x, y, w, h float64)
- func (dc *Context) DrawRectangleOnImage(x, y, w, h float64)
- func (dc *Context) DrawRectangleWithShadow(x, y, w, h float64)
- func (dc *Context) DrawRegularPolygon(n int, x, y, r, rotation float64)
- func (dc *Context) DrawRoundedRectangle(x, y, w, h, r float64)
- func (dc *Context) DrawRoundedRectangleOnImage(x, y, w, h, r float64)
- func (dc *Context) DrawRoundedRectangleWithShadow(x, y, w, h, r float64)
- func (dc *Context) DrawShapedString(text string, x, y float64)
- func (dc *Context) DrawStar(x, y, outerRadius, innerRadius float64, points int)
- func (dc *Context) DrawString(s string, x, y float64)
- func (dc *Context) DrawStringAnchored(s string, x, y, ax, ay float64)
- func (dc *Context) DrawStringAnchoredWithShadow(s string, x, y, ax, ay float64)
- func (dc *Context) DrawStringWithEmoji(text string, x, y float64)
- func (dc *Context) DrawStringWithShadow(s string, x, y float64)
- func (dc *Context) DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing float64, align Align)
- func (dc *Context) DrawStrokedCircle(x, y, r float64)
- func (dc *Context) DrawTaperedLine(x1, y1, x2, y2 float64, startWidth, endWidth float64)
- func (dc *Context) DrawTextBox(text string, x, y, width, height float64, align Align)
- func (dc *Context) DrawTextBoxAnchored(text string, x, y, ax, ay, width, height float64, align Align)
- func (dc *Context) EnableGuides()
- func (dc *Context) EnableLayers()
- func (dc *Context) EnableNonDestructiveEditing()
- func (dc *Context) EncodeJPG(w io.Writer, o *jpeg.Options) error
- func (dc *Context) EncodePNG(w io.Writer) error
- func (dc *Context) ExecuteBatch(batch *Batch)
- func (dc *Context) Fill()
- func (dc *Context) FillPath2D(path2d *Path2D)
- func (dc *Context) FillPreserve()
- func (dc *Context) FillWithShadow()
- func (dc *Context) FontHeight() float64
- func (dc *Context) GetActiveLayer() *Layer
- func (dc *Context) GetAdvancedStroke() *StrokeStyle
- func (dc *Context) GetBaseline() float64
- func (dc *Context) GetColorProfile() *ICCProfile
- func (dc *Context) GetCurrentPoint() (Point, bool)
- func (dc *Context) GetEditStack() *EditStack
- func (dc *Context) GetEmojiRenderer() *EmojiRenderer
- func (dc *Context) GetFontMetrics() (ascent, descent, lineGap float64)
- func (dc *Context) GetGuideManager() *GuideManager
- func (dc *Context) GetImageData() *ImageData
- func (dc *Context) GetImageDataRegion(x, y, width, height int) *ImageData
- func (dc *Context) GetLayerManager() *LayerManager
- func (dc *Context) GetLineHeight() float64
- func (dc *Context) GetTextBoxSize(text string, maxWidth float64) (width, height float64)
- func (dc *Context) GetTextHeight() float64
- func (dc *Context) GetTextShaper() *TextShaper
- func (dc *Context) GetTextWidth(s string) float64
- func (dc *Context) HasShadow() bool
- func (dc *Context) Height() int
- func (dc *Context) Identity()
- func (dc *Context) Image() image.Image
- func (dc *Context) InvertMask()
- func (dc *Context) InvertY()
- func (dc *Context) IsPointInPath2D(path2d *Path2D, x, y float64) bool
- func (dc *Context) LineTo(x, y float64)
- func (dc *Context) LoadFontFace(path string, points float64) error
- func (dc *Context) LoadFontFaceFromBytes(fontBytes []byte, points float64) error
- func (dc *Context) LoadFontFaceWithOptions(path string, options *truetype.Options) error
- func (dc *Context) LoadOTFFace(path string, points float64) error
- func (dc *Context) LoadTTFFace(path string, points float64) error
- func (dc *Context) MeasureMultilineString(s string, lineSpacing float64) (width, height float64)
- func (dc *Context) MeasureString(s string) (w, h float64)
- func (dc *Context) MeasureTextMetrics(s string) TextMetrics
- func (dc *Context) MoveTo(x, y float64)
- func (dc *Context) NewSubPath()
- func (dc *Context) PasteImage(im image.Image, x, y int)
- func (dc *Context) PasteImageWithMask(im image.Image, mask image.Image, x, y int)
- func (dc *Context) Pop()
- func (dc *Context) Push()
- func (dc *Context) PutImageData(imageData *ImageData)
- func (dc *Context) PutImageDataAt(imageData *ImageData, x, y int)
- func (dc *Context) QuadraticTo(x1, y1, x2, y2 float64)
- func (dc *Context) ResetClip()
- func (dc *Context) Rotate(angle float64)
- func (dc *Context) RotateAbout(angle, x, y float64)
- func (dc *Context) SaveBMP(path string) error
- func (dc *Context) SaveGIF(path string) error
- func (dc *Context) SaveJPEG(path string, quality int) error
- func (dc *Context) SaveJPG(path string, quality int) error
- func (dc *Context) SavePNG(path string) error
- func (dc *Context) SaveTIFF(path string) error
- func (dc *Context) Scale(x, y float64)
- func (dc *Context) ScaleAbout(sx, sy, x, y float64)
- func (dc *Context) SetActiveLayer(index int) bool
- func (dc *Context) SetActiveLayerByName(name string) bool
- func (dc *Context) SetAdvancedStroke(style *StrokeStyle)
- func (dc *Context) SetCMYK(c, m, y, k float64)
- func (dc *Context) SetColor(c color.Color)
- func (dc *Context) SetColorConverter(converter *ColorConverter)
- func (dc *Context) SetColorProfile(profile *ICCProfile)
- func (dc *Context) SetDash(dashes ...float64)
- func (dc *Context) SetDashOffset(offset float64)
- func (dc *Context) SetEmojiRenderer(renderer *EmojiRenderer)
- func (dc *Context) SetFillRule(fillRule FillRule)
- func (dc *Context) SetFillRuleEvenOdd()
- func (dc *Context) SetFillRuleWinding()
- func (dc *Context) SetFillStyle(pattern Pattern)
- func (dc *Context) SetFontFace(fontFace font.Face)
- func (dc *Context) SetHSL(h, s, l float64)
- func (dc *Context) SetHSV(h, s, v float64)
- func (dc *Context) SetHexColor(x string)
- func (dc *Context) SetLAB(l, a, b float64)
- func (dc *Context) SetLineCap(lineCap LineCap)
- func (dc *Context) SetLineCapButt()
- func (dc *Context) SetLineCapRound()
- func (dc *Context) SetLineCapSquare()
- func (dc *Context) SetLineJoin(lineJoin LineJoin)
- func (dc *Context) SetLineJoinBevel()
- func (dc *Context) SetLineJoinRound()
- func (dc *Context) SetLineWidth(lineWidth float64)
- func (dc *Context) SetMask(mask *image.Alpha) error
- func (dc *Context) SetPixel(x, y int)
- func (dc *Context) SetRGB(r, g, b float64)
- func (dc *Context) SetRGB255(r, g, b int)
- func (dc *Context) SetRGBA(r, g, b, a float64)
- func (dc *Context) SetRGBA255(r, g, b, a int)
- func (dc *Context) SetShadow(offsetX, offsetY, blur float64, shadowColor color.Color)
- func (dc *Context) SetShadowRGBA(offsetX, offsetY, blur, r, g, b, a float64)
- func (dc *Context) SetStrokeStyle(pattern Pattern)
- func (dc *Context) SetTextShaper(shaper *TextShaper)
- func (dc *Context) Shear(x, y float64)
- func (dc *Context) ShearAbout(sx, sy, x, y float64)
- func (dc *Context) SnapPoint(x, y float64) (float64, float64)
- func (dc *Context) Stroke()
- func (dc *Context) StrokePath2D(path2d *Path2D)
- func (dc *Context) StrokePreserve()
- func (dc *Context) StrokeWithShadow()
- func (dc *Context) TransformPoint(x, y float64) (tx, ty float64)
- func (dc *Context) Translate(x, y float64)
- func (dc *Context) ValidateContext() error
- func (dc *Context) ValidateFontLoaded() error
- func (dc *Context) Width() int
- func (dc *Context) WordWrap(s string, w float64) []string
- func (dc *Context) WrapText(text string, maxWidth float64) []string
- type ContextPool
- type ContrastOperation
- func (op *ContrastOperation) Apply(img *image.RGBA) *image.RGBA
- func (op *ContrastOperation) Clone() EditOperation
- func (op *ContrastOperation) GetParameters() map[string]interface{}
- func (op *ContrastOperation) GetType() string
- func (op *ContrastOperation) SetParameters(params map[string]interface{})
- type CropOperation
- type DebugConfig
- type DebugContext
- func (dc *DebugContext) ClearDebugInfo()
- func (dc *DebugContext) DebugDrawCircle(x, y, radius float64)
- func (dc *DebugContext) DebugDrawRectangle(x, y, width, height float64)
- func (dc *DebugContext) DebugDrawString(text string, x, y float64)
- func (dc *DebugContext) DrawDebugGrid()
- func (dc *DebugContext) DrawPerformanceOverlay()
- func (dc *DebugContext) GetDebugInfo() []DebugInfo
- func (dc *DebugContext) PrintDebugSummary()
- type DebugInfo
- type DebugMode
- type DeviceClass
- type Document
- type EasingFunc
- type EditOperation
- type EditStack
- func (es *EditStack) AddOperation(op EditOperation)
- func (es *EditStack) Clear()
- func (es *EditStack) Clone() *EditStack
- func (es *EditStack) GetPreview(upToIndex int) *image.RGBA
- func (es *EditStack) GetResult() *image.RGBA
- func (es *EditStack) InsertOperation(index int, op EditOperation)
- func (es *EditStack) MoveOperation(from, to int) bool
- func (es *EditStack) RemoveOperation(index int) bool
- func (es *EditStack) UpdateOperation(index int, params map[string]interface{}) bool
- type Element
- func (e *Element) AddChild(child *Element)
- func (e *Element) AddClass(class string)
- func (e *Element) Draw(ctx *Context)
- func (e *Element) GetStyle(property string) interface{}
- func (e *Element) HasClass(class string) bool
- func (e *Element) RemoveChild(child *Element)
- func (e *Element) RemoveClass(class string)
- func (e *Element) SetStyle(property string, value interface{})
- type EmojiInfo
- type EmojiRenderer
- func (er *EmojiRenderer) GetEmojiCategory(r rune) string
- func (er *EmojiRenderer) GetEmojiInfo(emojiText string) *EmojiInfo
- func (er *EmojiRenderer) LoadEmojiFont(fontPath string) error
- func (er *EmojiRenderer) ParseEmojiSequence(text string) []EmojiSequence
- func (er *EmojiRenderer) RenderEmoji(sequence EmojiSequence, size float64) *image.RGBA
- type EmojiSequence
- type ErrorHandler
- type ErrorType
- type FillRule
- type Filter
- func BatchFilter(filters ...Filter) Filter
- func Blur(radius int) Filter
- func Brightness(factor float64) Filter
- func Contrast(factor float64) Filter
- func FastBlur(radius int) Filter
- func FastBrightness(factor float64) Filter
- func FastContrast(factor float64) Filter
- func FastEdgeDetection() Filter
- func FastSharpen(amount float64) Filter
- func Noise(intensity float64) Filter
- func ParallelFilter(filter Filter, numWorkers int) Filter
- func Pixelate(blockSize int) Filter
- func Posterize(levels int) Filter
- func Threshold(threshold uint8) Filter
- func Vignette(strength float64) Filter
- type FontCache
- type Gradient
- type Guide
- type GuideManager
- func (gm *GuideManager) AddGuide(position float64, orientation GuideOrientation) *Guide
- func (gm *GuideManager) ClearGuides()
- func (gm *GuideManager) GenerateCenterGuides(width, height float64)
- func (gm *GuideManager) GenerateMarginGuides(width, height float64)
- func (gm *GuideManager) GetNearestGuides(x, y float64, maxDistance float64) []*Guide
- func (gm *GuideManager) RemoveGuide(guide *Guide) bool
- func (gm *GuideManager) SnapPoint(x, y float64) (float64, float64)
- func (gm *GuideManager) SnapRectangle(x, y, width, height float64) (float64, float64, float64, float64)
- type GuideOrientation
- type GuideType
- type HSL
- type HSV
- type HitTestCircle
- type HitTestEllipse
- type HitTestLine
- type HitTestManager
- func (htm *HitTestManager) AddObject(obj HitTestable)
- func (htm *HitTestManager) HitTest(x, y float64) []HitTestable
- func (htm *HitTestManager) HitTestFirst(x, y float64) HitTestable
- func (htm *HitTestManager) HitTestLast(x, y float64) HitTestable
- func (htm *HitTestManager) RemoveObject(obj HitTestable)
- type HitTestPath
- type HitTestPolygon
- type HitTestRect
- type HitTestable
- type ICCHeader
- type ICCProfile
- type ICCTag
- type ImageCache
- type ImageData
- func (id *ImageData) ApplyKernel(kernel [][]float64) *ImageData
- func (id *ImageData) Clone() *ImageData
- func (id *ImageData) CopyFrom(src *ImageData, srcX, srcY, srcWidth, srcHeight, dstX, dstY int)
- func (id *ImageData) Fill(r, g, b, a uint8)
- func (id *ImageData) FillRect(x, y, width, height int, r, g, b, a uint8)
- func (id *ImageData) FlipHorizontal() *ImageData
- func (id *ImageData) FlipVertical() *ImageData
- func (id *ImageData) GetPixel(x, y int) (r, g, b, a uint8)
- func (id *ImageData) GetPixelColor(x, y int) color.RGBA
- func (id *ImageData) GetSubImageData(x, y, width, height int) *ImageData
- func (id *ImageData) Resize(newWidth, newHeight int) *ImageData
- func (id *ImageData) Rotate90() *ImageData
- func (id *ImageData) SetPixel(x, y int, r, g, b, a uint8)
- func (id *ImageData) SetPixelColor(x, y int, c color.Color)
- func (id *ImageData) ToImage() *image.RGBA
- type ImagePool
- type LAB
- type Layer
- type LayerManager
- func (lm *LayerManager) AddLayer(name string) *Layer
- func (lm *LayerManager) Composite() *image.RGBA
- func (lm *LayerManager) DuplicateLayer(index int) *Layer
- func (lm *LayerManager) GetActiveLayer() *Layer
- func (lm *LayerManager) InsertLayer(index int, name string) *Layer
- func (lm *LayerManager) MoveLayer(from, to int) bool
- func (lm *LayerManager) RemoveLayer(index int) bool
- func (lm *LayerManager) SetActiveLayer(index int) bool
- func (lm *LayerManager) SetActiveLayerByName(name string) bool
- type LineCap
- type LineJoin
- type LineShape
- type Margins
- type Matrix
- func (a Matrix) Multiply(b Matrix) Matrix
- func (a Matrix) Rotate(angle float64) Matrix
- func (a Matrix) Scale(x, y float64) Matrix
- func (a Matrix) Shear(x, y float64) Matrix
- func (a Matrix) TransformPoint(x, y float64) (tx, ty float64)
- func (a Matrix) TransformVector(x, y float64) (tx, ty float64)
- func (a Matrix) Translate(x, y float64) Matrix
- type MemoryStats
- type OptimizedContext
- func (oc *OptimizedContext) AddDirtyRegion(bounds Bounds)
- func (oc *OptimizedContext) ClearDirtyRegions()
- func (oc *OptimizedContext) DrawOptimizedRectangle(id string, x, y, width, height float64, fillColor color.Color)
- func (oc *OptimizedContext) GetDirtyRegions() []Bounds
- func (oc *OptimizedContext) GetPerformanceMonitor() *PerformanceMonitor
- func (oc *OptimizedContext) GetRenderCache() *RenderCache
- func (oc *OptimizedContext) GetSpatialIndex() *SpatialIndex
- func (oc *OptimizedContext) IsVisible(bounds Bounds) bool
- type ParallelRenderer
- type Path2D
- func (p *Path2D) AddPath(other *Path2D)
- func (p *Path2D) Arc(x, y, radius, startAngle, endAngle float64, counterclockwise bool)
- func (p *Path2D) ArcTo(x1, y1, x2, y2, radius float64)
- func (p *Path2D) BezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y float64)
- func (p *Path2D) ClosePath()
- func (p *Path2D) Ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle float64, ...)
- func (p *Path2D) GetCurrentPoint() (x, y float64)
- func (p *Path2D) GetPath() raster.Path
- func (p *Path2D) IsEmpty() bool
- func (p *Path2D) LineTo(x, y float64)
- func (p *Path2D) MoveTo(x, y float64)
- func (p *Path2D) QuadraticCurveTo(cpx, cpy, x, y float64)
- func (p *Path2D) Rect(x, y, width, height float64)
- type PathCache
- type PathPool
- type PathShape
- type Pattern
- type PerformanceMonitor
- type Point
- type PoolConfig
- type RectShape
- type Rectangle
- type RenderCache
- type RenderJob
- type RenderResult
- type RenderingIntent
- type RepeatOp
- type ResizeAlgorithm
- type SIMDConfig
- type ScriptType
- type Shape
- type ShapedGlyph
- type ShapedText
- type SpatialIndex
- type SpatialObject
- type StrokeGradient
- type StrokeGradientStop
- type StrokeGradientType
- type StrokeLineCap
- type StrokeLineJoin
- type StrokeStyle
- func CreateDashedStroke(width float64, color color.Color, pattern []float64) *StrokeStyle
- func CreateGradientStroke(width float64, startX, startY, endX, endY float64, stops []StrokeGradientStop) *StrokeStyle
- func CreateTaperedStroke(width float64, color color.Color, startWidth, endWidth float64) *StrokeStyle
- func NewStrokeStyle() *StrokeStyle
- func (ss *StrokeStyle) SetDashPattern(pattern []float64, offset float64)
- func (ss *StrokeStyle) SetLinearGradient(startX, startY, endX, endY float64, stops []StrokeGradientStop)
- func (ss *StrokeStyle) SetRadialGradient(centerX, centerY, radius float64, stops []StrokeGradientStop)
- func (ss *StrokeStyle) SetTaper(startWidth, endWidth float64, taperType StrokeTaperType)
- type StrokeTaper
- type StrokeTaperType
- type Style
- type TextDirection
- type TextMetrics
- type TextShape
- type TextShaper
- type ToneCurve
- type XYZ
- type XYZColor
Constants ¶
const ( EmojiCategorySmileys = "Smileys & Emotion" EmojiCategoryPeople = "People & Body" EmojiCategoryAnimals = "Animals & Nature" EmojiCategoryFood = "Food & Drink" EmojiCategoryActivities = "Activities" EmojiCategoryTravel = "Travel & Places" EmojiCategoryObjects = "Objects" EmojiCategorySymbols = "Symbols" EmojiCategoryFlags = "Flags" )
Common emoji categories
const ( TagRedColorant = 0x7258595A // 'rXYZ' TagGreenColorant = 0x6758595A // 'gXYZ' TagBlueColorant = 0x6258595A // 'bXYZ' TagWhitePoint = 0x77747074 // 'wtpt' TagBlackPoint = 0x626B7074 // 'bkpt' TagRedTRC = 0x72545243 // 'rTRC' TagGreenTRC = 0x67545243 // 'gTRC' TagBlueTRC = 0x62545243 // 'bTRC' TagGrayTRC = 0x6B545243 // 'kTRC' TagDescription = 0x64657363 // 'desc' TagCopyright = 0x63707274 // 'cprt' )
Common ICC tag signatures
Variables ¶
var ( IlluminantD50 = XYZColor{X: 0.9642, Y: 1.0000, Z: 0.8249} IlluminantD65 = XYZColor{X: 0.9505, Y: 1.0000, Z: 1.0890} )
Standard illuminants
var GlobalByteSlicePool = NewByteSlicePool()
GlobalByteSlicePool is the global byte slice pool
var GlobalContextPool = NewContextPool()
GlobalContextPool is the global context pool
var GlobalDebugConfig = DefaultDebugConfig()
GlobalDebugConfig is the global debug configuration
var GlobalFontCache = NewFontCache(50*1024*1024, 500) // 50MB, 500 items
GlobalFontCache is the global font cache
var GlobalImageCache = NewImageCache(100*1024*1024, 1000) // 100MB, 1000 items
GlobalImageCache is the global image cache
var GlobalImagePool = NewImagePool()
GlobalImagePool is the global image pool instance
var GlobalPathCache = NewPathCache(25*1024*1024, 250) // 25MB, 250 items
GlobalPathCache is the global path cache
var GlobalPathPool = NewPathPool()
GlobalPathPool is the global path pool
Functions ¶
func AnimateColor ¶
AnimateColor animates between two colors
func AnimateProperty ¶
func AnimateProperty(start, end, t float64, easing EasingFunc) float64
AnimateProperty animates a single property over time
func DebugAssert ¶
DebugAssert checks a condition and logs an error if it fails
func DebugLog ¶
func DebugLog(format string, args ...interface{})
DebugLog logs a debug message if debug mode is enabled
func EdgeDetection ¶
EdgeDetection applies edge detection using Sobel operator
func FastGrayscale ¶
FastGrayscale is an optimized version of Grayscale using SIMD
func GenerateFontKey ¶
GenerateFontKey generates a cache key for a font operation
func GenerateImageKey ¶
GenerateImageKey generates a cache key for an image operation
func GeneratePathKey ¶
GeneratePathKey generates a cache key for a path operation
func GetCacheStats ¶
func GetCacheStats() map[string]CacheStats
GetCacheStats returns statistics for all caches
func GetFontFormat ¶
GetFontFormat attempts to detect the font format from the file header.
func HandleError ¶
func HandleError(err error)
HandleError handles an error using the global error handler
func LoadFontFace ¶
LoadFontFace is a helper function to load the specified font file with the specified point size. Supports both TTF and OTF font formats. Note that the returned `font.Face` objects are not thread safe and cannot be used in parallel across goroutines. You can usually just use the Context.LoadFontFace function instead of this package-level function.
func LoadOTFFace ¶
LoadOTFFace loads an OTF font file with the specified point size.
func LoadTTFFace ¶
LoadTTFFace loads a TTF font file with the specified point size.
func ParseFontFace ¶
ParseFontFace parses font data from bytes and creates a font face. Supports both TTF and OTF formats.
func ParseFontFaceWithOptions ¶
ParseFontFaceWithOptions parses font data with custom options.
func RecoverFromPanic ¶
func RecoverFromPanic() error
RecoverFromPanic recovers from panics and converts them to AdvanceErrors
func ReleaseContext ¶
func ReleaseContext(ctx *Context)
ReleaseContext returns a context and its resources to pools
func ResizeImage ¶
ResizeImage resizes an image to the specified width and height using a default algorithm (bilinear) that balances quality and performance.
func ResizeImageFill ¶
ResizeImageFill scales the image to completely fill the target width/height while maintaining aspect ratio, then center-crops to the exact size. This may crop edges.
func ResizeImageFit ¶
ResizeImageFit resizes an image to fit entirely within the given bounding box while maintaining aspect ratio. The returned image will be <= maxWidth x maxHeight.
func ResizeImageWithAlgorithm ¶
func ResizeImageWithAlgorithm(img image.Image, newWidth, newHeight int, algo ResizeAlgorithm) image.Image
ResizeImageWithAlgorithm resizes an image using the specified algorithm.
func SIMDAlphaBlend ¶
SIMDAlphaBlend performs optimized alpha blending
func SIMDColorTransform ¶
func SIMDColorTransform(img *image.RGBA, transform func(r, g, b, a uint8) (uint8, uint8, uint8, uint8)) *image.RGBA
SIMDColorTransform applies color transformations using SIMD
func SIMDConvolution ¶
SIMDConvolution applies convolution kernel with SIMD optimizations
func SIMDResize ¶
SIMDResize performs optimized image resizing
func SafeExecute ¶
SafeExecute executes a function with panic recovery
func ScaleImage ¶
ScaleImage scales an image by a floating-point factor. For example, factor=2.0 doubles the dimensions; factor=0.5 halves them.
func SetCacheConfig ¶
func SetCacheConfig(config CacheConfig)
SetCacheConfig configures the global caches
func SetDebugConfig ¶
func SetDebugConfig(config DebugConfig)
SetDebugConfig sets the global debug configuration
func SetErrorHandler ¶
func SetErrorHandler(handler ErrorHandler)
SetErrorHandler sets the global error handler
func SetPoolConfig ¶
func SetPoolConfig(config PoolConfig)
SetPoolConfig sets the global pool configuration
func ValidateImageBounds ¶
ValidateImageBounds validates coordinates are within image bounds
func ValidateNotNil ¶
ValidateNotNil validates that a pointer is not nil
func ValidatePositive ¶
ValidatePositive validates that a number is positive
func ValidateRange ¶
ValidateRange validates that a value is within a range
Types ¶
type AdvanceError ¶
type AdvanceError struct {
Type ErrorType
Message string
Context map[string]interface{}
StackTrace []string
Suggestions []string
Code string
}
AdvanceError represents an enhanced error with context
func NewError ¶
func NewError(errorType ErrorType, message string) *AdvanceError
NewError creates a new AdvanceError with stack trace
func NewFileNotFoundError ¶
func NewFileNotFoundError(filepath string) *AdvanceError
NewFileNotFoundError creates an error for missing files
func NewInvalidFormatError ¶
func NewInvalidFormatError(filepath string, expectedFormats []string) *AdvanceError
NewInvalidFormatError creates an error for invalid file formats
func NewInvalidParameterError ¶
func NewInvalidParameterError(paramName string, value interface{}, expected string) *AdvanceError
NewInvalidParameterError creates an error for invalid parameters
func NewInvalidStateError ¶
func NewInvalidStateError(operation string, currentState string, requiredState string) *AdvanceError
NewInvalidStateError creates an error for invalid context state
func NewMemoryError ¶
func NewMemoryError(operation string, requestedSize int64) *AdvanceError
NewMemoryError creates an error for memory-related issues
func NewOutOfBoundsError ¶
func NewOutOfBoundsError(operation string, value, min, max interface{}) *AdvanceError
NewOutOfBoundsError creates an error for out-of-bounds operations
func NewRenderError ¶
func NewRenderError(operation string, details string) *AdvanceError
NewRenderError creates an error for rendering issues
func NewUnsupportedOperationError ¶
func NewUnsupportedOperationError(operation string, reason string) *AdvanceError
NewUnsupportedOperationError creates an error for unsupported operations
func (*AdvanceError) Error ¶
func (e *AdvanceError) Error() string
Error implements the error interface
func (*AdvanceError) WithCode ¶
func (e *AdvanceError) WithCode(code string) *AdvanceError
WithCode adds an error code
func (*AdvanceError) WithContext ¶
func (e *AdvanceError) WithContext(key string, value interface{}) *AdvanceError
WithContext adds context to the error
func (*AdvanceError) WithSuggestion ¶
func (e *AdvanceError) WithSuggestion(suggestion string) *AdvanceError
WithSuggestion adds a suggestion to the error
type AlignmentTarget ¶
AlignmentTarget represents something that can be aligned
func AlignTargetsBottom ¶
func AlignTargetsBottom(targets []AlignmentTarget) []AlignmentTarget
AlignTargetsBottom aligns targets to the bottommost position
func AlignTargetsCenterHorizontal ¶
func AlignTargetsCenterHorizontal(targets []AlignmentTarget) []AlignmentTarget
AlignTargetsCenterHorizontal aligns targets horizontally to center
func AlignTargetsCenterVertical ¶
func AlignTargetsCenterVertical(targets []AlignmentTarget) []AlignmentTarget
AlignTargetsCenterVertical aligns targets vertically to center
func AlignTargetsLeft ¶
func AlignTargetsLeft(targets []AlignmentTarget) []AlignmentTarget
AlignTargetsLeft aligns targets to the leftmost position
func AlignTargetsRight ¶
func AlignTargetsRight(targets []AlignmentTarget) []AlignmentTarget
AlignTargetsRight aligns targets to the rightmost position
func AlignTargetsTop ¶
func AlignTargetsTop(targets []AlignmentTarget) []AlignmentTarget
AlignTargetsTop aligns targets to the topmost position
func DistributeHorizontally ¶
func DistributeHorizontally(targets []AlignmentTarget) []AlignmentTarget
DistributeHorizontally distributes targets evenly horizontally
func DistributeVertically ¶
func DistributeVertically(targets []AlignmentTarget) []AlignmentTarget
DistributeVertically distributes targets evenly vertically
type AnimationFrame ¶
AnimationFrame represents a single frame in an animation
type AnimationSequence ¶
type AnimationSequence struct {
// contains filtered or unexported fields
}
AnimationSequence represents a sequence of animations
func AnimRotate ¶
func AnimRotate(duration time.Duration, fromAngle, toAngle float64, render func(ctx *Context)) *AnimationSequence
AnimRotate creates a rotation animation
func AnimScale ¶
func AnimScale(duration time.Duration, fromScale, toScale float64, render func(ctx *Context)) *AnimationSequence
AnimScale creates a scale animation
func FadeIn ¶
func FadeIn(duration time.Duration, render func(ctx *Context)) *AnimationSequence
FadeIn creates a fade-in animation
func FadeOut ¶
func FadeOut(duration time.Duration, render func(ctx *Context)) *AnimationSequence
FadeOut creates a fade-out animation
func NewAnimationSequence ¶
func NewAnimationSequence() *AnimationSequence
NewAnimationSequence creates a new animation sequence
func Pulse ¶
func Pulse(duration time.Duration, minScale, maxScale float64, render func(ctx *Context)) *AnimationSequence
Pulse creates a pulsing animation
func SlideIn ¶
func SlideIn(duration time.Duration, direction string, render func(ctx *Context)) *AnimationSequence
SlideIn creates a slide-in animation
func (*AnimationSequence) AddStep ¶
func (seq *AnimationSequence) AddStep(duration time.Duration, render func(t float64, ctx *Context), easing EasingFunc) *AnimationSequence
AddStep adds a step to the animation sequence
type AnimationStep ¶
type AnimationStep struct {
// contains filtered or unexported fields
}
AnimationStep represents a single step in an animation sequence
type Animator ¶
type Animator struct {
// contains filtered or unexported fields
}
Animator manages frame-based animations
func NewAnimator ¶
NewAnimator creates a new animator
func (*Animator) GetFrameCount ¶
GetFrameCount returns the number of frames
type ArabicForm ¶
type ArabicForm int
ArabicForm represents Arabic contextual forms
const ( ArabicIsolated ArabicForm = iota ArabicInitial ArabicMedial ArabicFinal )
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch manages a collection of drawing operations
type BatchCircle ¶
BatchCircle represents a circle drawing operation
func (BatchCircle) Execute ¶
func (op BatchCircle) Execute(ctx *Context)
func (BatchCircle) GetBounds ¶
func (op BatchCircle) GetBounds() (x, y, width, height float64)
func (BatchCircle) GetType ¶
func (op BatchCircle) GetType() BatchOpType
type BatchImage ¶
BatchImage represents an image drawing operation
func (BatchImage) Execute ¶
func (op BatchImage) Execute(ctx *Context)
func (BatchImage) GetBounds ¶
func (op BatchImage) GetBounds() (x, y, width, height float64)
func (BatchImage) GetType ¶
func (op BatchImage) GetType() BatchOpType
type BatchLine ¶
BatchLine represents a line drawing operation
func (BatchLine) GetType ¶
func (op BatchLine) GetType() BatchOpType
type BatchOpType ¶
type BatchOpType int
BatchOpType represents the type of batch operation
const ( BatchOpCircle BatchOpType = iota BatchOpRectangle BatchOpLine BatchOpText BatchOpImage BatchOpPath )
type BatchOperation ¶
type BatchOperation interface {
Execute(ctx *Context)
GetBounds() (x, y, width, height float64)
GetType() BatchOpType
}
BatchOperation represents a single drawing operation
type BatchRectangle ¶
BatchRectangle represents a rectangle drawing operation
func (BatchRectangle) Execute ¶
func (op BatchRectangle) Execute(ctx *Context)
func (BatchRectangle) GetBounds ¶
func (op BatchRectangle) GetBounds() (x, y, width, height float64)
func (BatchRectangle) GetType ¶
func (op BatchRectangle) GetType() BatchOpType
type BatchText ¶
BatchText represents a text drawing operation
func (BatchText) GetType ¶
func (op BatchText) GetType() BatchOpType
type BidiRun ¶
type BidiRun struct {
Text string
Direction TextDirection
Script ScriptType
Language string
Level int
}
BidiRun represents a run of text with consistent direction and script
type BlendMode ¶
type BlendMode int
BlendMode represents different layer blending modes
const ( BlendModeNormal BlendMode = iota // Photoshop-style Blend Modes BlendModeMultiply BlendModeScreen BlendModeOverlay BlendModeSoftLight BlendModeHardLight BlendModeColorDodge BlendModeColorBurn BlendModeDarken BlendModeLighten BlendModeDifference BlendModeExclusion BlendModeHue BlendModeSaturation BlendModeColor BlendModeLuminosity // Porter-Duff Compositing Operators BlendModeClear BlendModeSource BlendModeDest BlendModeSrcOver // Alias for Normal but explicit BlendModeDstOver BlendModeSrcIn BlendModeDstIn BlendModeSrcOut BlendModeDstOut BlendModeSrcAtop BlendModeDstAtop BlendModeXor BlendModeAdd )
type BlurOperation ¶
type BlurOperation struct {
Radius float64
}
BlurOperation applies blur
func (*BlurOperation) Clone ¶
func (op *BlurOperation) Clone() EditOperation
func (*BlurOperation) GetParameters ¶
func (op *BlurOperation) GetParameters() map[string]interface{}
func (*BlurOperation) GetType ¶
func (op *BlurOperation) GetType() string
func (*BlurOperation) SetParameters ¶
func (op *BlurOperation) SetParameters(params map[string]interface{})
type Bounds ¶
type Bounds struct {
X, Y, Width, Height float64
}
Bounds represents a bounding rectangle
type BrightnessOperation ¶
type BrightnessOperation struct {
Amount float64
}
BrightnessOperation adjusts image brightness
func (*BrightnessOperation) Apply ¶
func (op *BrightnessOperation) Apply(img *image.RGBA) *image.RGBA
func (*BrightnessOperation) Clone ¶
func (op *BrightnessOperation) Clone() EditOperation
func (*BrightnessOperation) GetParameters ¶
func (op *BrightnessOperation) GetParameters() map[string]interface{}
func (*BrightnessOperation) GetType ¶
func (op *BrightnessOperation) GetType() string
func (*BrightnessOperation) SetParameters ¶
func (op *BrightnessOperation) SetParameters(params map[string]interface{})
type ByteSlicePool ¶
type ByteSlicePool struct {
// contains filtered or unexported fields
}
ByteSlicePool manages pools of byte slices for various operations
func NewByteSlicePool ¶
func NewByteSlicePool() *ByteSlicePool
NewByteSlicePool creates a new byte slice pool
func (*ByteSlicePool) Get ¶
func (p *ByteSlicePool) Get(size int) []byte
Get retrieves a byte slice from the pool
func (*ByteSlicePool) Put ¶
func (p *ByteSlicePool) Put(slice []byte)
Put returns a byte slice to the pool
type CMYK ¶
type CMYK struct {
C, M, Y, K float64 // Cyan, Magenta, Yellow, Key (Black)
}
CMYK represents a color in CMYK color space
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache represents a generic cache with LRU eviction
type CacheConfig ¶
type CacheConfig struct {
ImageCacheSize int64
FontCacheSize int64
PathCacheSize int64
EnableCaching bool
}
CacheConfig holds cache configuration
func DefaultCacheConfig ¶
func DefaultCacheConfig() CacheConfig
DefaultCacheConfig returns the default cache configuration
type CacheEntry ¶
type CacheEntry struct {
Data interface{}
CreatedAt time.Time
AccessAt time.Time
AccessCount int64
Size int64
}
CacheEntry represents a cached item
type CacheStats ¶
CacheStats holds cache performance statistics
type CircleShape ¶
type CircleShape struct {
X, Y, Radius float64
}
CircleShape represents a circle
func (*CircleShape) Clone ¶
func (c *CircleShape) Clone() Shape
type Color ¶
type Color struct {
R, G, B, A float64
}
Color represents a color in various color spaces
func NewColorFromRGBA255 ¶
NewColorFromRGBA255 creates a new Color from RGBA values (0-255 range)
func (Color) ToStandardColor ¶
ToStandardColor converts to Go's standard color.Color interface
type ColorConverter ¶
type ColorConverter struct {
SourceProfile *ICCProfile
DestProfile *ICCProfile
Intent RenderingIntent
}
ColorConverter handles color space conversions using ICC profiles
func NewColorConverter ¶
func NewColorConverter(source, dest *ICCProfile) *ColorConverter
NewColorConverter creates a new color converter
func (*ColorConverter) ConvertColor ¶
func (cc *ColorConverter) ConvertColor(c color.Color) color.Color
ConvertColor converts a color from source to destination profile
type ColorEmojiFont ¶
type ColorEmojiFont struct {
// contains filtered or unexported fields
}
ColorEmojiFont represents a color emoji font with COLR/CPAL support
type ColorSpace ¶
type ColorSpace uint32
ColorSpace represents different color spaces
const ( ColorSpaceXYZ ColorSpace = 0x58595A20 // 'XYZ ' ColorSpaceLab ColorSpace = 0x4C616220 // 'Lab ' ColorSpaceRGB ColorSpace = 0x52474220 // 'RGB ' ColorSpaceCMYK ColorSpace = 0x434D594B // 'CMYK' ColorSpaceGray ColorSpace = 0x47524159 // 'GRAY' )
type ConditionalBatch ¶
type ConditionalBatch struct {
*Batch
// contains filtered or unexported fields
}
ConditionalBatch executes operations only if they're within the viewport
func NewConditionalBatch ¶
func NewConditionalBatch(viewport Rectangle) *ConditionalBatch
NewConditionalBatch creates a batch that only executes operations within the viewport
func (*ConditionalBatch) Execute ¶
func (cb *ConditionalBatch) Execute(ctx *Context)
Execute executes only operations that intersect with the viewport
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func CreateNew ¶
CreateNew creates a new image with specified dimensions and background color Similar to Pillow's Image.new()
func CreateNewGrayscale ¶
CreateNewGrayscale creates a new grayscale image
func CreateNewRGB ¶
CreateNewRGB creates a new image with RGB background (alpha = 255)
func CreateNewRGBA ¶
CreateNewRGBA creates a new image with RGBA background
func CreateNewTransparent ¶
CreateNewTransparent creates a new transparent image
func NewContext ¶
NewContext creates a new image.RGBA with the specified width and height and prepares a context for rendering onto that image.
func NewContextForImage ¶
NewContextForImage copies the specified image into a new image.RGBA and prepares a context for rendering onto that image.
func NewContextForRGBA ¶
NewContextForRGBA prepares a context for rendering onto the specified image. No copy is made.
func PooledContext ¶
PooledContext creates a new context using pooled resources
func (*Context) AddEditOperation ¶
func (dc *Context) AddEditOperation(op EditOperation)
AddEditOperation adds a non-destructive edit operation
func (*Context) AddGuide ¶
func (dc *Context) AddGuide(position float64, orientation GuideOrientation) *Guide
AddGuide adds a guide
func (*Context) ApplyFilter ¶
ApplyFilter applies a filter to the context's current image
func (*Context) ApplyNonDestructiveEdits ¶
func (dc *Context) ApplyNonDestructiveEdits()
ApplyNonDestructiveEdits applies all non-destructive edits to the image
func (*Context) AsMask ¶
AsMask returns an *image.Alpha representing the alpha channel of this context. This can be useful for advanced clipping operations where you first render the mask geometry and then use it as a mask.
func (*Context) BatchCircles ¶
func (dc *Context) BatchCircles(circles []BatchCircle)
BatchCircles draws multiple circles efficiently
func (*Context) BatchImages ¶
func (dc *Context) BatchImages(images []BatchImage)
BatchImages draws multiple images efficiently
func (*Context) BatchLines ¶
BatchLines draws multiple lines efficiently
func (*Context) BatchRectangles ¶
func (dc *Context) BatchRectangles(rectangles []BatchRectangle)
BatchRectangles draws multiple rectangles efficiently
func (*Context) BatchTexts ¶
BatchTexts draws multiple text strings efficiently
func (*Context) BeginBatch ¶
BeginBatch starts a new batch operation
func (*Context) Clear ¶
func (dc *Context) Clear()
Clear fills the entire image with the current color.
func (*Context) ClearPath ¶
func (dc *Context) ClearPath()
ClearPath clears the current path. There is no current point after this operation.
func (*Context) ClearShadow ¶
func (dc *Context) ClearShadow()
ClearShadow removes the shadow effect
func (*Context) Clip ¶
func (dc *Context) Clip()
Clip updates the clipping region by intersecting the current clipping region with the current path as it would be filled by dc.Fill(). The path is cleared after this operation.
func (*Context) ClipPath2D ¶
ClipPath2D sets a Path2D object as the clipping region
func (*Context) ClipPreserve ¶
func (dc *Context) ClipPreserve()
ClipPreserve updates the clipping region by intersecting the current clipping region with the current path as it would be filled by dc.Fill(). The path is preserved after this operation.
func (*Context) ClosePath ¶
func (dc *Context) ClosePath()
ClosePath adds a line segment from the current point to the beginning of the current subpath. If there is no current point, this is a no-op.
func (*Context) CompositeImage ¶
CompositeImage composites two images using the specified blend mode
func (*Context) CompositeToImage ¶
func (dc *Context) CompositeToImage()
CompositeToImage renders all layers to the main image
func (*Context) ConvertToColorSpace ¶
func (dc *Context) ConvertToColorSpace(targetProfile *ICCProfile)
ConvertToColorSpace converts the current image to a different color space
func (*Context) CreateImageData ¶
CreateImageData creates a new ImageData with the specified dimensions
func (*Context) CubicTo ¶
CubicTo adds a cubic bezier curve to the current path starting at the current point. If there is no current point, it first performs MoveTo(x1, y1). Because freetype/raster does not support cubic beziers, this is emulated with many small line segments.
func (*Context) DisableLayers ¶
func (dc *Context) DisableLayers()
DisableLayers disables the layer system
func (*Context) DrawAlignedText ¶
DrawAlignedText draws text with various alignment options
func (*Context) DrawCachedCircle ¶
DrawCachedCircle draws a circle using cache if available
func (*Context) DrawCachedText ¶
DrawCachedText draws text using cache if available
func (*Context) DrawCircle ¶
func (*Context) DrawCircleOnImage ¶
DrawCircleOnImage draws a circle directly on an existing image at specified coordinates This is useful for adding circles to loaded images without creating new contexts
func (*Context) DrawCircleWithBorder ¶
func (dc *Context) DrawCircleWithBorder(x, y, r float64, fillColor, borderColor color.Color, borderWidth float64)
DrawCircleWithBorder draws a circle with fill and border
func (*Context) DrawCircleWithShadow ¶
DrawCircleWithShadow draws a circle with shadow support
func (*Context) DrawDashedLine ¶
DrawDashedLine draws a dashed line
func (*Context) DrawEllipse ¶
func (*Context) DrawEllipseOnImage ¶
DrawEllipseOnImage draws an ellipse directly on the existing image
func (*Context) DrawEllipseWithShadow ¶
DrawEllipseWithShadow draws an ellipse with shadow support
func (*Context) DrawEllipticalArc ¶
func (*Context) DrawFilledCircle ¶
DrawFilledCircle draws a filled circle
func (*Context) DrawGradientLine ¶
func (dc *Context) DrawGradientLine(x1, y1, x2, y2 float64, stops []StrokeGradientStop)
DrawGradientLine draws a line with gradient stroke
func (*Context) DrawImageAnchored ¶
DrawImageAnchored draws the specified image at the specified anchor point. The anchor point is x - w * ax, y - h * ay, where w, h is the size of the image. Use ax=0.5, ay=0.5 to center the image at the specified point.
func (*Context) DrawImageAnchoredWithShadow ¶
DrawImageAnchoredWithShadow draws an anchored image with shadow support
func (*Context) DrawImageWithShadow ¶
DrawImageWithShadow draws an image with shadow support
func (*Context) DrawPath2D ¶
DrawPath2D draws a Path2D object to the context
func (*Context) DrawPieSlice ¶
DrawPieSlice draws a pie slice (sector)
func (*Context) DrawPoint ¶
DrawPoint is like DrawCircle but ensures that a circle of the specified size is drawn regardless of the current transformation matrix. The position is still transformed, but not the shape of the point.
func (*Context) DrawPolygon ¶
DrawPolygon draws a regular polygon with n sides
func (*Context) DrawRectangle ¶
func (*Context) DrawRectangleOnImage ¶
DrawRectangleOnImage draws a rectangle directly on the existing image
func (*Context) DrawRectangleWithShadow ¶
DrawRectangleWithShadow draws a rectangle with shadow support
func (*Context) DrawRegularPolygon ¶
func (*Context) DrawRoundedRectangle ¶
func (*Context) DrawRoundedRectangleOnImage ¶
DrawRoundedRectangleOnImage draws a rounded rectangle on the existing image
func (*Context) DrawRoundedRectangleWithShadow ¶
DrawRoundedRectangleWithShadow draws a rounded rectangle with shadow support
func (*Context) DrawShapedString ¶
DrawShapedString draws shaped text
func (*Context) DrawString ¶
DrawString draws the specified text at the specified point.
func (*Context) DrawStringAnchored ¶
DrawStringAnchored draws the specified text at the specified anchor point. The anchor point is x - w * ax, y - h * ay, where w, h is the size of the text. Use ax=0.5, ay=0.5 to center the text at the specified point.
func (*Context) DrawStringAnchoredWithShadow ¶
DrawStringAnchoredWithShadow draws anchored text with shadow support
func (*Context) DrawStringWithEmoji ¶
DrawStringWithEmoji draws text with emoji support
func (*Context) DrawStringWithShadow ¶
DrawStringWithShadow draws text with shadow support
func (*Context) DrawStringWrapped ¶
func (dc *Context) DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing float64, align Align)
DrawStringWrapped word-wraps the specified string to the given max width and then draws it at the specified anchor point using the given line spacing and text alignment.
func (*Context) DrawStrokedCircle ¶
DrawStrokedCircle draws a circle outline
func (*Context) DrawTaperedLine ¶
DrawTaperedLine draws a line with tapered ends
func (*Context) DrawTextBox ¶
DrawTextBox draws text within a bounding box with automatic word wrapping Similar to Pillow's textbbox functionality
func (*Context) DrawTextBoxAnchored ¶
func (dc *Context) DrawTextBoxAnchored(text string, x, y, ax, ay, width, height float64, align Align)
DrawTextBoxAnchored draws text in a box with anchor positioning
func (*Context) EnableGuides ¶
func (dc *Context) EnableGuides()
EnableGuides enables the guide system
func (*Context) EnableLayers ¶
func (dc *Context) EnableLayers()
EnableLayers enables the layer system
func (*Context) EnableNonDestructiveEditing ¶
func (dc *Context) EnableNonDestructiveEditing()
EnableNonDestructiveEditing enables non-destructive editing
func (*Context) EncodeJPG ¶
EncodeJPG encodes the image as a JPG and writes it to the provided io.Writer in JPEG 4:2:0 baseline format with the given options. Default parameters are used if a nil *jpeg.Options is passed.
func (*Context) EncodePNG ¶
EncodePNG encodes the image as a PNG and writes it to the provided io.Writer.
func (*Context) ExecuteBatch ¶
ExecuteBatch executes a batch of operations
func (*Context) Fill ¶
func (dc *Context) Fill()
Fill fills the current path with the current color. Open subpaths are implicity closed. The path is cleared after this operation.
func (*Context) FillPath2D ¶
FillPath2D fills a Path2D object
func (*Context) FillPreserve ¶
func (dc *Context) FillPreserve()
FillPreserve fills the current path with the current color. Open subpaths are implicity closed. The path is preserved after this operation.
func (*Context) FillWithShadow ¶
func (dc *Context) FillWithShadow()
FillWithShadow fills the current path with shadow support
func (*Context) FontHeight ¶
func (*Context) GetActiveLayer ¶
GetActiveLayer returns the active layer
func (*Context) GetAdvancedStroke ¶
func (dc *Context) GetAdvancedStroke() *StrokeStyle
GetAdvancedStroke returns the current advanced stroke style
func (*Context) GetBaseline ¶
GetBaseline returns the baseline position for the current font
func (*Context) GetColorProfile ¶
func (dc *Context) GetColorProfile() *ICCProfile
GetColorProfile returns the current color profile
func (*Context) GetCurrentPoint ¶
GetCurrentPoint will return the current point and if there is a current point. The point will have been transformed by the context's transformation matrix.
func (*Context) GetEditStack ¶
GetEditStack returns the edit stack
func (*Context) GetEmojiRenderer ¶
func (dc *Context) GetEmojiRenderer() *EmojiRenderer
GetEmojiRenderer returns the current emoji renderer
func (*Context) GetFontMetrics ¶
GetFontMetrics returns metrics for the current font
func (*Context) GetGuideManager ¶
func (dc *Context) GetGuideManager() *GuideManager
GetGuideManager returns the guide manager
func (*Context) GetImageData ¶
GetImageData returns the current image as ImageData for pixel manipulation
func (*Context) GetImageDataRegion ¶
GetImageDataRegion returns a region of the current image as ImageData
func (*Context) GetLayerManager ¶
func (dc *Context) GetLayerManager() *LayerManager
GetLayerManager returns the layer manager
func (*Context) GetLineHeight ¶
GetLineHeight returns the recommended line height for the current font
func (*Context) GetTextBoxSize ¶
GetTextBoxSize calculates the size needed for a text box
func (*Context) GetTextHeight ¶
GetTextHeight returns the height of the current font
func (*Context) GetTextShaper ¶
func (dc *Context) GetTextShaper() *TextShaper
GetTextShaper returns the current text shaper
func (*Context) GetTextWidth ¶
GetTextWidth returns the width of the specified text
func (*Context) Identity ¶
func (dc *Context) Identity()
Identity resets the current transformation matrix to the identity matrix. This results in no translating, scaling, rotating, or shearing.
func (*Context) InvertMask ¶
func (dc *Context) InvertMask()
InvertMask inverts the alpha values in the current clipping mask such that a fully transparent region becomes fully opaque and vice versa.
func (*Context) InvertY ¶
func (dc *Context) InvertY()
InvertY flips the Y axis so that Y grows from bottom to top and Y=0 is at the bottom of the image.
func (*Context) IsPointInPath2D ¶
IsPointInPath2D tests if a point is inside a Path2D object
func (*Context) LineTo ¶
LineTo adds a line segment to the current path starting at the current point. If there is no current point, it is equivalent to MoveTo(x, y)
func (*Context) LoadFontFaceFromBytes ¶
LoadFontFaceFromBytes loads a font from byte data and sets it as the current font face. Supports both TTF and OTF formats.
func (*Context) LoadFontFaceWithOptions ¶
LoadFontFaceWithOptions loads a font with custom truetype options.
func (*Context) LoadOTFFace ¶
LoadOTFFace loads an OTF font file and sets it as the current font face.
func (*Context) LoadTTFFace ¶
LoadTTFFace loads a TTF font file and sets it as the current font face.
func (*Context) MeasureMultilineString ¶
func (*Context) MeasureString ¶
MeasureString returns the rendered width and height of the specified text given the current font face.
func (*Context) MeasureTextMetrics ¶
func (dc *Context) MeasureTextMetrics(s string) TextMetrics
MeasureTextMetrics returns detailed metrics for the specified text
func (*Context) MoveTo ¶
MoveTo starts a new subpath within the current path starting at the specified point.
func (*Context) NewSubPath ¶
func (dc *Context) NewSubPath()
NewSubPath starts a new subpath within the current path. There is no current point after this operation.
func (*Context) PasteImage ¶
PasteImage pastes an image onto the context at the specified position Similar to Pillow's paste() function
func (*Context) PasteImageWithMask ¶
PasteImageWithMask pastes an image with a mask (transparency)
func (*Context) Pop ¶
func (dc *Context) Pop()
Pop restores the last saved context state from the stack.
func (*Context) Push ¶
func (dc *Context) Push()
Push saves the current state of the context for later retrieval. These can be nested.
func (*Context) PutImageData ¶
PutImageData replaces the current image with ImageData
func (*Context) PutImageDataAt ¶
PutImageDataAt places ImageData at the specified coordinates
func (*Context) QuadraticTo ¶
QuadraticTo adds a quadratic bezier curve to the current path starting at the current point. If there is no current point, it first performs MoveTo(x1, y1)
func (*Context) Rotate ¶
Rotate updates the current matrix with a anticlockwise rotation. Rotation occurs about the origin. Angle is specified in radians.
func (*Context) RotateAbout ¶
RotateAbout updates the current matrix with a anticlockwise rotation. Rotation occurs about the specified point. Angle is specified in radians.
func (*Context) Scale ¶
Scale updates the current matrix with a scaling factor. Scaling occurs about the origin.
func (*Context) ScaleAbout ¶
ScaleAbout updates the current matrix with a scaling factor. Scaling occurs about the specified point.
func (*Context) SetActiveLayer ¶
SetActiveLayer sets the active layer
func (*Context) SetActiveLayerByName ¶
SetActiveLayerByName sets the active layer by name
func (*Context) SetAdvancedStroke ¶
func (dc *Context) SetAdvancedStroke(style *StrokeStyle)
SetAdvancedStroke sets an advanced stroke style for the context
func (*Context) SetColorConverter ¶
func (dc *Context) SetColorConverter(converter *ColorConverter)
SetColorConverter sets the color converter for the context
func (*Context) SetColorProfile ¶
func (dc *Context) SetColorProfile(profile *ICCProfile)
SetColorProfile sets the color profile for the context
func (*Context) SetDash ¶
SetDash sets the current dash pattern to use. Call with zero arguments to disable dashes. The values specify the lengths of each dash, with alternating on and off lengths.
func (*Context) SetDashOffset ¶
SetDashOffset sets the initial offset into the dash pattern to use when stroking dashed paths.
func (*Context) SetEmojiRenderer ¶
func (dc *Context) SetEmojiRenderer(renderer *EmojiRenderer)
SetEmojiRenderer sets the emoji renderer for the context
func (*Context) SetFillRule ¶
func (*Context) SetFillRuleEvenOdd ¶
func (dc *Context) SetFillRuleEvenOdd()
func (*Context) SetFillRuleWinding ¶
func (dc *Context) SetFillRuleWinding()
func (*Context) SetFillStyle ¶
SetFillStyle sets current fill style
func (*Context) SetFontFace ¶
func (*Context) SetHexColor ¶
SetHexColor sets the current color using a hex string. The leading pound sign (#) is optional. Both 3- and 6-digit variations are supported. 8 digits may be provided to set the alpha value as well.
func (*Context) SetLineCap ¶
func (*Context) SetLineCapButt ¶
func (dc *Context) SetLineCapButt()
func (*Context) SetLineCapRound ¶
func (dc *Context) SetLineCapRound()
func (*Context) SetLineCapSquare ¶
func (dc *Context) SetLineCapSquare()
func (*Context) SetLineJoin ¶
func (*Context) SetLineJoinBevel ¶
func (dc *Context) SetLineJoinBevel()
func (*Context) SetLineJoinRound ¶
func (dc *Context) SetLineJoinRound()
func (*Context) SetLineWidth ¶
func (*Context) SetMask ¶
SetMask allows you to directly set the *image.Alpha to be used as a clipping mask. It must be the same size as the context, else an error is returned and the mask is unchanged.
func (*Context) SetRGB ¶
SetRGB sets the current color. r, g, b values should be between 0 and 1, inclusive. Alpha will be set to 1 (fully opaque).
func (*Context) SetRGB255 ¶
SetRGB255 sets the current color. r, g, b values should be between 0 and 255, inclusive. Alpha will be set to 255 (fully opaque).
func (*Context) SetRGBA ¶
SetRGBA sets the current color. r, g, b, a values should be between 0 and 1, inclusive.
func (*Context) SetRGBA255 ¶
SetRGBA255 sets the current color. r, g, b, a values should be between 0 and 255, inclusive.
func (*Context) SetShadowRGBA ¶
SetShadowRGBA sets the shadow with RGBA color
func (*Context) SetStrokeStyle ¶
SetStrokeStyle sets current stroke style
func (*Context) SetTextShaper ¶
func (dc *Context) SetTextShaper(shaper *TextShaper)
SetTextShaper sets the text shaper for the context
func (*Context) Shear ¶
Shear updates the current matrix with a shearing angle. Shearing occurs about the origin.
func (*Context) ShearAbout ¶
ShearAbout updates the current matrix with a shearing angle. Shearing occurs about the specified point.
func (*Context) Stroke ¶
func (dc *Context) Stroke()
Stroke strokes the current path with the current color, line width, line cap, line join and dash settings. The path is cleared after this operation.
func (*Context) StrokePath2D ¶
StrokePath2D strokes a Path2D object
func (*Context) StrokePreserve ¶
func (dc *Context) StrokePreserve()
StrokePreserve strokes the current path with the current color, line width, line cap, line join and dash settings. The path is preserved after this operation.
func (*Context) StrokeWithShadow ¶
func (dc *Context) StrokeWithShadow()
StrokeWithShadow strokes the current path with shadow support
func (*Context) TransformPoint ¶
TransformPoint multiplies the specified point by the current matrix, returning a transformed position.
func (*Context) ValidateContext ¶
ValidateContext validates that a context is in a valid state
func (*Context) ValidateFontLoaded ¶
ValidateFontLoaded validates that a font is loaded
type ContextPool ¶
type ContextPool struct {
// contains filtered or unexported fields
}
ContextPool manages a pool of Context objects
func (*ContextPool) Get ¶
func (p *ContextPool) Get() *Context
Get retrieves a context from the pool
type ContrastOperation ¶
type ContrastOperation struct {
Amount float64
}
ContrastOperation adjusts image contrast
func (*ContrastOperation) Clone ¶
func (op *ContrastOperation) Clone() EditOperation
func (*ContrastOperation) GetParameters ¶
func (op *ContrastOperation) GetParameters() map[string]interface{}
func (*ContrastOperation) GetType ¶
func (op *ContrastOperation) GetType() string
func (*ContrastOperation) SetParameters ¶
func (op *ContrastOperation) SetParameters(params map[string]interface{})
type CropOperation ¶
type CropOperation struct {
X, Y, Width, Height int
}
CropOperation crops the image
func (*CropOperation) Clone ¶
func (op *CropOperation) Clone() EditOperation
func (*CropOperation) GetParameters ¶
func (op *CropOperation) GetParameters() map[string]interface{}
func (*CropOperation) GetType ¶
func (op *CropOperation) GetType() string
func (*CropOperation) SetParameters ¶
func (op *CropOperation) SetParameters(params map[string]interface{})
type DebugConfig ¶
type DebugConfig struct {
Mode DebugMode
ShowBounds bool
ShowGrid bool
ShowCoordinates bool
ShowPerformance bool
ShowMemoryUsage bool
LogOperations bool
HighlightSlowOps bool
GridSize int
BoundsColor color.Color
GridColor color.Color
CoordinateColor color.Color
PerformanceOverlay bool
}
DebugConfig holds debug configuration
func DefaultDebugConfig ¶
func DefaultDebugConfig() DebugConfig
DefaultDebugConfig returns the default debug configuration
type DebugContext ¶
type DebugContext struct {
*Context
// contains filtered or unexported fields
}
DebugContext wraps a Context with debug functionality
func NewDebugContext ¶
func NewDebugContext(width, height int) *DebugContext
NewDebugContext creates a new debug context
func (*DebugContext) ClearDebugInfo ¶
func (dc *DebugContext) ClearDebugInfo()
ClearDebugInfo clears all debug information
func (*DebugContext) DebugDrawCircle ¶
func (dc *DebugContext) DebugDrawCircle(x, y, radius float64)
DebugDrawCircle draws a circle with debug information
func (*DebugContext) DebugDrawRectangle ¶
func (dc *DebugContext) DebugDrawRectangle(x, y, width, height float64)
DebugDrawRectangle draws a rectangle with debug information
func (*DebugContext) DebugDrawString ¶
func (dc *DebugContext) DebugDrawString(text string, x, y float64)
DebugDrawString draws text with debug information
func (*DebugContext) DrawDebugGrid ¶
func (dc *DebugContext) DrawDebugGrid()
DrawDebugGrid draws a debug grid overlay
func (*DebugContext) DrawPerformanceOverlay ¶
func (dc *DebugContext) DrawPerformanceOverlay()
DrawPerformanceOverlay draws performance information
func (*DebugContext) GetDebugInfo ¶
func (dc *DebugContext) GetDebugInfo() []DebugInfo
GetDebugInfo returns debug information for all operations
func (*DebugContext) PrintDebugSummary ¶
func (dc *DebugContext) PrintDebugSummary()
PrintDebugSummary prints a summary of debug information
type DebugInfo ¶
type DebugInfo struct {
Operation string
StartTime time.Time
EndTime time.Time
Duration time.Duration
MemoryUsed int64
Parameters map[string]interface{}
BoundingBox Rectangle
}
DebugInfo holds debug information for operations
type DeviceClass ¶
type DeviceClass uint32
DeviceClass represents ICC device class
const ( DeviceClassInput DeviceClass = 0x73636E72 // 'scnr' DeviceClassDisplay DeviceClass = 0x6D6E7472 // 'mntr' DeviceClassOutput DeviceClass = 0x70727472 // 'prtr' DeviceClassLink DeviceClass = 0x6C696E6B // 'link' DeviceClassAbstract DeviceClass = 0x61627374 // 'abst' DeviceClassNamedColor DeviceClass = 0x6E6D636C // 'nmcl' )
type Document ¶
type Document struct {
Root *Element
// contains filtered or unexported fields
}
Document represents a collection of elements
func (*Document) AddElement ¶
AddElement adds an element to the document
func (*Document) ApplyStyles ¶
func (d *Document) ApplyStyles()
ApplyStyles applies CSS-like styles to elements
func (*Document) GetElementByID ¶
GetElementByID gets an element by ID
func (*Document) GetElementsByClass ¶
GetElementsByClass gets elements by class name
type EditOperation ¶
type EditOperation interface {
Apply(img *image.RGBA) *image.RGBA
GetType() string
GetParameters() map[string]interface{}
SetParameters(params map[string]interface{})
Clone() EditOperation
}
EditOperation represents a single editing operation
type EditStack ¶
type EditStack struct {
Operations []EditOperation
BaseImage *image.RGBA
CachedResult *image.RGBA
CacheDirty bool
}
EditStack manages a stack of non-destructive operations
func NewEditStack ¶
NewEditStack creates a new edit stack
func (*EditStack) AddOperation ¶
func (es *EditStack) AddOperation(op EditOperation)
AddOperation adds an operation to the stack
func (*EditStack) GetPreview ¶
GetPreview returns a preview up to the specified operation index
func (*EditStack) InsertOperation ¶
func (es *EditStack) InsertOperation(index int, op EditOperation)
InsertOperation inserts an operation at the specified index
func (*EditStack) MoveOperation ¶
MoveOperation moves an operation from one index to another
func (*EditStack) RemoveOperation ¶
RemoveOperation removes an operation by index
type Element ¶
type Element struct {
ID string
Classes []string
Styles map[string]interface{}
Children []*Element
Parent *Element
Shape Shape
}
Element represents a drawable element with ID and styles
func CreateCircle ¶
CreateCircle creates a circle element
func CreateLine ¶
CreateLine creates a line element
func CreateRect ¶
CreateRect creates a rectangle element
func CreateText ¶
CreateText creates a text element
func (*Element) RemoveChild ¶
RemoveChild removes a child element
func (*Element) RemoveClass ¶
RemoveClass removes a CSS class
type EmojiInfo ¶
type EmojiInfo struct {
Codepoint string
Name string
Category string
Subcategory string
Keywords []string
SkinTones []string
ZWJSequence bool
Modifiable bool
}
EmojiInfo represents information about an emoji
type EmojiRenderer ¶
type EmojiRenderer struct {
ColorFonts []string
FallbackFont string
EmojiSize float64
EnableSVG bool
EnableBitmap bool
Cache map[string]*image.RGBA
// contains filtered or unexported fields
}
EmojiRenderer handles emoji rendering with proper color font support
func NewEmojiRenderer ¶
func NewEmojiRenderer() *EmojiRenderer
NewEmojiRenderer creates a new emoji renderer
func (*EmojiRenderer) GetEmojiCategory ¶
func (er *EmojiRenderer) GetEmojiCategory(r rune) string
GetEmojiCategory gets the category of an emoji
func (*EmojiRenderer) GetEmojiInfo ¶
func (er *EmojiRenderer) GetEmojiInfo(emojiText string) *EmojiInfo
GetEmojiInfo gets information about an emoji
func (*EmojiRenderer) LoadEmojiFont ¶
func (er *EmojiRenderer) LoadEmojiFont(fontPath string) error
LoadEmojiFont loads an emoji font from the specified path
func (*EmojiRenderer) ParseEmojiSequence ¶
func (er *EmojiRenderer) ParseEmojiSequence(text string) []EmojiSequence
ParseEmojiSequence parses an emoji sequence including ZWJ sequences
func (*EmojiRenderer) RenderEmoji ¶
func (er *EmojiRenderer) RenderEmoji(sequence EmojiSequence, size float64) *image.RGBA
RenderEmoji renders an emoji sequence
type EmojiSequence ¶
type EmojiSequence struct {
Runes []rune
Text string
IsZWJ bool
HasModifier bool
SkinTone string
Category string
}
EmojiSequence represents a complete emoji sequence
type ErrorHandler ¶
type ErrorHandler func(error)
ErrorHandler is a function type for handling errors
var DefaultErrorHandler ErrorHandler = func(err error) { if err != nil { fmt.Printf("AdvanceGG Error: %v\n", err) } }
DefaultErrorHandler is the default error handler
type Filter ¶
Filter represents an image filter function
func BatchFilter ¶
BatchFilter applies multiple filters efficiently
func Brightness ¶
Brightness adjusts the brightness of the image
func FastBrightness ¶
FastBrightness is an optimized brightness filter
func FastContrast ¶
FastContrast is an optimized contrast filter
func FastEdgeDetection ¶
func FastEdgeDetection() Filter
FastEdgeDetection is an optimized edge detection filter
func FastSharpen ¶
FastSharpen is an optimized sharpen filter
func ParallelFilter ¶
ParallelFilter applies a filter using parallel processing
type FontCache ¶
type FontCache struct {
*Cache
}
FontCache caches font faces and metrics
func NewFontCache ¶
NewFontCache creates a new font cache
type Guide ¶
type Guide struct {
Type GuideType
Position float64
Orientation GuideOrientation
Visible bool
Color color.Color
}
Guide represents a guide line
type GuideManager ¶
type GuideManager struct {
Guides []*Guide
GridSize float64
GridVisible bool
GridColor color.Color
SnapToGrid bool
SnapToGuides bool
SnapDistance float64
ShowCenterLines bool
ShowBaselines bool
Margins Margins
}
GuideManager manages guides and alignment
func NewGuideManager ¶
func NewGuideManager() *GuideManager
NewGuideManager creates a new guide manager
func (*GuideManager) AddGuide ¶
func (gm *GuideManager) AddGuide(position float64, orientation GuideOrientation) *Guide
AddGuide adds a manual guide
func (*GuideManager) ClearGuides ¶
func (gm *GuideManager) ClearGuides()
ClearGuides removes all manual guides
func (*GuideManager) GenerateCenterGuides ¶
func (gm *GuideManager) GenerateCenterGuides(width, height float64)
GenerateCenterGuides generates center guides for the canvas
func (*GuideManager) GenerateMarginGuides ¶
func (gm *GuideManager) GenerateMarginGuides(width, height float64)
GenerateMarginGuides generates margin guides
func (*GuideManager) GetNearestGuides ¶
func (gm *GuideManager) GetNearestGuides(x, y float64, maxDistance float64) []*Guide
GetNearestGuides returns guides near a point
func (*GuideManager) RemoveGuide ¶
func (gm *GuideManager) RemoveGuide(guide *Guide) bool
RemoveGuide removes a guide
func (*GuideManager) SnapPoint ¶
func (gm *GuideManager) SnapPoint(x, y float64) (float64, float64)
SnapPoint snaps a point to guides or grid
func (*GuideManager) SnapRectangle ¶
func (gm *GuideManager) SnapRectangle(x, y, width, height float64) (float64, float64, float64, float64)
SnapRectangle snaps a rectangle to guides or grid
type GuideOrientation ¶
type GuideOrientation int
GuideOrientation represents guide orientation
const ( GuideHorizontal GuideOrientation = iota GuideVertical )
type HSL ¶
type HSL struct {
H, S, L float64 // Hue (0-360), Saturation (0-1), Lightness (0-1)
}
HSL represents a color in HSL color space
type HSV ¶
type HSV struct {
H, S, V float64 // Hue (0-360), Saturation (0-1), Value (0-1)
}
HSV represents a color in HSV color space
type HitTestCircle ¶
HitTestCircle represents a hit testable circle
func CreateHitTestCircle ¶
func CreateHitTestCircle(id string, x, y, radius float64) *HitTestCircle
CreateHitTestCircle creates a hit testable circle
func (*HitTestCircle) GetBounds ¶
func (c *HitTestCircle) GetBounds() (float64, float64, float64, float64)
GetBounds returns the bounding box
func (*HitTestCircle) HitTest ¶
func (c *HitTestCircle) HitTest(x, y float64) bool
HitTest tests if point is inside circle
type HitTestEllipse ¶
HitTestEllipse represents a hit testable ellipse
func CreateHitTestEllipse ¶
func CreateHitTestEllipse(id string, x, y, radiusX, radiusY float64) *HitTestEllipse
CreateHitTestEllipse creates a hit testable ellipse
func (*HitTestEllipse) GetBounds ¶
func (e *HitTestEllipse) GetBounds() (float64, float64, float64, float64)
GetBounds returns the bounding box
func (*HitTestEllipse) HitTest ¶
func (e *HitTestEllipse) HitTest(x, y float64) bool
HitTest tests if point is inside ellipse
type HitTestLine ¶
HitTestLine represents a hit testable line with thickness
func CreateHitTestLine ¶
func CreateHitTestLine(id string, x1, y1, x2, y2, thickness float64) *HitTestLine
CreateHitTestLine creates a hit testable line
func (*HitTestLine) GetBounds ¶
func (l *HitTestLine) GetBounds() (float64, float64, float64, float64)
GetBounds returns the bounding box
func (*HitTestLine) HitTest ¶
func (l *HitTestLine) HitTest(x, y float64) bool
HitTest tests if point is near the line within thickness
type HitTestManager ¶
type HitTestManager struct {
// contains filtered or unexported fields
}
HitTestManager manages hit testing for multiple objects
func NewHitTestManager ¶
func NewHitTestManager() *HitTestManager
NewHitTestManager creates a new hit test manager
func (*HitTestManager) AddObject ¶
func (htm *HitTestManager) AddObject(obj HitTestable)
AddObject adds an object for hit testing
func (*HitTestManager) HitTest ¶
func (htm *HitTestManager) HitTest(x, y float64) []HitTestable
HitTest performs hit testing at the given point
func (*HitTestManager) HitTestFirst ¶
func (htm *HitTestManager) HitTestFirst(x, y float64) HitTestable
HitTestFirst returns the first object hit at the given point
func (*HitTestManager) HitTestLast ¶
func (htm *HitTestManager) HitTestLast(x, y float64) HitTestable
HitTestLast returns the last (topmost) object hit at the given point
func (*HitTestManager) RemoveObject ¶
func (htm *HitTestManager) RemoveObject(obj HitTestable)
RemoveObject removes an object from hit testing
type HitTestPath ¶
HitTestPath represents a hit testable path
func CreateHitTestPath ¶
func CreateHitTestPath(id string, points []Point, closed bool) *HitTestPath
CreateHitTestPath creates a hit testable path
func (*HitTestPath) GetBounds ¶
func (p *HitTestPath) GetBounds() (float64, float64, float64, float64)
GetBounds returns the bounding box
func (*HitTestPath) HitTest ¶
func (p *HitTestPath) HitTest(x, y float64) bool
HitTest tests if point is inside path (if closed) or near path (if open)
type HitTestPolygon ¶
HitTestPolygon represents a hit testable polygon
func CreateHitTestPolygon ¶
func CreateHitTestPolygon(id string, points []Point) *HitTestPolygon
CreateHitTestPolygon creates a hit testable polygon
func (*HitTestPolygon) GetBounds ¶
func (p *HitTestPolygon) GetBounds() (float64, float64, float64, float64)
GetBounds returns the bounding box
func (*HitTestPolygon) HitTest ¶
func (p *HitTestPolygon) HitTest(x, y float64) bool
HitTest tests if point is inside polygon using ray casting algorithm
type HitTestRect ¶
HitTestRect represents a hit testable rectangle
func CreateHitTestRect ¶
func CreateHitTestRect(id string, x, y, width, height float64) *HitTestRect
CreateHitTestRect creates a hit testable rectangle
func (*HitTestRect) GetBounds ¶
func (r *HitTestRect) GetBounds() (float64, float64, float64, float64)
GetBounds returns the bounding box
func (*HitTestRect) HitTest ¶
func (r *HitTestRect) HitTest(x, y float64) bool
HitTest tests if point is inside rectangle
type HitTestable ¶
type HitTestable interface {
HitTest(x, y float64) bool
GetBounds() (float64, float64, float64, float64)
}
HitTestable interface for objects that can be hit tested
type ICCHeader ¶
type ICCHeader struct {
ProfileSize uint32
PreferredCMM [4]byte
ProfileVersion uint32
DeviceClass DeviceClass
DataColorSpace ColorSpace
PCS ColorSpace
CreationDateTime [12]byte
PlatformSignature [4]byte
ProfileFlags uint32
DeviceManufacturer [4]byte
DeviceModel [4]byte
DeviceAttributes uint64
RenderingIntent RenderingIntent
PCSIlluminant XYZColor
ProfileCreator [4]byte
Reserved [44]byte
}
ICCHeader represents the ICC profile header
type ICCProfile ¶
type ICCProfile struct {
Header ICCHeader
TagTable []ICCTag
Data []byte
ColorSpace ColorSpace
PCS ColorSpace // Profile Connection Space
Intent RenderingIntent
WhitePoint XYZColor
BlackPoint XYZColor
RedColorant XYZColor
GreenColorant XYZColor
BlueColorant XYZColor
Curves []ToneCurve
}
ICCProfile represents an ICC color profile
func CreateAdobeRGBProfile ¶
func CreateAdobeRGBProfile() *ICCProfile
CreateAdobeRGBProfile creates an Adobe RGB ICC profile
func CreateSRGBProfile ¶
func CreateSRGBProfile() *ICCProfile
CreateSRGBProfile creates a standard sRGB ICC profile
func LoadICCProfile ¶
func LoadICCProfile(data []byte) (*ICCProfile, error)
LoadICCProfile loads an ICC profile from data
type ImageCache ¶
type ImageCache struct {
*Cache
}
ImageCache caches rendered images
func NewImageCache ¶
func NewImageCache(maxSize int64, maxItems int) *ImageCache
NewImageCache creates a new image cache
type ImageData ¶
type ImageData struct {
Data []uint8 // RGBA data: [R, G, B, A, R, G, B, A, ...]
Width int
Height int
}
ImageData represents pixel data that can be manipulated directly
func NewImageData ¶
NewImageData creates a new ImageData with the specified dimensions
func NewImageDataFromImage ¶
NewImageDataFromImage creates ImageData from an existing image
func (*ImageData) ApplyKernel ¶
ApplyKernel applies a convolution kernel to the ImageData
func (*ImageData) FlipHorizontal ¶
FlipHorizontal flips the ImageData horizontally
func (*ImageData) FlipVertical ¶
FlipVertical flips the ImageData vertically
func (*ImageData) GetPixelColor ¶
GetPixelColor returns the color at the specified coordinates
func (*ImageData) GetSubImageData ¶
GetSubImageData extracts a rectangular region as new ImageData
func (*ImageData) Resize ¶
Resize creates a new ImageData with different dimensions using nearest neighbor
func (*ImageData) SetPixelColor ¶
SetPixelColor sets the color at the specified coordinates
type ImagePool ¶
type ImagePool struct {
// contains filtered or unexported fields
}
ImagePool manages a pool of RGBA images to reduce allocations
type LAB ¶
type LAB struct {
L, A, B float64 // Lightness, A (green-red), B (blue-yellow)
}
LAB represents a color in LAB color space
type Layer ¶
type Layer struct {
Name string
Image *image.RGBA
Opacity float64
BlendMode BlendMode
Visible bool
Locked bool
Mask *image.Alpha
Transform Matrix
ID string
}
Layer represents a single drawing layer
func (*Layer) SetBlendMode ¶
SetBlendMode sets the layer blend mode
func (*Layer) SetOpacity ¶
SetOpacity sets the layer opacity
func (*Layer) SetVisible ¶
SetVisible sets layer visibility
type LayerManager ¶
type LayerManager struct {
Layers []*Layer
ActiveLayer int
Width int
Height int
Background color.Color
}
LayerManager manages multiple layers
func NewLayerManager ¶
func NewLayerManager(width, height int) *LayerManager
NewLayerManager creates a new layer manager
func (*LayerManager) AddLayer ¶
func (lm *LayerManager) AddLayer(name string) *Layer
AddLayer adds a new layer
func (*LayerManager) Composite ¶
func (lm *LayerManager) Composite() *image.RGBA
Composite renders all layers into a single image
func (*LayerManager) DuplicateLayer ¶
func (lm *LayerManager) DuplicateLayer(index int) *Layer
DuplicateLayer duplicates a layer
func (*LayerManager) GetActiveLayer ¶
func (lm *LayerManager) GetActiveLayer() *Layer
GetActiveLayer returns the currently active layer
func (*LayerManager) InsertLayer ¶
func (lm *LayerManager) InsertLayer(index int, name string) *Layer
InsertLayer inserts a layer at the specified index
func (*LayerManager) MoveLayer ¶
func (lm *LayerManager) MoveLayer(from, to int) bool
MoveLayer moves a layer from one index to another
func (*LayerManager) RemoveLayer ¶
func (lm *LayerManager) RemoveLayer(index int) bool
RemoveLayer removes a layer by index
func (*LayerManager) SetActiveLayer ¶
func (lm *LayerManager) SetActiveLayer(index int) bool
SetActiveLayer sets the active layer by index
func (*LayerManager) SetActiveLayerByName ¶
func (lm *LayerManager) SetActiveLayerByName(name string) bool
SetActiveLayerByName sets the active layer by name
type Margins ¶
type Margins struct {
Top, Right, Bottom, Left float64
}
Margins represents canvas margins
type Matrix ¶
type Matrix struct {
XX, YX, XY, YY, X0, Y0 float64
}
func SIMDMatrixMultiply ¶
SIMDMatrixMultiply performs optimized matrix multiplication
func (Matrix) TransformPoint ¶
func (Matrix) TransformVector ¶
type MemoryStats ¶
type MemoryStats struct {
ImagePoolSize int
ByteSlicePoolSize int
ContextPoolSize int
PathPoolSize int
}
MemoryStats provides memory usage statistics
func GetMemoryStats ¶
func GetMemoryStats() MemoryStats
GetMemoryStats returns current memory pool statistics
type OptimizedContext ¶
type OptimizedContext struct {
*Context
// contains filtered or unexported fields
}
OptimizedContext provides an optimized rendering context
func NewOptimizedContext ¶
func NewOptimizedContext(width, height int) *OptimizedContext
NewOptimizedContext creates a new optimized context
func (*OptimizedContext) AddDirtyRegion ¶
func (oc *OptimizedContext) AddDirtyRegion(bounds Bounds)
AddDirtyRegion marks a region as needing redraw
func (*OptimizedContext) ClearDirtyRegions ¶
func (oc *OptimizedContext) ClearDirtyRegions()
ClearDirtyRegions clears all dirty regions
func (*OptimizedContext) DrawOptimizedRectangle ¶
func (oc *OptimizedContext) DrawOptimizedRectangle(id string, x, y, width, height float64, fillColor color.Color)
DrawOptimizedRectangle draws a rectangle with caching
func (*OptimizedContext) GetDirtyRegions ¶
func (oc *OptimizedContext) GetDirtyRegions() []Bounds
GetDirtyRegions returns the current dirty regions
func (*OptimizedContext) GetPerformanceMonitor ¶
func (oc *OptimizedContext) GetPerformanceMonitor() *PerformanceMonitor
GetPerformanceMonitor returns the performance monitor
func (*OptimizedContext) GetRenderCache ¶
func (oc *OptimizedContext) GetRenderCache() *RenderCache
GetRenderCache returns the render cache
func (*OptimizedContext) GetSpatialIndex ¶
func (oc *OptimizedContext) GetSpatialIndex() *SpatialIndex
GetSpatialIndex returns the spatial index
func (*OptimizedContext) IsVisible ¶
func (oc *OptimizedContext) IsVisible(bounds Bounds) bool
Frustum culling for efficient rendering
type ParallelRenderer ¶
type ParallelRenderer struct {
// contains filtered or unexported fields
}
ParallelRenderer provides parallel rendering capabilities
func NewParallelRenderer ¶
func NewParallelRenderer(workers int) *ParallelRenderer
NewParallelRenderer creates a new parallel renderer
func (*ParallelRenderer) GetResult ¶
func (pr *ParallelRenderer) GetResult() RenderResult
GetResult gets a rendering result
func (*ParallelRenderer) Start ¶
func (pr *ParallelRenderer) Start()
Start starts the parallel renderer workers
func (*ParallelRenderer) Submit ¶
func (pr *ParallelRenderer) Submit(job RenderJob)
Submit submits a rendering job
type Path2D ¶
type Path2D struct {
// contains filtered or unexported fields
}
Path2D represents a 2D path that can be reused and manipulated
func NewPath2DFromPath ¶
NewPath2DFromPath creates a new Path2D from an existing Path2D
func PooledPath2D ¶
func PooledPath2D() *Path2D
PooledPath2D creates a new Path2D using pooled resources
func (*Path2D) BezierCurveTo ¶
BezierCurveTo draws a cubic Bézier curve
func (*Path2D) ClosePath ¶
func (p *Path2D) ClosePath()
ClosePath closes the current path by drawing a line to the start point
func (*Path2D) Ellipse ¶
func (p *Path2D) Ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle float64, counterclockwise bool)
Ellipse adds an ellipse to the path
func (*Path2D) GetCurrentPoint ¶
GetCurrentPoint returns the current point of the path
func (*Path2D) QuadraticCurveTo ¶
QuadraticCurveTo draws a quadratic Bézier curve
type PathCache ¶
type PathCache struct {
*Cache
}
PathCache caches rendered paths
func NewPathCache ¶
NewPathCache creates a new path cache
type PathPool ¶
type PathPool struct {
// contains filtered or unexported fields
}
PathPool manages a pool of Path2D objects
type PathShape ¶
type PathShape struct {
Points []Point
}
PathShape represents a complex path (simplified)
type Pattern ¶
func NewSolidPattern ¶
type PerformanceMonitor ¶
type PerformanceMonitor struct {
// contains filtered or unexported fields
}
PerformanceMonitor tracks rendering performance
func NewPerformanceMonitor ¶
func NewPerformanceMonitor() *PerformanceMonitor
NewPerformanceMonitor creates a new performance monitor
func (*PerformanceMonitor) GetFPS ¶
func (pm *PerformanceMonitor) GetFPS() float64
GetFPS returns the current FPS
func (*PerformanceMonitor) GetFrameCount ¶
func (pm *PerformanceMonitor) GetFrameCount() int
GetFrameCount returns the total frame count
func (*PerformanceMonitor) Reset ¶
func (pm *PerformanceMonitor) Reset()
Reset resets the performance monitor
func (*PerformanceMonitor) StartFrame ¶
func (pm *PerformanceMonitor) StartFrame()
StartFrame marks the start of a frame
type Point ¶
type Point struct {
X, Y float64
}
func AnimatePoint ¶
func AnimatePoint(start, end Point, t float64, easing EasingFunc) Point
AnimatePoint animates between two points
func CubicBezier ¶
func QuadraticBezier ¶
type PoolConfig ¶
PoolConfig holds configuration for memory pools
func DefaultPoolConfig ¶
func DefaultPoolConfig() PoolConfig
DefaultPoolConfig returns the default pool configuration
type RectShape ¶
type RectShape struct {
X, Y, Width, Height float64
}
RectShape represents a rectangle
type Rectangle ¶
type Rectangle struct {
X, Y, Width, Height float64
}
Rectangle represents a bounding rectangle
type RenderCache ¶
type RenderCache struct {
// contains filtered or unexported fields
}
RenderCache provides caching for rendered elements
func NewRenderCache ¶
func NewRenderCache(maxSize int) *RenderCache
NewRenderCache creates a new render cache
type RenderResult ¶
RenderResult represents a rendering result
type RenderingIntent ¶
type RenderingIntent uint32
RenderingIntent represents ICC rendering intent
const ( IntentPerceptual RenderingIntent = 0 IntentRelativeColorimetric RenderingIntent = 1 IntentSaturation RenderingIntent = 2 IntentAbsoluteColorimetric RenderingIntent = 3 )
type ResizeAlgorithm ¶
type ResizeAlgorithm int
ResizeAlgorithm specifies the interpolation algorithm to use when resizing images.
const ( // ResizeNearestNeighbor uses nearest-neighbor sampling (fastest, lower quality) ResizeNearestNeighbor ResizeAlgorithm = iota // ResizeBilinear uses bilinear interpolation (good balance of quality/speed) ResizeBilinear // ResizeBicubic uses bicubic interpolation (higher quality, slower) ResizeBicubic // ResizeLanczos uses Lanczos resampling (highest quality, slowest) ResizeLanczos )
type SIMDConfig ¶
SIMDConfig holds SIMD optimization settings
func DefaultSIMDConfig ¶
func DefaultSIMDConfig() SIMDConfig
DefaultSIMDConfig returns the default SIMD configuration
type ScriptType ¶
type ScriptType int
ScriptType represents different script types
const ( ScriptLatin ScriptType = iota ScriptArabic ScriptHebrew ScriptDevanagari ScriptThai ScriptChinese ScriptJapanese ScriptKorean ScriptCyrillic ScriptGreek )
type Shape ¶
type Shape interface {
Draw(ctx *Context)
GetBounds() (float64, float64, float64, float64)
Clone() Shape
}
Shape interface for different drawable shapes
type ShapedGlyph ¶
type ShapedGlyph struct {
GlyphID uint32
X, Y float64
AdvanceX float64
AdvanceY float64
Cluster int
Character rune
}
ShapedGlyph represents a positioned glyph
type ShapedText ¶
type ShapedText struct {
Glyphs []ShapedGlyph
Direction TextDirection
Width float64
Height float64
}
ShapedText represents shaped text with positioning
type SpatialIndex ¶
type SpatialIndex struct {
// contains filtered or unexported fields
}
SpatialIndex provides spatial indexing for fast object lookup
func NewSpatialIndex ¶
func NewSpatialIndex(bounds Bounds, maxDepth, maxItems int) *SpatialIndex
NewSpatialIndex creates a new spatial index
func (*SpatialIndex) Insert ¶
func (si *SpatialIndex) Insert(obj SpatialObject)
Insert adds an object to the spatial index
func (*SpatialIndex) Query ¶
func (si *SpatialIndex) Query(bounds Bounds) []SpatialObject
Query returns objects that intersect with the given bounds
type SpatialObject ¶
SpatialObject represents an object that can be spatially indexed
type StrokeGradient ¶
type StrokeGradient struct {
Type StrokeGradientType
Colors []StrokeGradientStop
StartX float64
StartY float64
EndX float64
EndY float64
CenterX float64 // For radial gradients
CenterY float64
Radius float64
}
StrokeGradient represents gradient stroke coloring
type StrokeGradientStop ¶
StrokeGradientStop represents a color stop in a gradient
type StrokeGradientType ¶
type StrokeGradientType int
StrokeGradientType represents gradient types
const ( StrokeGradientLinear StrokeGradientType = iota StrokeGradientRadial StrokeGradientConic )
type StrokeLineCap ¶
type StrokeLineCap int
StrokeLineCap represents line cap styles
const ( StrokeLineCapButt StrokeLineCap = iota // Square end StrokeLineCapRound // Rounded end StrokeLineCapSquare // Extended square end )
type StrokeLineJoin ¶
type StrokeLineJoin int
StrokeLineJoin represents line join styles
const ( StrokeLineJoinMiter StrokeLineJoin = iota // Sharp corner StrokeLineJoinRound // Rounded corner StrokeLineJoinBevel // Beveled corner )
type StrokeStyle ¶
type StrokeStyle struct {
Width float64
Color color.Color
DashPattern []float64
DashOffset float64
LineCap StrokeLineCap
LineJoin StrokeLineJoin
MiterLimit float64
Gradient *StrokeGradient
Taper *StrokeTaper
}
StrokeStyle represents advanced stroke styling options
func CreateDashedStroke ¶
func CreateDashedStroke(width float64, color color.Color, pattern []float64) *StrokeStyle
CreateDashedStroke creates a dashed stroke style
func CreateGradientStroke ¶
func CreateGradientStroke(width float64, startX, startY, endX, endY float64, stops []StrokeGradientStop) *StrokeStyle
CreateGradientStroke creates a gradient stroke style
func CreateTaperedStroke ¶
func CreateTaperedStroke(width float64, color color.Color, startWidth, endWidth float64) *StrokeStyle
CreateTaperedStroke creates a tapered stroke style
func NewStrokeStyle ¶
func NewStrokeStyle() *StrokeStyle
NewStrokeStyle creates a new stroke style with defaults
func (*StrokeStyle) SetDashPattern ¶
func (ss *StrokeStyle) SetDashPattern(pattern []float64, offset float64)
SetDashPattern sets a dash pattern for the stroke
func (*StrokeStyle) SetLinearGradient ¶
func (ss *StrokeStyle) SetLinearGradient(startX, startY, endX, endY float64, stops []StrokeGradientStop)
SetLinearGradient sets a linear gradient for the stroke
func (*StrokeStyle) SetRadialGradient ¶
func (ss *StrokeStyle) SetRadialGradient(centerX, centerY, radius float64, stops []StrokeGradientStop)
SetRadialGradient sets a radial gradient for the stroke
func (*StrokeStyle) SetTaper ¶
func (ss *StrokeStyle) SetTaper(startWidth, endWidth float64, taperType StrokeTaperType)
SetTaper sets stroke tapering
type StrokeTaper ¶
type StrokeTaper struct {
StartWidth float64 // Width at start (0.0 to 1.0 multiplier)
EndWidth float64 // Width at end (0.0 to 1.0 multiplier)
Type StrokeTaperType
}
StrokeTaper represents tapered stroke ends
type StrokeTaperType ¶
type StrokeTaperType int
StrokeTaperType represents taper styles
const ( StrokeTaperLinear StrokeTaperType = iota // Linear taper StrokeTaperExponential // Exponential taper StrokeTaperSinusoidal // Smooth sinusoidal taper )
type Style ¶
type Style struct {
Fill color.Color
Stroke color.Color
StrokeWidth float64
Opacity float64
Transform Matrix
Visible bool
}
Style represents CSS-like styling
type TextDirection ¶
type TextDirection int
TextDirection represents text direction
const ( TextDirectionLTR TextDirection = iota // Left-to-Right TextDirectionRTL // Right-to-Left TextDirectionTTB // Top-to-Bottom TextDirectionBTT // Bottom-to-Top )
type TextMetrics ¶
type TextMetrics struct {
Width float64 // Total width of the text
Height float64 // Total height of the text
ActualBoundingBoxLeft float64 // Distance from text baseline to left edge of bounding box
ActualBoundingBoxRight float64 // Distance from text baseline to right edge of bounding box
ActualBoundingBoxAscent float64 // Distance from text baseline to top of bounding box
ActualBoundingBoxDescent float64 // Distance from text baseline to bottom of bounding box
FontBoundingBoxAscent float64 // Distance from baseline to top of font bounding box
FontBoundingBoxDescent float64 // Distance from baseline to bottom of font bounding box
EmHeightAscent float64 // Distance from baseline to top of em square
EmHeightDescent float64 // Distance from baseline to bottom of em square
HangingBaseline float64 // Distance from alphabetic baseline to hanging baseline
AlphabeticBaseline float64 // Distance from alphabetic baseline to alphabetic baseline (0)
IdeographicBaseline float64 // Distance from alphabetic baseline to ideographic baseline
}
TextMetrics represents detailed text measurement information
type TextShaper ¶
type TextShaper struct {
Direction TextDirection
Script ScriptType
Language string
EnableLigatures bool
EnableKerning bool
// contains filtered or unexported fields
}
TextShaper handles complex text shaping using HarfBuzz
func (*TextShaper) SetFont ¶
func (ts *TextShaper) SetFont(fontFace fonts.Face) error
SetFont sets the font for shaping
func (*TextShaper) ShapeText ¶
func (ts *TextShaper) ShapeText(text string) *ShapedText
ShapeText shapes text according to Unicode rules using proper BiDi and HarfBuzz