Image

Image is the class for loading and manipulating images. It extends Texture of the feature to load images by filename and save the (current) image into a file.

Constructors

this
this()

CTor

this
this(string filename, Texture.Format t_fmt)

CTor

this
this(Texture tex, Texture.Format t_fmt)

CTor

this
this(Surface srfc, Texture.Format t_fmt)

CTor

Members

Aliases

subImage
alias subImage = subTexture

Alias for subTexture.

Functions

loadFromFile
void loadFromFile(string filename, Color* col, Texture.Format t_fmt)

Load the image from filename.

loadFromFile
void loadFromFile(string filename, Texture.Format t_fmt)

Load the image from filename.

saveToFile
void saveToFile(string filename)

Save the (current) image into filename.

Inherited Members

From Texture

Format
enum Format

Supported Texture Format

Compression
enum Compression

Compression modes

~this
~this()

DTor

free
void free()

Free / Delete the Texture & Memory After this call, the Pixel data is invalid.

currentlyBound
GLint currentlyBound()

Returns the currently bound texture id.

Id
GLuint Id [@property getter]

Returns the Texture Id.

isValid
bool isValid()

Returns if the texture is used.

width
ushort width [@property getter]

Returns the width of this Texture

height
ushort height [@property getter]

Returns the height of this Texture.

depth
ubyte depth [@property getter]

Returns the depth. May often 24 or 32.

getFormat
Format getFormat()

Returns the Format.

bind
void bind()

Binds this Texture. Means this Texture is now activated.

unbind
void unbind()

Binds this Texture. Means this Texture is now deactivated.

isCurrentlyBound
bool isCurrentlyBound()

Returns true, if this Texture is currently activated.

setSmooth
void setSmooth(bool enable)

Set smooth filter for the (next) load.

isSmooth
bool isSmooth()

Returns if smooth filter are activated.

setRepeat
void setRepeat(bool repeat)

Set repeating for the (next) load.

isRepeated
bool isRepeated()

Returns if repeating is enabled.

setCompression
void setCompression(Compression comp)

(Re)Set the compression mode.

getCompression
Compression getCompression()

Returns the current Compression mode.

isCompressed
bool isCompressed()

Checks whether the current Texture is compressed or not.

loadFromMemory
void loadFromMemory(void* memory, ushort width, ushort height, ubyte depth, Format fmt)

Load from memory.

setColorkey
void setColorkey(Color colorkey)

Set a colorkey.

setColorkey
void setColorkey(Color colorkey)

Rvalue version

getMemory
void[] getMemory(void[] memory)

Returns the pixel of this Texture or null if this Texture isn't valid. If memory is not null and has the same width and height as the Texture, it is used to store the pixel data. Otherwise it <b>allocates</b> GC memory.

subTexture
Texture subTexture(ShortRect rect)

Rvalue version

subTexture
Texture subTexture(ShortRect rect)

Returns a subTexture of this Texture.

copy
void copy(Texture tex, ShortRect* rect)

Copy another Texture to this. The second parameter is a pointer to the destination rect. Is it is null this means the whole tex is copied.

update
void update(void* memory, ShortRect* rect, Format fmt)

Update the pixel data of this Texture. The second parameter is a pointer to the area which is updated. If it is null (default) the whole Texture will be updated. The third parameter is the format of the pixels.

Meta

Authors

rschuett