gd

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 4 Imported by: 0

README

GD

This package implement libgd.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlphaBlend

func AlphaBlend(dst, src int) int

func ExtraVersion

func ExtraVersion() string

func FontCacheSetup

func FontCacheSetup() bool

func FontCacheShutdown

func FontCacheShutdown()

func Free

func Free(m unsafe.Pointer)

func FreeFontCache

func FreeFontCache()

func LayerMultiply

func LayerMultiply(dst, src int) int

func LayerOverlay

func LayerOverlay(dst, src int) int

func MajorVersion

func MajorVersion() int

func MinorVersion

func MinorVersion() int

func ReleaseVersion

func ReleaseVersion() int

func TrueColor

func TrueColor(r, g, b uint8) int32

func TrueColorAlpha

func TrueColorAlpha(r, g, b, a uint8) int32

TrueColorAlpha - Compose a true color value from its components.

Parameters:

r - The red channel (0-255)
g - The green channel (0-255)
b - The blue channel (0-255)
a - The alpha channel (0-127, where 127 is fully transparent, and 0 is completely opaque).

func Version

func Version() string

Types

type Font

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

Font - A font structure, containing the bitmaps of all characters in a font. Used to declare the characteristics of a font. Text-output functions expect these as their second argument, following the <gdImagePtr> argument. <gdFontGetSmall> and <gdFontGetLarge> both return one.

You can provide your own font data by providing such a structure and the associated pixel array. You can determine the width and height of a single character in a font by examining the w and h members of the structure. If you will not be creating your own fonts, you will not need to concern yourself with the rest of the components of this structure.

func (*Font) Data

func (f *Font) Data() []byte

Data - Font data; array of characters, one row after another. Easily included in code, also easily loaded from data files.

func (*Font) Height

func (f *Font) Height() int

Height - Character height

func (*Font) Offset

func (f *Font) Offset() int

Offset - First character is numbered... (usually 32 = space)

func (*Font) TotalChars

func (f *Font) TotalChars() int

TotalChars - # of characters in font

func (*Font) Width

func (f *Font) Width() int

Width - Character width

type HeifChroma

type HeifChroma string

HeifChroma - HEIF Chroma Subsampling : Values that select the HEIF chroma subsampling.

func (HeifChroma) C

func (v HeifChroma) C() C.gdHeifChroma

C - Convert to type C.gdHeifChroma

type HeifCodec

type HeifCodec int

HeifCodec - HEIF Coding Format : Values that select the HEIF coding format.

const (
	HeifCodecUnknown HeifCodec = C.GD_HEIF_CODEC_UNKNOWN
	HeifCodecHEVC    HeifCodec = C.GD_HEIF_CODEC_HEVC
	HeifCodecAV1     HeifCodec = C.GD_HEIF_CODEC_AV1
)

func (HeifCodec) C

func (v HeifCodec) C() C.gdHeifCodec

C - Convert to type C.gdHeifCodec

type Image

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

Image - The data structure in which gd stores images. <gdImageCreate>, <gdImageCreateTrueColor> and the various image file-loading functions return a pointer to this type, and the other functions expect to receive a pointer to this type as their first argument.

func Create

func Create(width, height int) *Image

Create - Creates a palette-based image (up to 256 colors).

func CreateFromAvif

func CreateFromAvif(data []byte) *Image

CreateFromAvif - Creates an image by decoding a AVIF file from a byte slice.

func CreateFromBmp

func CreateFromBmp(data []byte) *Image

CreateFromBmp - Creates an image by decoding a BMP file from a byte slice.

func CreateFromGd

func CreateFromGd(data []byte) *Image

CreateFromGd - Creates an image by decoding a GD file from a byte slice.

func CreateFromGd2

func CreateFromGd2(data []byte) *Image

CreateFromGd2 - Creates an image by decoding a GD2 file from a byte slice.

func CreateFromGd2Part

func CreateFromGd2Part(data []byte, x, y, w, h int) *Image

CreateFromGd2Part - Creates an part image by decoding a GD2 file from a byte slice.

func CreateFromGif

func CreateFromGif(data []byte) *Image

CreateFromGif - Creates an image by decoding a GIF file from a byte slice.

func CreateFromHeif

func CreateFromHeif(data []byte) *Image

CreateFromHeif - Creates an image by decoding a HEIF file from a byte slice.

func CreateFromJpeg

func CreateFromJpeg(data []byte) *Image

CreateFromJpeg - Creates an image by decoding a JPEG file from a byte slice.

func CreateFromJpegEx

func CreateFromJpegEx(data []byte, ignoreWarning bool) *Image

CreateFromJpegEx - Creates an extended image by decoding a JPEG file from a byte slice.

func CreateFromPng

func CreateFromPng(data []byte) *Image

func CreateFromTga

func CreateFromTga(data []byte) *Image

CreateFromTga - Creates an image by decoding a TGA file from a byte slice.

func CreateFromTiff

func CreateFromTiff(data []byte) *Image

CreateFromTiff - Creates an image by decoding a TIFF file from a byte slice.

func CreateFromWBMP

func CreateFromWBMP(data []byte) *Image

CreateFromWBMP - Creates an image by decoding a WBMP file from a byte slice.

func CreateFromWebp

func CreateFromWebp(data []byte) *Image

CreateFromWebp - Creates an image by decoding a WEBP file from a byte slice.

func CreateTrueColor

func CreateTrueColor(width, height int) *Image

CreateTrueColor - Creates a true color image (millions of colors).

func (*Image) AABlend

func (img *Image) AABlend()

func (*Image) AlphaBlending

func (img *Image) AlphaBlending(alphaBlending bool)

func (*Image) Arc

func (img *Image) Arc(cx, cy, w, h, s, e int, color int32)

func (*Image) BoundsSafe

func (img *Image) BoundsSafe(x, y int) int

func (*Image) Char

func (img *Image) Char(f Font, x, y, c int, color int32)

func (*Image) CharUp

func (img *Image) CharUp(f Font, x, y, c int, color int32)

func (*Image) Clone

func (img *Image) Clone() *Image

func (*Image) Close

func (img *Image) Close()

func (*Image) ColorAllocate

func (img *Image) ColorAllocate(r, g, b uint8) int32

func (*Image) ColorAllocateAlpha

func (img *Image) ColorAllocateAlpha(r, g, b, a uint8) int32

func (*Image) ColorClosest

func (img *Image) ColorClosest(r, g, b uint8) int32

func (*Image) ColorClosestAlpha

func (img *Image) ColorClosestAlpha(r, g, b, a uint8) int32

func (*Image) ColorClosestHWB

func (img *Image) ColorClosestHWB(r, g, b uint8) int32

func (*Image) ColorDeallocate

func (img *Image) ColorDeallocate(color int32)

func (*Image) ColorExact

func (img *Image) ColorExact(r, g, b uint8) int32

func (*Image) ColorExactAlpha

func (img *Image) ColorExactAlpha(r, g, b, a uint8) int32

func (*Image) ColorMatch

func (img *Image) ColorMatch(dst *Image) bool

func (*Image) ColorReplace

func (img *Image) ColorReplace(src, dst int32) int

func (*Image) ColorReplaceArray

func (img *Image) ColorReplaceArray(src, dst []int32) int

func (*Image) ColorReplaceThreshold

func (img *Image) ColorReplaceThreshold(src, dst int32, threshold float64) int

func (*Image) ColorResolve

func (img *Image) ColorResolve(r, g, b uint8) int32

func (*Image) ColorResolveAlpha

func (img *Image) ColorResolveAlpha(r, g, b, a uint8) int32

func (*Image) ColorTransparent

func (img *Image) ColorTransparent(color int32)

func (*Image) Copy

func (img *Image) Copy(dst *Image, dstX, dstY, srcX, srcY, w, h int)

func (*Image) CopyMerge

func (img *Image) CopyMerge(dst *Image, dstX, dstY, srcX, srcY, w, h, pct int)

func (*Image) CopyMergeGray

func (img *Image) CopyMergeGray(dst *Image, dstX, dstY, srcX, srcY, w, h, pct int)

func (*Image) CopyResampled

func (img *Image) CopyResampled(dst *Image, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH int)

func (*Image) CopyResized

func (img *Image) CopyResized(dst *Image, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH int)

func (*Image) CopyRotated

func (img *Image) CopyRotated(dst *Image, dstX, dstY float64, srcX, srcY, srcW, srcH, angle int)

func (*Image) CreatePaletteFromTrueColor

func (img *Image) CreatePaletteFromTrueColor(ditherFlag bool, colorsWanted int) *Image

func (*Image) DashedLine

func (img *Image) DashedLine(x1, y1, x2, y2 int, color int32)

func (*Image) Ellipse

func (img *Image) Ellipse(cx, cy, w, h int, color int32)

func (*Image) Fill

func (img *Image) Fill(x, y int, color int32)

func (*Image) FillToBorder

func (img *Image) FillToBorder(x, y, border int, color int32)

func (*Image) FilledArc

func (img *Image) FilledArc(cx, cy, w, h, s, e int, color int32, style int)

func (*Image) FilledEllipse

func (img *Image) FilledEllipse(cx, cy, w, h int, color int32)

func (*Image) FilledPolygon

func (img *Image) FilledPolygon(p *Point, n, c int)

func (*Image) FilledRectangle

func (img *Image) FilledRectangle(x1, y1, x2, y2 int, color int32)

func (*Image) GetClip

func (img *Image) GetClip() (x1, y1, x2, y2 int)

func (*Image) GetColorsTotal

func (img *Image) GetColorsTotal() int

func (*Image) GetPalettePixel

func (img *Image) GetPalettePixel(x, y int) int32

func (*Image) GetResolutionX

func (img *Image) GetResolutionX() uint

func (*Image) GetResolutionY

func (img *Image) GetResolutionY() uint

func (*Image) GetTransparent

func (img *Image) GetTransparent() uint8

func (*Image) GetTrueColorPixel

func (img *Image) GetTrueColorPixel(x, y int) int32

func (*Image) Height

func (img *Image) Height() int

func (*Image) IsInterlaced

func (img *Image) IsInterlaced() bool

func (*Image) IsTrueColor

func (img *Image) IsTrueColor() bool

func (*Image) Line

func (img *Image) Line(x1, y1, x2, y2 int, color int32)

func (*Image) OpenPolygon

func (img *Image) OpenPolygon(p *Point, n, c int)

func (*Image) PaletteCopy

func (img *Image) PaletteCopy(dst *Image)

func (*Image) PaletteToTrueColor

func (img *Image) PaletteToTrueColor() int

func (*Image) Polygon

func (img *Image) Polygon(p *Point, n, c int)

func (*Image) Rectangle

func (img *Image) Rectangle(x1, y1, x2, y2 int, color int32)

func (*Image) SaveAlpha

func (img *Image) SaveAlpha(saveAlpha bool)

func (*Image) SetClip

func (img *Image) SetClip(x1, y1, x2, y2 int)

func (*Image) SetPixel

func (img *Image) SetPixel(x, y int, color int32)

func (*Image) SetResolution

func (img *Image) SetResolution(x, y uint)

func (*Image) String

func (img *Image) String(f Font, x, y int, s string, color int32)

func (*Image) String16

func (img *Image) String16(f Font, x, y int, s string, color int32)

func (*Image) StringFT

func (img *Image) StringFT(fg int, fontList string, size, angle float64, x, y int, text string) ([]int, error)

func (*Image) StringTTF

func (img *Image) StringTTF(fg int, fontList string, size, angle float64, x, y int, text string) ([]int, error)

func (*Image) StringUp

func (img *Image) StringUp(f Font, x, y int, s string, color int32)

func (*Image) StringUp16

func (img *Image) StringUp16(f Font, x, y int, s string, color int32)

func (*Image) ToAVIF

func (img *Image) ToAVIF() []byte

func (*Image) ToAVIFEx

func (img *Image) ToAVIFEx(quality, speed int) []byte

func (*Image) ToBMP

func (img *Image) ToBMP(compression int) []byte

func (*Image) ToGD

func (img *Image) ToGD() []byte

func (*Image) ToGD2

func (img *Image) ToGD2(cs, fmt int) []byte

func (*Image) ToGIF

func (img *Image) ToGIF() []byte

func (*Image) ToHEIF

func (img *Image) ToHEIF() []byte

func (*Image) ToHEIFEx

func (img *Image) ToHEIFEx(quality int, codec HeifCodec, chroma HeifChroma) []byte

func (*Image) ToJPEG

func (img *Image) ToJPEG(quality int) []byte

func (*Image) ToPNG

func (img *Image) ToPNG() []byte

func (*Image) ToPNGEx

func (img *Image) ToPNGEx(level int) []byte

func (*Image) ToTIFF

func (img *Image) ToTIFF() []byte

func (*Image) ToWBMP

func (img *Image) ToWBMP(fg int) []byte

func (*Image) ToWEBP

func (img *Image) ToWEBP() []byte

func (*Image) ToWEBPEx

func (img *Image) ToWEBPEx(quantization int) []byte

func (*Image) TrueColorToPalette

func (img *Image) TrueColorToPalette(ditherFlag bool, colorsWanted int) int

func (*Image) TrueColorToPaletteSetMethod

func (img *Image) TrueColorToPaletteSetMethod(method, speed int) int

func (*Image) TrueColorToPaletteSetQuality

func (img *Image) TrueColorToPaletteSetQuality(minQuality, maxQuality int)

func (*Image) Width

func (img *Image) Width() int

type Point

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

Point - Represents a point in the coordinate space of the image; used by <gdImagePolygon>, <gdImageOpenPolygon> and <gdImageFilledPolygon> for polygon drawing.

func NewPoint

func NewPoint(x, y int) *Point

NewPoint - Create a new Point

func (*Point) X

func (p *Point) X() int

X - Floating point position (increase from left to right).

func (*Point) Y

func (p *Point) Y() int

Y - Floating point Row position (increase from top to bottom).

type PointF

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

PointF - Defines a point in a 2D coordinate system using floating point values.

func NewPointF

func NewPointF(x, y float64) *PointF

NewPointF - Create a new PointF

func (*PointF) X

func (p *PointF) X() float64

X - Floating point position (increase from left to right).

func (*PointF) Y

func (p *PointF) Y() float64

Y - Floating point Row position (increase from top to bottom).

type Rect

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

Rect - A rectangle in the coordinate space of the image.

func NewRect

func NewRect(x, y, w, h int) *Rect

NewRect - Create a new Rect

func (*Rect) Height

func (r *Rect) Height() int

Height - The height.

func (*Rect) Width

func (r *Rect) Width() int

Width - The width.

func (*Rect) X

func (r *Rect) X() int

X - The x-coordinate of the upper left corner.

func (*Rect) Y

func (r *Rect) Y() int

Y - The y-coordinate of the upper left corner.

Jump to

Keyboard shortcuts

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