graphics

package
v0.0.0-...-f02ac08 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BGRAModel = color.ModelFunc(bgraModel)

Functions

This section is empty.

Types

type BGRA

type BGRA struct {
	B, G, R, A uint8
}

func (BGRA) RGBA

func (c BGRA) RGBA() (r, g, b, a uint32)

type Bitmap

type Bitmap struct {
	X      int
	Y      int
	Width  int
	Height int
	Stride int
	Format PixelFormat
	Pixels []byte
}

func CopyToBitmap

func CopyToBitmap(src image.Image, dstFormat PixelFormat, buf []byte) (dst Bitmap)

func MakeBitmap

func MakeBitmap(x, y, width, height int, format PixelFormat, buf []byte) Bitmap

func ToBitmap

func ToBitmap(src image.Image, dstFormat PixelFormat) (dst Bitmap, ok bool)

func (Bitmap) At

func (img Bitmap) At(x, y int) color.Color

func (Bitmap) Bounds

func (img Bitmap) Bounds() image.Rectangle

func (Bitmap) ColorModel

func (img Bitmap) ColorModel() color.Model

func (Bitmap) GetPixel

func (img Bitmap) GetPixel(x, y int) (r, g, b, a byte)

func (Bitmap) PixOffset

func (img Bitmap) PixOffset(x, y int) int

func (Bitmap) Set

func (img Bitmap) Set(x, y int, c color.Color)

func (Bitmap) SetPixel

func (img Bitmap) SetPixel(x, y int, r, g, b, a byte)

func (Bitmap) SubImage

func (img Bitmap) SubImage(r image.Rectangle) image.Image

type Brush

type Brush interface {
	// contains filtered or unexported methods
}

type Color

type Color struct {
	R, G, B, A float32
}

func ColorOf

func ColorOf(c color.Color) Color

func RGB

func RGB(r, g, b byte) Color

func RGBA

func RGBA(r, g, b, a byte) Color

func (Color) RGBA

func (c Color) RGBA() (r, g, b, a uint32)

func (Color) RGBA8

func (c Color) RGBA8() (r, g, b, a uint8)

type Painter

type Painter interface {
	Name() string
	Destroy()
	Begin(width, height, scale float32)
	End()
	SetClipRect(rect Rectangle)
	SetTransform(transform geometry.Transform)
	Clear(color Color)
	FillRect(rect Rectangle, brush Brush)
	FillRoundRect(rect Rectangle, radius float32, brush Brush)
	FillEllipse(center Point, xRadius, yRadius float32, brush Brush)
	FillPath(path Path, brush Brush)
	DrawLine(p0, p1 Point, strokeWidth float32, brush Brush)
	DrawRect(rect Rectangle, strokeWidth float32, brush Brush)
	DrawRoundRect(rect Rectangle, radius, strokeWidth float32, brush Brush)
	DrawEllipse(center Point, xRadius, yRadius, strokeWidth float32, brush Brush)
	DrawPath(path Path, strokeWidth float32, brush Brush)
	DrawTextLayout(origin Point, layout typography.TextLayout)
	DrawImage(rect Rectangle, img image.Image)
}

Painter is thread-affine and not safe for concurrent use.

type Path

type Path struct {
	// contains filtered or unexported fields
}

func MoveTo

func MoveTo(x, y float32) (p Path)

func (Path) ArcTo

func (p Path) ArcTo(rx, ry, xRotate, large, sweep, x, y float32) Path

func (Path) BezierTo

func (p Path) BezierTo(c1x, c1y, c2x, c2y, x, y float32) Path

func (Path) Close

func (p Path) Close() Path

func (Path) CurrentPos

func (p Path) CurrentPos() (x, y float32)

func (Path) LineTo

func (p Path) LineTo(x, y float32) Path

func (Path) QuadBezierTo

func (p Path) QuadBezierTo(cx, cy, x, y float32) Path

func (Path) Range

func (p Path) Range(f func(op PathOperation, args []float32) (stop bool))

type PathOperation

type PathOperation float32
const (
	PathMoveTo   PathOperation = iota // (x, y)
	PathLineTo                        // (x, y)
	PathArcTo                         // (rx, ry, xRotate, large, sweep, x, y)
	PathBezierTo                      // (c1x, c1y, c2x, c2y, x, y)
	PathClose                         // (0, 0)
)

func (PathOperation) String

func (op PathOperation) String() string

type PixelFormat

type PixelFormat int
const (
	PixelFormatUnknown PixelFormat = iota
	PixelFormatRGBA
	PixelFormatBGRA
	PixelFormatGray
)

func (PixelFormat) BitsPerPixel

func (f PixelFormat) BitsPerPixel() (bits int)

func (PixelFormat) BytesPerPixel

func (f PixelFormat) BytesPerPixel() (bytes int)

type Point

type Point = geometry.Point

type Pos

type Pos = geometry.Pos

type Rectangle

type Rectangle = geometry.Rectangle

func Rect

func Rect(x, y, w, h float32) Rectangle

type Size

type Size = geometry.Size

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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