Documentation
¶
Index ¶
- Variables
- type Buffer
- func (b *Buffer) Blit(src *Buffer, x, y int)
- func (b *Buffer) BlitOpaque(src *Buffer, x, y int)
- func (b *Buffer) BlitOpaqueRect(src *Buffer, srcRect Rect, x, y int)
- func (b *Buffer) BlitRect(src *Buffer, srcRect Rect, x, y int)
- func (b *Buffer) BlitScaled(src *Buffer, srcRect, dstRect Rect)
- func (b *Buffer) Clear(c Color)
- func (b *Buffer) ClearClip()
- func (b *Buffer) Clip() (Rect, bool)
- func (b *Buffer) DrawLine(x0, y0, x1, y1 int, c Color)
- func (b *Buffer) DrawRect(r Rect, c Color)
- func (b *Buffer) DrawRoundedRect(r Rect, radius int, c Color)
- func (b *Buffer) FillRect(r Rect, c Color)
- func (b *Buffer) FillRoundedRect(r Rect, radius int, c Color)
- func (b *Buffer) GetPixel(x, y int) Color
- func (b *Buffer) Resize(width, height int)
- func (b *Buffer) SetClip(r Rect)
- func (b *Buffer) SetPixel(x, y int, c Color)
- func (b *Buffer) SubBuffer(r Rect) *Buffer
- type Color
- type PixelFormat
- type Point
- type Rect
- func (r Rect) Center() Point
- func (r Rect) Contains(p Point) bool
- func (r Rect) ContainsXY(x, y int) bool
- func (r Rect) Inset(top, right, bottom, left int) Rect
- func (r Rect) InsetAll(amount int) Rect
- func (r Rect) Intersection(other Rect) Rect
- func (r Rect) Intersects(other Rect) bool
- func (r Rect) IsEmpty() bool
- func (r Rect) Position() Point
- func (r Rect) Size() Point
- func (r Rect) Union(other Rect) Rect
Constants ¶
This section is empty.
Variables ¶
var ( ColorBlack = Color{0, 0, 0, 255} ColorWhite = Color{255, 255, 255, 255} ColorRed = Color{255, 0, 0, 255} ColorGreen = Color{0, 255, 0, 255} ColorBlue = Color{0, 0, 255, 255} ColorGray = Color{128, 128, 128, 255} ColorLightGray = Color{200, 200, 200, 255} ColorDarkGray = Color{64, 64, 64, 255} ColorTransparent = Color{0, 0, 0, 0} )
Common colors
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
Width int
Height int
Stride int
Format PixelFormat
Data []byte
// contains filtered or unexported fields
}
Buffer represents a pixel buffer for drawing.
func (*Buffer) BlitOpaque ¶
BlitOpaque copies a source buffer onto this buffer, treating all pixels as fully opaque.
func (*Buffer) BlitOpaqueRect ¶
BlitOpaqueRect copies a region of a source buffer onto this buffer, treating all source pixels as fully opaque.
func (*Buffer) BlitScaled ¶
BlitScaled copies a rectangular region of a source buffer onto this buffer, scaling to fit the destination rectangle using bilinear sampling.
func (*Buffer) DrawRoundedRect ¶
DrawRoundedRect draws a rounded rectangle outline.
func (*Buffer) FillRoundedRect ¶
FillRoundedRect fills a rectangle with rounded corners.
func (*Buffer) SetClip ¶
SetClip restricts subsequent drawing operations to the given rectangle. The clip is intersected with the buffer bounds.
type Color ¶
type Color struct {
R, G, B, A uint8
}
Color represents an RGBA color.
func NewColorHex ¶
NewColorHex creates a color from a hex value (0xRRGGBB or 0xRRGGBBAA).
func NewColorRGB ¶
NewColorRGB creates a new opaque color from RGB values.
type PixelFormat ¶
type PixelFormat int
PixelFormat represents the pixel format of a buffer.
const ( PixelFormatBGRA PixelFormat = iota PixelFormatRGBA PixelFormatRGB565 )
type Rect ¶
Rect represents a rectangle with position and size.
func (Rect) ContainsXY ¶
ContainsXY returns true if the coordinates are inside the rectangle.
func (Rect) Intersection ¶
Intersection returns the intersection of two rectangles.
func (Rect) Intersects ¶
Intersects returns true if this rectangle intersects with another.