arsd.pixmappaint

Pixmap image manipulation

Early Technology Preview.
This module is work in progress. API is subject to changes until further notice.

Members

Aliases

Blend
alias Blend = BlendMode
BlendFn
alias BlendFn = ubyte function(const ubyte background, const ubyte foreground) pure nothrow @(nogc)
Color
alias Color = arsd.color.Color
ColorF
alias ColorF = arsd.color.ColorF
Pixel
alias Pixel = Color
Point
alias Point = arsd.color.Point
Rectangle
alias Rectangle = arsd.color.Rectangle
Size
alias Size = arsd.color.Size

Enums

BlendAccuracy
enum BlendAccuracy

Alpha-blending accuracy level

BlendMode
enum BlendMode

Blend modes

Functions

alphaBlendRGB
void alphaBlendRGB(Pixel[] target, Pixel[] source)
void alphaBlendRGB(Pixel pxTarget, Pixel pxSource)

Blends source into target with respect to the opacity of the source image (as stored in the alpha channel).

alphaBlendRGBA
void alphaBlendRGBA(Pixel[] target, Pixel[] source)
void alphaBlendRGBA(Pixel pxTarget, Pixel pxSource)

Blends source into target with respect to the opacity of the source image (as stored in the alpha channel).

blendPixels
void blendPixels(Pixel[] target, Pixel[] source)
void blendPixels(Pixel[] target, Pixel[] source, BlendMode mode)
void blendPixels(Pixel[] target, Pixel[] source, BlendMode mode, BlendAccuracy accuracy)

Blends the pixel data of source into target using the requested blending mode.

clamp255
ubyte clamp255(Tint value)

Limits a value to a maximum of 0xFF (= 255).

drawLine
void drawLine(Pixmap target, Point a, Point b, Pixel color)

Draws a line

drawPixel
void drawPixel(Pixmap target, Point pos, Pixel color)

Draws a single pixel

drawPixmap
void drawPixmap(Pixmap target, Pixmap image, Point pos, Blend blend)

Draws an image (a source pixmap) on a target pixmap

drawRectangle
void drawRectangle(Pixmap target, Rectangle rectangle, Pixel color)

Draws a rectangle

drawSprite
void drawSprite(Pixmap target, SpriteSheet sheet, int spriteIndex, Point pos, Blend blend)

Draws a sprite from a spritesheet

intNormalizedSqrt
ubyte intNormalizedSqrt(ubyte value)

Calculates the square root of the normalized value representated by the input integer number.

intSqrt
ubyte intSqrt(ubyte value)

Calculates the square root of an integer number as an integer number.

invert
Pixel invert(Pixel color)

Inverts a color (to its negative color).

invert
void invert(Pixmap pixmap)

Inverts all colors to produce a negative image.

n255thsOf
ubyte n255thsOf(ubyte nPercentage, ubyte value)

Fast 8-bit “percentage” function

opacity
void opacity(Pixmap pixmap, ubyte opacity)

Sets the opacity of a Pixmap.

opacityF
void opacityF(Pixmap pixmap, float opacity)

Sets the opacity of a Pixmap.

rgb
Pixel rgb(ubyte r, ubyte g, ubyte b)
rgba
Pixel rgba(ubyte r, ubyte g, ubyte b, ubyte a)
rgba
Pixel rgba(ubyte r, ubyte g, ubyte b, float aPct)

Structs

Pixmap
struct Pixmap

Pixel data container

SpriteSheet
struct SpriteSheet

Templates

alphaBlend
template alphaBlend(BlendFn blend = null, BlendAccuracy accuracy = BlendAccuracy.rgba)
template alphaBlend(BlendAccuracy accuracy, BlendFn blend = null)

Blends source into target with respect to the opacity of the source image (as stored in the alpha channel).

blendPixel
template blendPixel(BlendMode mode, BlendAccuracy accuracy = BlendAccuracy.rgba)

Blends pixel source into pixel target using the requested blending mode.

Meta