ScummVM API documentation
Ultima::Ultima4::Image Class Reference

#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 Imagecreate (int w, int h)
 
static Imagecreate (int w, int h, const Graphics::PixelFormat &format)
 
static ImagecreateScreenImage ()
 
static Imageduplicate (Image *image, const Graphics::PixelFormat &format)
 

Detailed Description

A simple image object that can be drawn and read/written to at the pixel level.

  • drawing methods should be pushed to Drawable subclass

Constructor & Destructor Documentation

◆ ~Image()

Ultima::Ultima4::Image::~Image ( )

Frees the image.

Member Function Documentation

◆ create() [1/2]

static Image* Ultima::Ultima4::Image::create ( int  w,
int  h 
)
static

Creates a new palette based image. Scale is stored to allow drawing using U4 (320x200) coordinates, regardless of the actual image scale.

◆ create() [2/2]

static Image* Ultima::Ultima4::Image::create ( int  w,
int  h,
const Graphics::PixelFormat format 
)
static

Creates a new RGB image. Scale is stored to allow drawing using U4 (320x200) coordinates, regardless of the actual image scale.

◆ createScreenImage()

static Image* Ultima::Ultima4::Image::createScreenImage ( )
static

Create a special purpose image the represents the whole screen.

◆ duplicate()

static Image* Ultima::Ultima4::Image::duplicate ( Image image,
const Graphics::PixelFormat format 
)
static

Creates a duplicate of another image

◆ setPalette()

void Ultima::Ultima4::Image::setPalette ( const byte *  colors,
unsigned  n_colors 
)

Sets the palette

◆ setPaletteFromImage()

void Ultima::Ultima4::Image::setPaletteFromImage ( const Image src)

Copies the palette from another image.

◆ setFontColor()

bool Ultima::Ultima4::Image::setFontColor ( ColorFG  fg,
ColorBG  bg 
)

Sets the specified font colors

◆ setFontColorFG()

bool Ultima::Ultima4::Image::setFontColorFG ( ColorFG  fg)

Sets the specified font colors

◆ setFontColorBG()

bool Ultima::Ultima4::Image::setFontColorBG ( ColorBG  bg)

Sets the specified font colors

◆ getPaletteColor()

RGBA Ultima::Ultima4::Image::getPaletteColor ( int  index)

Returns the color of the specified palette index

◆ setPaletteIndex()

bool Ultima::Ultima4::Image::setPaletteIndex ( uint  index,
uint8  r,
uint8  g,
uint8  b 
)

Sets the specified palette index to the specified RGB color

◆ putPixel()

void Ultima::Ultima4::Image::putPixel ( int  x,
int  y,
int  r,
int  g,
int  b,
int  a 
)

Sets the color of a single pixel.

◆ putPixelIndex()

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.

◆ fillRect()

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.

◆ getPixel()

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.

◆ getPixelIndex()

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.

◆ draw()

void Ultima::Ultima4::Image::draw ( int  x,
int  y 
) const
inline

Draws the entire image onto the screen at the given offset.

◆ drawSubRect()

void Ultima::Ultima4::Image::drawSubRect ( int  x,
int  y,
int  rx,
int  ry,
int  rw,
int  rh 
) const
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.

◆ drawSubRectInverted()

void Ultima::Ultima4::Image::drawSubRectInverted ( int  x,
int  y,
int  rx,
int  ry,
int  rw,
int  rh 
) const
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.

◆ drawOn()

void Ultima::Ultima4::Image::drawOn ( Image d,
int  x,
int  y 
) const

Draws the image onto another image.

◆ drawSubRectOn()

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.

◆ drawSubRectInvertedOn()

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.

◆ dump()

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


The documentation for this class was generated from the following file: