Image

Class for loading, manipulating and saving images.

Constructors

this
this()

Default constructor.

Destructor

~this
~this()

Destructor.

Members

Functions

copyImage
void copyImage(const(Image) source, uint destX, uint destY, IntRect sourceRect = IntRect(0, 0, 0, 0), bool applyAlpha = false)

Copy pixels from another image onto this one.

create
void create(uint width, uint height, Color color)

Create the image and fill it with a unique color.

create
void create(uint width, uint height, const(ubyte)[] pixels)

Create the image from an array of pixels.

createMaskFromColor
void createMaskFromColor(Color maskColor, ubyte alpha = 0)

Create a transparency mask from a specified color-key.

flipHorizontally
void flipHorizontally()

Flip the image horizontally (left <-> right)

flipVertically
void flipVertically()

Flip the image vertically (top <-> bottom)

getPixel
Color getPixel(uint x, uint y)

Get the color of a pixel

getPixelArray
const(ubyte)[] getPixelArray()

Get the read-only array of pixels that make up the image.

getSize
Vector2u getSize()

Return the size (width and height) of the image.

loadFromFile
bool loadFromFile(const(char)[] filename)

Load the image from a file on disk.

loadFromMemory
bool loadFromMemory(const(void)[] data)

Load the image from a file in memory.

loadFromStream
bool loadFromStream(InputStream stream)

Load the image from a custom stream.

saveToFile
bool saveToFile(const(char)[] filename)

Save the image to a file on disk.

setPixel
void setPixel(uint x, uint y, Color color)

Change the color of a pixel.

Properties

dup
Image dup [@property getter]

Create a copy of the Image.

Meta