Documentation
¶
Index ¶
- Variables
- func BGRA32(c color.Color) uint32
- func Blend(fg, bg color.NRGBA) color.NRGBA
- func NewColor(r, g, b, a uint8) color.NRGBA
- func NewColorHex(hex uint32) color.NRGBA
- func NewColorRGB(r, g, b uint8) color.NRGBA
- func RGB565(c color.Color) uint16
- func RGBA32(c color.Color) uint32
- func RectCenter(r image.Rectangle) image.Point
- func RectContainsPoint(r image.Rectangle, p image.Point) bool
- func RectContainsXY(r image.Rectangle, x, y int) bool
- func RectInsetAll(r image.Rectangle, amount int) image.Rectangle
- func RectInsetLTRB(r image.Rectangle, top, right, bottom, left int) image.Rectangle
- func RectIntersects(a, b image.Rectangle) bool
- func RectXYWH(x, y, w, h int) image.Rectangle
- func ToNRGBA(c color.Color) color.NRGBA
- type Buffer
- func (b *Buffer) At(x, y int) color.Color
- 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 image.Rectangle, x, y int)
- func (b *Buffer) BlitRect(src *Buffer, srcRect image.Rectangle, x, y int)
- func (b *Buffer) BlitScaled(src *Buffer, srcRect, dstRect image.Rectangle)
- func (b *Buffer) Bounds() image.Rectangle
- func (b *Buffer) Buffer() *Buffer
- func (b *Buffer) Clear(c color.Color)
- func (b *Buffer) ClearClip()
- func (b *Buffer) Clip() (image.Rectangle, bool)
- func (b *Buffer) ColorModel() color.Model
- func (b *Buffer) DrawBuffer(src *Buffer, dst image.Rectangle)
- func (b *Buffer) DrawImage(src image.Image, dst image.Rectangle)
- func (b *Buffer) DrawLine(x0, y0, x1, y1 int, c color.Color)
- func (b *Buffer) DrawRect(r image.Rectangle, c color.Color)
- func (b *Buffer) DrawRoundedRect(r image.Rectangle, radius int, c color.Color)
- func (b *Buffer) FillRect(r image.Rectangle, c color.Color)
- func (b *Buffer) FillRoundedRect(r image.Rectangle, radius int, c color.Color)
- func (b *Buffer) GetPixel(x, y int) color.NRGBA
- func (b *Buffer) Image() draw.Image
- func (b *Buffer) Resize(width, height int)
- func (b *Buffer) Set(x, y int, c color.Color)
- func (b *Buffer) SetClip(r image.Rectangle)
- func (b *Buffer) SetPixel(x, y int, c color.Color)
- func (b *Buffer) Size() (width, height int)
- func (b *Buffer) SubBuffer(r image.Rectangle) *Buffer
- type PixelFormat
Constants ¶
This section is empty.
Variables ¶
var ( ColorBlack = color.NRGBA{R: 0, G: 0, B: 0, A: 255} ColorWhite = color.NRGBA{R: 255, G: 255, B: 255, A: 255} ColorRed = color.NRGBA{R: 255, G: 0, B: 0, A: 255} ColorGreen = color.NRGBA{R: 0, G: 255, B: 0, A: 255} ColorBlue = color.NRGBA{R: 0, G: 0, B: 255, A: 255} ColorGray = color.NRGBA{R: 128, G: 128, B: 128, A: 255} ColorLightGray = color.NRGBA{R: 200, G: 200, B: 200, A: 255} ColorDarkGray = color.NRGBA{R: 64, G: 64, B: 64, A: 255} ColorTransparent = color.NRGBA{} )
Functions ¶
func NewColorHex ¶
func NewColorRGB ¶
func RectInsetLTRB ¶
func RectIntersects ¶
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. It implements draw.Image with Bounds/At/Set methods.
func BufferFromImage ¶
BufferFromImage copies any image.Image into a buffer.
func (*Buffer) BlitOpaque ¶
BlitOpaque copies src onto b and forces source alpha to 255.
func (*Buffer) BlitOpaqueRect ¶
BlitOpaqueRect copies srcRect from src onto b at x,y and forces alpha to 255.
func (*Buffer) BlitScaled ¶
BlitScaled copies srcRect from src to dstRect on b using bilinear sampling.
func (*Buffer) ColorModel ¶
ColorModel returns NRGBA model for image/draw interoperability.
func (*Buffer) DrawBuffer ¶
DrawBuffer scales and draws a source buffer into dst.
func (*Buffer) DrawRoundedRect ¶
DrawRoundedRect draws rounded rectangle outline.
func (*Buffer) FillRoundedRect ¶
FillRoundedRect fills r with rounded corners.
func (*Buffer) SetClip ¶
SetClip restricts subsequent drawing operations to r intersected with bounds.
type PixelFormat ¶
type PixelFormat int
PixelFormat represents the pixel format of a buffer.
const ( PixelFormatBGRA PixelFormat = iota PixelFormatRGBA PixelFormatRGB565 )