#include <image.h>
Public Member Functions | |
~Image () | |
void | createInternal (int w, int h, const Graphics::PixelFormat &format) |
void | setPalette (const byte *colors, unsigned n_colors) |
void | setPaletteFromImage (const Image *src) |
bool | getTransparentIndex (uint &index) const |
void | performTransparencyHack (uint colorValue, uint numFrames, uint currentFrameIndex, uint haloWidth, uint haloOpacityIncrementByPixelDistance) |
void | setTransparentIndex (uint index) |
bool | setFontColor (ColorFG fg, ColorBG bg) |
bool | setFontColorFG (ColorFG fg) |
bool | setFontColorBG (ColorBG bg) |
RGBA | getPaletteColor (int index) |
bool | setPaletteIndex (uint index, uint8 r, uint8 g, uint8 b) |
RGBA | setColor (uint8 r, uint8 g, uint8 b, uint8 a=(uint) 255) |
bool | isAlphaOn () const |
void | alphaOn () |
void | alphaOff () |
void | initializeToBackgroundColor (RGBA backgroundColor=RGBA(14, 15, 16, 255)) |
void | makeBackgroundColorTransparent (int haloSize=0, int shadowOpacity=255) |
void | putPixel (int x, int y, int r, int g, int b, int a) |
void | putPixelIndex (int x, int y, uint index) |
void | fillRect (int x, int y, int w, int h, int r, int g, int b, int a=(uint) 255) |
void | blitFrom (const Graphics::Surface &src) |
void | getPixel (int x, int y, uint &r, uint &g, uint &b, uint &a) const |
void | getPixelIndex (int x, int y, uint &index) const |
void | draw (int x, int y) const |
void | drawSubRect (int x, int y, int rx, int ry, int rw, int rh) const |
void | drawSubRectInverted (int x, int y, int rx, int ry, int rw, int rh) const |
void | drawOn (Image *d, int x, int y) const |
void | drawSubRectOn (Image *d, int x, int y, int rx, int ry, int rw, int rh) const |
void | drawSubRectInvertedOn (Image *d, int x, int y, int rx, int ry, int rw, int rh) const |
int | width () const |
int | height () const |
Graphics::PixelFormat | format () const |
bool | isIndexed () const |
BackendSurface | getSurface () |
void | drawHighlighted () |
void | dump () |
Static Public Member Functions | |
static Image * | create (int w, int h) |
static Image * | create (int w, int h, const Graphics::PixelFormat &format) |
static Image * | createScreenImage () |
static Image * | duplicate (Image *image, const Graphics::PixelFormat &format) |
A simple image object that can be drawn and read/written to at the pixel level.
Ultima::Ultima4::Image::~Image | ( | ) |
Frees the image.
|
static |
Creates a new palette based image. Scale is stored to allow drawing using U4 (320x200) coordinates, regardless of the actual image scale.
|
static |
Creates a new RGB image. Scale is stored to allow drawing using U4 (320x200) coordinates, regardless of the actual image scale.
|
static |
Create a special purpose image the represents the whole screen.
|
static |
Creates a duplicate of another image
void Ultima::Ultima4::Image::setPalette | ( | const byte * | colors, |
unsigned | n_colors | ||
) |
Sets the palette
void Ultima::Ultima4::Image::setPaletteFromImage | ( | const Image * | src | ) |
Copies the palette from another image.
bool Ultima::Ultima4::Image::setFontColor | ( | ColorFG | fg, |
ColorBG | bg | ||
) |
Sets the specified font colors
bool Ultima::Ultima4::Image::setFontColorFG | ( | ColorFG | fg | ) |
Sets the specified font colors
bool Ultima::Ultima4::Image::setFontColorBG | ( | ColorBG | bg | ) |
Sets the specified font colors
RGBA Ultima::Ultima4::Image::getPaletteColor | ( | int | index | ) |
Returns the color of the specified palette index
bool Ultima::Ultima4::Image::setPaletteIndex | ( | uint | index, |
uint8 | r, | ||
uint8 | g, | ||
uint8 | b | ||
) |
Sets the specified palette index to the specified RGB color
void Ultima::Ultima4::Image::putPixel | ( | int | x, |
int | y, | ||
int | r, | ||
int | g, | ||
int | b, | ||
int | a | ||
) |
Sets the color of a single pixel.
void Ultima::Ultima4::Image::putPixelIndex | ( | int | x, |
int | y, | ||
uint | index | ||
) |
Sets the palette index of a single pixel. If the image is in indexed mode, then the index is simply the palette entry number. If the image is RGB, it is a packed RGB triplet.
void Ultima::Ultima4::Image::fillRect | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
int | r, | ||
int | g, | ||
int | b, | ||
int | a = (uint) 255 |
||
) |
Fills a rectangle in the image with a given color.
void Ultima::Ultima4::Image::getPixel | ( | int | x, |
int | y, | ||
uint & | r, | ||
uint & | g, | ||
uint & | b, | ||
uint & | a | ||
) | const |
Gets the color of a single pixel.
void Ultima::Ultima4::Image::getPixelIndex | ( | int | x, |
int | y, | ||
uint & | index | ||
) | const |
Gets the palette index of a single pixel. If the image is in indexed mode, then the index is simply the palette entry number. If the image is RGB, it is a packed RGB triplet.
|
inline |
Draws the entire image onto the screen at the given offset.
|
inline |
Draws a piece of the image onto the screen at the given offset. The area of the image to draw is defined by the rectangle rx, ry, rw, rh.
|
inline |
Draws a piece of the image onto the screen at the given offset, inverted. The area of the image to draw is defined by the rectangle rx, ry, rw, rh.
void Ultima::Ultima4::Image::drawOn | ( | Image * | d, |
int | x, | ||
int | y | ||
) | const |
Draws the image onto another image.
void Ultima::Ultima4::Image::drawSubRectOn | ( | Image * | d, |
int | x, | ||
int | y, | ||
int | rx, | ||
int | ry, | ||
int | rw, | ||
int | rh | ||
) | const |
Draws a piece of the image onto another image.
void Ultima::Ultima4::Image::drawSubRectInvertedOn | ( | Image * | d, |
int | x, | ||
int | y, | ||
int | rx, | ||
int | ry, | ||
int | rw, | ||
int | rh | ||
) | const |
Draws a piece of the image onto another image, inverted.
void Ultima::Ultima4::Image::dump | ( | ) |
Debug method that dumps a given image directly to the screen and does a screen update. Useful for validating images are correct