| |
Main Page Namespace List Class Hierarchy Alphabetical List Compound List Namespace Members Compound Members
PLMImage Class ReferenceImage = pixel buffer of any depth and size.
More...
#include <PLMImage.hpp>
Inheritance diagram for PLMImage:
[legend]List of all members.
|
Public Types |
| enum | DrawMode |
| enum | Gradients |
| enum | {
FORMAT_BMP = 1,
FORMAT_PCX = 2,
FORMAT_GIF = 3,
FORMAT_TGA = 4,
FORMAT_TGARLE = 5,
FORMAT_FONT = 6
} |
| enum | { FORMAT_UNK = 0,
FORMAT_DEF = 1
} |
Public Methods |
| | PLMImage (u32 width=0, u32 height=0, u32 depth=8) |
| | PLMImage (PLMResFile &src, int format=PLMResource::FORMAT_UNK) |
| | PLMImage (PLMImage *src) |
| u8 * | Pixels () const |
| u32 | Width () const |
| u32 | Height () const |
| u32 | Pitch () const |
| u32 | Depth () const |
| u32 | Bpp () const |
| void | SetPalette (PLMPal *src, u32 first, u32 number) |
| void | ReplacePalette (PLMPal *src) |
| PLMPal * | GetPalette (void) const |
| void | SetClipping (s32 left, s32 top, s32 right, s32 bottom) |
| bool | IsClipping () const |
| void | GetClipping (s32 &left, s32 &top, s32 &right, s32 &bottom) |
| void | StopClipping () |
| PLMColor | GetPixel (s32 x, s32 y) const |
| void | PutPixel (s32 x, s32 y, PLMColor c) |
| void | XorPixel (s32 x, s32 y, PLMColor c) |
| void | HLine (s32 x, s32 y, u32 w, PLMColor c, DrawMode mode=DRAW_SET) |
| void | VLine (s32 x, s32 y, u32 h, PLMColor c, DrawMode mode=DRAW_SET) |
| void | Line (s32 x1, s32 y1, s32 x2, s32 y2, PLMColor c, DrawMode mode=DRAW_SET) |
| void | Frame (s32 x, s32 y, u32 w, u32 h, PLMColor c, DrawMode mode=DRAW_SET) |
| void | Rectangle (s32 x, s32 y, u32 w, u32 h, PLMColor c, DrawMode mode=DRAW_SET) |
| void | Fill (PLMColor c, DrawMode mode=DRAW_SET) |
| void | Gradient (s32 x, s32 y, u32 w, u32 h, PLMColor c1, PLMColor c2, int type, DrawMode mode=DRAW_SET) |
| void | Circle (s32 x, s32 y, s32 radius, PLMColor c, DrawMode mode=DRAW_SET) |
| void | Disk (s32 x, s32 y, s32 radius, PLMColor c, DrawMode mode=DRAW_SET) |
| void | DrawText (s32 x, s32 y, const char *text, PLMColor col, PLMFont *font, FontAlign yref=FONT_TOP, int nb=-1) |
| void | DrawTextEx (s32 x, s32 y, const char *text, FontParams &infos, int nb=-1) |
| void | CopyImage (s32 xdest, s32 ydest, PLMImage *src) |
| void | CopyImage (s32 xdest, s32 ydest, PLMImage *src, s32 xsrc, s32 ysrc, u32 wsrc, u32 hsrc) |
| void | CopyImage (s32 xdest, s32 ydest, PLMImage *src, const PLMRect &rect) |
| void | TCopyImage (s32 xdest, s32 ydest, PLMColor c, PLMImage *src) |
| void | TCopyImage (s32 xdest, s32 ydest, PLMColor c, PLMImage *src, s32 xsrc, s32 ysrc, u32 wsrc, u32 hsrc) |
| void | TCopyImage (s32 xdest, s32 ydest, PLMColor c, PLMImage *src, const PLMRect &rect) |
| void | MoveInside (s32 xfrom, s32 yfrom, u32 w, u32 h, s32 xto, s32 yto) |
| void | VFlip () |
| bool | Resize (u32 width, u32 height) |
| bool | NewFormat (u32 width, u32 height, u32 depth) |
| virtual bool | Load (PLMResFile &f, int format=FORMAT_UNK) |
| virtual bool | Save (PLMResFile &f, int format=FORMAT_UNK) |
| virtual u32 | MemoryUsed () const |
| void | PrintInfo () const |
| virtual bool | LoadName (const char *filename, int format=FORMAT_UNK) |
| virtual bool | SaveName (const char *filename, int format=FORMAT_DEF) |
Detailed Description
Image = pixel buffer of any depth and size.
Not harware accelerated. See PLMImage for a description of all drawing methods.
Member Enumeration Documentation
|
|
Drawing mode, set = replace, xor = draw twice to restore.
|
|
|
- Enumeration values:
-
| FORMAT_BMP |
Microsoft BMP file. |
| FORMAT_PCX |
ZSoft Paintbrush PCX file (8 or 24 bits). |
| FORMAT_GIF |
Compuserve GIF file (load only, single image). |
| FORMAT_TGA |
Targa image file. |
| FORMAT_TGARLE |
to save in RLE compressed format |
| FORMAT_FONT |
image contained in a PLM font (load only) |
|
anonymous enum [inherited]
|
|
|
|
- Enumeration values:
-
| FORMAT_UNK |
unknown format (usually for load) |
| FORMAT_DEF |
default format (usually for save) |
|
Constructor & Destructor Documentation
| PLMImage::PLMImage |
( |
u32 |
width = 0, |
|
|
u32 |
height = 0, |
|
|
u32 |
depth = 8 |
|
) |
|
|
|
|
Create a new image of size (width x height) and depth depth (in bits).
|
| PLMImage::PLMImage |
( |
PLMResFile & |
src, |
|
|
int |
format = PLMResource::FORMAT_UNK |
|
) |
|
|
|
|
Make a copy of image src (pixels are duplicated).
|
| PLMImage::PLMImage |
( |
PLMImage * |
src |
) |
|
|
|
|
Make a copy of image src (pixels are duplicated).
|
Member Function Documentation
| u8 * PLMImage::Pixels |
( |
|
) |
[inline] |
|
| u32 PLMImage::Width |
( |
|
) |
[inline] |
|
| u32 PLMImage::Height |
( |
|
) |
[inline] |
|
| u32 PLMImage::Pitch |
( |
|
) |
[inline] |
|
|
|
Width of a line in bytes (= width x bytes per pixel).
|
| u32 PLMImage::Depth |
( |
|
) |
[inline] |
|
|
|
Number of bits per pixel (8, 16, 24, 32).
|
| u32 PLMImage::Bpp |
( |
|
) |
[inline] |
|
|
|
Number of bytes per pixel (1, 2, 3, 4).
|
| void PLMImage::SetPalette |
( |
PLMPal * |
src, |
|
|
u32 |
first, |
|
|
u32 |
number |
|
) |
|
|
|
|
Change some colors in current palette (ignored if not 8 bits).
- Parameters:
-
| src |
palette to read new color values |
| first |
first color index to update |
| number |
number of colors to edit. |
|
| void PLMImage::ReplacePalette |
( |
PLMPal * |
src |
) |
|
|
|
|
Change current palette (ignored if not 8 bits).
|
| PLMPal * PLMImage::GetPalette |
( |
void |
|
) |
const [inline] |
|
|
|
Get the palette (NULL if not 8 bits).
|
| void PLMImage::SetClipping |
( |
s32 |
left, |
|
|
s32 |
top, |
|
|
s32 |
right, |
|
|
s32 |
bottom |
|
) |
|
|
|
|
Limit modifications to the given rectangle.
All parameters are coordinates (included). Affected methods: PutPixel(), XorPixel(), HLine(), VLine(), Line(), Frame(), Rectangle(), Gradient(), Circle(), Disk(), CopyImage(), DrawText(). |
| bool PLMImage::IsClipping |
( |
|
) |
|
|
| void PLMImage::GetClipping |
( |
s32 & |
left, |
|
|
s32 & |
top, |
|
|
s32 & |
right, |
|
|
s32 & |
bottom |
|
) |
[inline] |
|
|
|
Get current clipping rectangle (complete image if no clipping).
|
| void PLMImage::StopClipping |
( |
|
) |
|
|
|
|
Stop clipping (clipping rectangle is set to (0, 0, width-1, height-1).
|
| PLMColor PLMImage::GetPixel |
( |
s32 |
x, |
|
|
s32 |
y |
|
) |
const |
|
|
|
Get the color of a specific pixel (x, y).
|
| void PLMImage::PutPixel |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
PLMColor |
c |
|
) |
[inline] |
|
|
|
Change the color of the pixel at (x, y).
|
| void PLMImage::XorPixel |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
PLMColor |
c |
|
) |
[inline] |
|
|
|
Change the color of the pixel at (x, y) using a XOR operation.
|
| void PLMImage::HLine |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
u32 |
w, |
|
|
PLMColor |
c, |
|
|
DrawMode |
mode = DRAW_SET |
|
) |
|
|
|
|
Draw an horizontal line at (x, y) of width w, with color c.
|
| void PLMImage::VLine |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
u32 |
h, |
|
|
PLMColor |
c, |
|
|
DrawMode |
mode = DRAW_SET |
|
) |
|
|
|
|
Draw a vertical line at (x, y) of height h, with color c.
|
| void PLMImage::Line |
( |
s32 |
x1, |
|
|
s32 |
y1, |
|
|
s32 |
x2, |
|
|
s32 |
y2, |
|
|
PLMColor |
c, |
|
|
DrawMode |
mode = DRAW_SET |
|
) |
|
|
|
|
Draw any line from (x1, y1) to (x2, y2), with color c.
|
| void PLMImage::Frame |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
u32 |
w, |
|
|
u32 |
h, |
|
|
PLMColor |
c, |
|
|
DrawMode |
mode = DRAW_SET |
|
) |
|
|
|
|
Draw an empty rectangle at (x, y) of width w and height h, with color c.
|
| void PLMImage::Rectangle |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
u32 |
w, |
|
|
u32 |
h, |
|
|
PLMColor |
c, |
|
|
DrawMode |
mode = DRAW_SET |
|
) |
|
|
|
|
Draw an filled rectangle at (x, y) of width w and height h, with color c.
|
| void PLMImage::Fill |
( |
PLMColor |
c, |
|
|
DrawMode |
mode = DRAW_SET |
|
) |
[inline] |
|
|
|
Fill the drawable with color c.
|
| void PLMImage::Gradient |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
u32 |
w, |
|
|
u32 |
h, |
|
|
PLMColor |
c1, |
|
|
PLMColor |
c2, |
|
|
int |
type, |
|
|
DrawMode |
mode = DRAW_SET |
|
) |
|
|
|
|
Draw an filled rectangle at (x, y) of width w and height h, with a gradient from color c1 to c2, and type type.
|
| void PLMImage::Circle |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
s32 |
radius, |
|
|
PLMColor |
c, |
|
|
DrawMode |
mode = DRAW_SET |
|
) |
|
|
|
|
Draw a circle (empty) centered in (x, y), of radius radius and color c.
|
| void PLMImage::Disk |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
s32 |
radius, |
|
|
PLMColor |
c, |
|
|
DrawMode |
mode = DRAW_SET |
|
) |
|
|
|
|
Draw a disk (filled) centered in (x, y), of radius radius and color c.
|
| void PLMImage::DrawText |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
const char * |
text, |
|
|
PLMColor |
col, |
|
|
PLMFont * |
font, |
|
|
FontAlign |
yref = FONT_TOP, |
|
|
int |
nb = -1 |
|
) |
|
|
|
|
Draw the string text with font font (in 1 bit format).
- Parameters:
-
| x,y |
starting position |
| text |
string to draw |
| col |
the text color |
| font |
the font to use |
| yref |
vertical alignment (tells if (x,y) is the top, the bottom or the base of the line) |
| nb |
if not -1, only draw the first nb characters of text. |
|
| void PLMImage::DrawTextEx |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
const char * |
text, |
|
|
FontParams & |
infos, |
|
|
int |
nb = -1 |
|
) |
|
|
|
|
Draw the string text with font font (in 2 bit format = 4 colors).
|
| void PLMImage::CopyImage |
( |
s32 |
xdest, |
|
|
s32 |
ydest, |
|
|
PLMImage * |
src |
|
) |
[inline] |
|
|
|
Copy image src in current image at position (xdest, ydest).
|
| void PLMImage::CopyImage |
( |
s32 |
xdest, |
|
|
s32 |
ydest, |
|
|
PLMImage * |
src, |
|
|
s32 |
xsrc, |
|
|
s32 |
ysrc, |
|
|
u32 |
wsrc, |
|
|
u32 |
hsrc |
|
) |
|
|
|
|
Copy a part of an image in current image.
Copy rectangle at (xsrc, ysrc) of size (wsrc x hsrc) from src into position (xdest, ydest) of current image. |
| void PLMImage::CopyImage |
( |
s32 |
xdest, |
|
|
s32 |
ydest, |
|
|
PLMImage * |
src, |
|
|
const PLMRect & |
rect |
|
) |
[inline] |
|
|
|
Copy a part of an image in current image.
Copy rectangle defined by rect from src into current image, at position (xdest, ydest). |
| void PLMImage::TCopyImage |
( |
s32 |
xdest, |
|
|
s32 |
ydest, |
|
|
PLMColor |
c, |
|
|
PLMImage * |
src |
|
) |
[inline] |
|
|
|
Same as above, but do not copy any pixel of color c in source image.
|
| void PLMImage::TCopyImage |
( |
s32 |
xdest, |
|
|
s32 |
ydest, |
|
|
PLMColor |
c, |
|
|
PLMImage * |
src, |
|
|
s32 |
xsrc, |
|
|
s32 |
ysrc, |
|
|
u32 |
wsrc, |
|
|
u32 |
hsrc |
|
) |
|
|
|
|
Same as above, but do not copy any pixel of color c in source image.
|
| void PLMImage::TCopyImage |
( |
s32 |
xdest, |
|
|
s32 |
ydest, |
|
|
PLMColor |
c, |
|
|
PLMImage * |
src, |
|
|
const PLMRect & |
rect |
|
) |
[inline] |
|
|
|
Same as above, but do not copy any pixel of color c in source image.
|
| void PLMImage::MoveInside |
( |
s32 |
xfrom, |
|
|
s32 |
yfrom, |
|
|
u32 |
w, |
|
|
u32 |
h, |
|
|
s32 |
xto, |
|
|
s32 |
yto |
|
) |
|
|
|
|
Move a part of the image.
|
|
|
Vertical flip (reverse the image top<-->bottom).
|
| bool PLMImage::Resize |
( |
u32 |
width, |
|
|
u32 |
height |
|
) |
|
|
|
|
Change the size of the image.
If the new size is larger, new portions are filled with black (or palette index 0). If the new size is smaller, the image is cropped (= some data is lost) This method does not scale the image. width and height must be > 0. |
| bool PLMImage::NewFormat |
( |
u32 |
width, |
|
|
u32 |
height, |
|
|
u32 |
depth |
|
) |
|
|
|
|
Create a completely new image (size and depth).
Content is lost (random). - Parameters:
-
| width |
the new width (0 = no more image). |
| height |
the new height (0 = no more image). |
| depth |
number of bits per pixel (must be 8, 15, 16, 24 or 32). |
- Returns:
-
true on success (new image or no image), false on invalid depth.
|
| virtual bool PLMImage::Load |
( |
PLMResFile & |
f, |
|
|
int |
format = FORMAT_UNK |
|
) |
[virtual] |
|
|
|
Load data from the file src, using a specific format.
Implements PLMResource. |
| virtual bool PLMImage::Save |
( |
PLMResFile & |
f, |
|
|
int |
format = FORMAT_UNK |
|
) |
[virtual] |
|
|
|
Save data to the file dest, using a specific format.
Implements PLMResource. |
| virtual u32 PLMImage::MemoryUsed |
( |
|
) |
[virtual] |
|
|
|
Get the total amount of memory used by this resource.
Implements PLMResource. |
| void PLMImage::PrintInfo |
( |
|
) |
|
|
|
|
Print some informations on current log.
|
| virtual bool PLMResource::LoadName |
( |
const char * |
filename, |
|
|
int |
format = FORMAT_UNK |
|
) |
[virtual, inherited] |
|
|
|
Load data from the file filename.
Reimplemented in PLMMusic. |
| virtual bool PLMResource::SaveName |
( |
const char * |
filename, |
|
|
int |
format = FORMAT_DEF |
|
) |
[virtual, inherited] |
|
|
|
Save data to the file filename.
|
The documentation for this class was generated from the following file:
Generated by
Doxygen 1.2.18 on Tue Oct 26 12:07:38 2004.
|