pixman

package module
v0.0.0-...-57b5338 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2025 License: BSD-1-Clause Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

GoPixman

Go Ci Go Report Card PkgGoDev

GoPixman is a purego wrapper for Pixman to provide highly optimised software blitting functionality, especially on embedded platforms.

Pixman is a library that provides low-level pixel manipulation features such as image compositing and trapezoid rasterization.

Canonical Pixman source: https://gitlab.freedesktop.org/pixman/pixman

Helpers

Use FFMPEG to create raw images for format testing, ie:

ffmpeg -i testdata/pg-coral.png -t 5 -r 1 -pix_fmt rgb565 frame-%d.raw

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// These must match the C function signatures
	ImageCreateBits      func(format PixmanFormatCode, width int, height int, bits *uint32, rowstride int) *PixmanImage
	ImageCreateSolidFill func(color *PixmanColor) *PixmanImage
	ImageGetFormat       func(image *PixmanImage) PixmanFormatCode
	ImageGetWidth        func(image *PixmanImage) int32
	ImageGetHeight       func(image *PixmanImage) int32
	ImageGetStride       func(image *PixmanImage) int32
	ImageGetDepth        func(image *PixmanImage) int32
	ImageGetData         func(image *PixmanImage) *uint32
	ImageComposite32     func(op PixmanOperation, src *PixmanImage, mask *PixmanImage, dest *PixmanImage, src_x, src_y, mask_x, mask_y, dest_x, dest_y int32, width, height int32)
	Fill                 func(bits *uint32, stride int, bpp int, x int, y int, width int, height int, xor uint32) int
	ImageUnref           func(image *PixmanImage) int
)

Functions

This section is empty.

Types

type Image

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

func ImageFromBits

func ImageFromBits(format PixmanFormatCode, width, height int, bits []byte, stride int) (*Image, error)

func ImageFromImage

func ImageFromImage(img image.Image) (*Image, error)

func ImageSolid

func ImageSolid(col color.Color) (*Image, error)

func (*Image) At

func (i *Image) At(x, y int) color.Color

func (*Image) Bounds

func (i *Image) Bounds() image.Rectangle

func (*Image) ColorModel

func (i *Image) ColorModel() color.Model

func (*Image) Composite

func (i *Image) Composite(src *Image, r image.Rectangle, sp image.Point)

Composite performs a blit operation from the sub-image of `src` defined by `r`, placing the result at the point `sp` in this image.

func (*Image) Depth

func (i *Image) Depth() int

func (*Image) Fill

func (i *Image) Fill(rect image.Rectangle, col color.Color)

func (*Image) SaveRaw

func (i *Image) SaveRaw(filename string) error

func (*Image) Set

func (i *Image) Set(x, y int, c color.Color)

type PixmanColor

type PixmanColor struct {
	Red   uint16
	Green uint16
	Blue  uint16
	Alpha uint16
}

PixmanColor mirrors the C struct pixman_color_t See: https://gitlab.freedesktop.org/pixman/pixman/-/blob/9879f6cfc40b4ef3bdca4ee9aaedacff8fb87244/pixman/pixman.h#L150

type PixmanFormatCode

type PixmanFormatCode uint32
const (
	PIXMAN_a8r8g8b8 PixmanFormatCode = 0x20028888
	PIXMAN_x8r8g8b8 PixmanFormatCode = 0x20020888
	PIXMAN_a8b8g8r8 PixmanFormatCode = 0x20038888
	PIXMAN_x8b8g8r8 PixmanFormatCode = 0x20030888
	PIXMAN_b8g8r8a8 PixmanFormatCode = 0x20088888
	PIXMAN_b8g8r8x8 PixmanFormatCode = 0x20080888
	PIXMAN_r5g6b5   PixmanFormatCode = 0x10020565
	PIXMAN_b5g6r5   PixmanFormatCode = 0x10030565
	PIXMAN_a1r5g5b5 PixmanFormatCode = 0x10021555
	PIXMAN_x1r5g5b5 PixmanFormatCode = 0x10020555
	PIXMAN_a1b5g5r5 PixmanFormatCode = 0x10031555
	PIXMAN_x1b5g5r5 PixmanFormatCode = 0x10030555
	PIXMAN_a4r4g4b4 PixmanFormatCode = 0x10024444
	PIXMAN_x4r4g4b4 PixmanFormatCode = 0x10020444
	PIXMAN_a4b4g4r4 PixmanFormatCode = 0x10034444
	PIXMAN_x4b4g4r4 PixmanFormatCode = 0x10030444
	PIXMAN_r8g8b8a8 PixmanFormatCode = 0x20098888
	PIXMAN_r8g8b8x8 PixmanFormatCode = 0x20090888
)

Pixman format codes (partial list, add more as needed) See https://gitlab.freedesktop.org/pixman/pixman/-/blob/9879f6cfc40b4ef3bdca4ee9aaedacff8fb87244/pixman/pixman.h#L1044 Note: The lack of macros in Go means we have to manually define these See helper/helper.c to regenerate

func (PixmanFormatCode) BPP

func (f PixmanFormatCode) BPP() int

Determines the depth in bits-per-pixel for a given Pixman format code. See https://gitlab.freedesktop.org/pixman/pixman/-/blob/9879f6cfc40b4ef3bdca4ee9aaedacff8fb87244/pixman/pixman.h#L1010

func (PixmanFormatCode) String

func (f PixmanFormatCode) String() string

type PixmanImage

type PixmanImage struct{}

type PixmanOperation

type PixmanOperation uint32
const (
	PIXMAN_OP_CLEAR        PixmanOperation = 0x00
	PIXMAN_OP_SRC          PixmanOperation = 0x01
	PIXMAN_OP_DST          PixmanOperation = 0x02
	PIXMAN_OP_OVER         PixmanOperation = 0x03
	PIXMAN_OP_OVER_REVERSE PixmanOperation = 0x04
	PIXMAN_OP_IN           PixmanOperation = 0x05
	PIXMAN_OP_IN_REVERSE   PixmanOperation = 0x06
	PIXMAN_OP_OUT          PixmanOperation = 0x07
	PIXMAN_OP_OUT_REVERSE  PixmanOperation = 0x08
	PIXMAN_OP_ATOP         PixmanOperation = 0x09
	PIXMAN_OP_ATOP_REVERSE PixmanOperation = 0x0a
	PIXMAN_OP_XOR          PixmanOperation = 0x0b
	PIXMAN_OP_ADD          PixmanOperation = 0x0c
	PIXMAN_OP_SATURATE     PixmanOperation = 0x0d
)

Pixman composite operations See https://gitlab.freedesktop.org/pixman/pixman/-/blob/9879f6cfc40b4ef3bdca4ee9aaedacff8fb87244/pixman/pixman.h#L388

Directories

Path Synopsis
cmd
blit command

Jump to

Keyboard shortcuts

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