drawing

package
v0.0.0-...-9314ada Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColourNameToRGBA = map[string]color.NRGBA{
	"darkgray": {R: 0x55, G: 0x57, B: 0x53},
	"red":      {R: 0xEF, G: 0x29, B: 0x29},
	"green":    {R: 0x8A, G: 0xE2, B: 0x34},
	"yellow":   {R: 0xFC, G: 0xE9, B: 0x4F},
	"blue":     {R: 0x72, G: 0x9F, B: 0xCF},
	"magenta":  {R: 0xEE, G: 0x38, B: 0xDA},
	"cyan":     {R: 0x34, G: 0xE2, B: 0xE2},
	"white":    {R: 0xEE, G: 0xEE, B: 0xEC},
}

Functions

func CopyRGBAtoBGR565

func CopyRGBAtoBGR565(dst *fbimage.BGR565, src *image.RGBA)

copyRGBAtoBGR565 is an inlined version of the hot pixel copying loop for the special case of copying from an *image.RGBA to an *fbimage.BGR565.

This specialization brings down copying time to 137ms (from 1.8s!) on the Raspberry Pi 4.

func CopyRGBAtoBGRA

func CopyRGBAtoBGRA(dst *fbimage.BGRA, src *image.RGBA)

copyRGBAtoBGRA is an inlined version of the hot pixel copying loop for the special case of copying from an *image.RGBA to an *fbimage.BGRA.

This specialization brings down copying time to 5ms (from 60-70ms) on an amd64 qemu VM with virtio VGA.

func ScaleImageInside

func ScaleImageInside(bounds image.Rectangle, maxW, maxH int) image.Rectangle

Calculated linear scaling of an rectangle from its original size to a max width and max height of a desired output. The whole picture is scaled inside the rectangle with blank space to right and top

func ScaleImageOuter

func ScaleImageOuter(bounds image.Rectangle, target, clip image.Point) image.Rectangle

Calculated linear scaling of an rectangle from its original size to a max width and max height of a desired output. The whole picture is scaled inside the rectangle with blank space to right and top. It is assumed the image is not rescaled when it is drawn

Parameters - bounds is the size of the image - maxW and maxH is frame size needs to be mapped to - anchor which side of picture is to be anchored (might be better as a point)

Types

This section is empty.

Jump to

Keyboard shortcuts

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