#include <TexturePage.h>
Public Types | |
| enum | { FREE = 0 , USED = 1 } |
| enum | { READY = 0x00000001 , PAGE_ERROR = 0x00000002 , CANT_ALLOCATE_PACKED_IMAGE = 0x00000004 , CANT_ADD_IMAGE_DATA = 0x00000008 , NO_TEXTURE_DATA = 0x00000010 , ERROR_DURING_SAVE = 0x00000020 } |
Public Member Functions | |
| TexturePage (Int width, Int height) | |
| ~TexturePage (void) | |
| Bool | addImage (ImageInfo *image) |
| try to add image to this page | |
| void | setID (Int id) |
| set page id | |
| Int | getID (void) |
| get page id | |
| Bool | generateTexture (void) |
| generate the final packed texture | |
| Bool | writeFile (char *baseFilename) |
| write generated texture to file | |
| ImageInfo * | getFirstImage (void) |
| get the first image in the list | |
| Int | getWidth (void) |
| get width of texture page | |
| Int | getHeight (void) |
| get height of texture page | |
| void | getPixel (Int x, Int y, Byte *r, Byte *g, Byte *b, Byte *a=NULL) |
Public Attributes | |
| TexturePage * | m_next |
| TexturePage * | m_prev |
| UnsignedInt | m_status |
| status bits | |
Protected Member Functions | |
| Bool | spotUsed (Int x, Int y) |
| is this spot used | |
| Bool | lineUsed (Int sx, Int sy, Int ex, Int ey) |
| is any spot on the line used | |
| UnsignedInt | buildFitRegion (IRegion2D *region, Int startX, Int startY, Int imageWidth, Int imageHeight, Int *xGutter, Int *yGutter, Bool allSidesBorder) |
| build a region to try to fit given the position, size, and border options | |
| void | markRegionUsed (IRegion2D *region) |
| mark this region as used | |
| Bool | addImageData (Byte *destBuffer, Int destWidth, Int destHeight, Int destBPP, ImageInfo *image) |
| add the actual image data of 'image' to the destination buffer | |
| void | extendImageEdges (Byte *destBuffer, Int destWidth, Int destHeight, Int destBPP, ImageInfo *image, Bool extendAlpha) |
| extend edges of image outward into border if present | |
| void | extendToRowIfOpen (char *src, Int buffWidth, Int buffBPP, Bool extendAlpha, Int imageHeight, UnsignedInt fitBits, Int srcX, Int srcY) |
| if the pixel at abolve/below row is open, extend pixel at src to its location | |
Protected Attributes | |
| Int | m_id |
| texture page ID | |
| ICoord2D | m_size |
| dimensions of texture page | |
| UnsignedByte * | m_canvas |
| as big as the texture page, a used spot is non zero | |
| ImageInfo * | m_imageList |
| list of images packed on this page | |
| Byte * | m_packedImage |
| final generated image data | |
| Targa * | m_targa |
| final packed image all in a nice little targa file | |
A texture page continaing multiple source images
Definition at line 65 of file TexturePage.h.
| anonymous enum |
| Enumerator | |
|---|---|
| FREE | open pixel in the cavas |
| USED | used pixel in the canvas |
Definition at line 70 of file TexturePage.h.
| anonymous enum |
Definition at line 76 of file TexturePage.h.
Definition at line 851 of file TexturePage.cpp.
| TexturePage::~TexturePage | ( | void | ) |
Definition at line 874 of file TexturePage.cpp.
try to add image to this page
If this image will fit on this page, add it
Definition at line 894 of file TexturePage.cpp.
|
protected |
add the actual image data of 'image' to the destination buffer
Add the actual image data from 'image' to the destination buffer at the coordinates specified in the 'image' ... this puts the actual packed image data on the final texture page
NOTE that we have created our texture page regions with the assumption that we were packing images with an upper left corner at (0,0), but the targa files have the origin in the lower left corner ... thus the translation here to shift source images into the right positions
Definition at line 509 of file TexturePage.cpp.
|
protected |
build a region to try to fit given the position, size, and border options
Build an image region to try to fit into the page based on the location given, with the image size, the gutter sizes, and the all sides border size
Note that x and y Gutter sizes can be changed as a result of this method
Returns a set of "fit bits" that describe what the components have been included in the region constructed
Definition at line 756 of file TexturePage.cpp.
|
protected |
extend edges of image outward into border if present
We want to extend the image data in destBuffer at the location region of image->m_pagePos in "outward" directions, effectively bleeding the edges outward.
Note we will not extend outward from the image region UNLESS we have a border present on that side (described in the image->m_fitBits for the region image->m_pagePos).
Definition at line 223 of file TexturePage.cpp.
|
protected |
if the pixel at abolve/below row is open, extend pixel at src to its location
If the pixel at location 'row' is "open", then extend the pixel at 'src' to that location
NOTE this assumes 'src' and 'row' are pointers into the same buffer and the bits per pixel (buffBPP) are treated as the same for both
Definition at line 72 of file TexturePage.cpp.
| Bool TexturePage::generateTexture | ( | void | ) |
generate the final packed texture
Generate the final packed texture given all the images that have already been assigned to this page
Definition at line 1176 of file TexturePage.cpp.
|
inline |
get the first image in the list
Definition at line 165 of file TexturePage.h.
|
inline |
get height of texture page
Definition at line 167 of file TexturePage.h.
|
inline |
get page id
Definition at line 164 of file TexturePage.h.
Get the RGB pixel stored at location (x,y) (where (0,0) is the upper left corner of the image ... even though the internal targa isn't stored that way
Definition at line 1313 of file TexturePage.cpp.
|
inline |
get width of texture page
Definition at line 166 of file TexturePage.h.
is any spot on the line used
Is there ANY spot in the line specified that is used
Definition at line 698 of file TexturePage.cpp.
|
protected |
|
inline |
set page id
Definition at line 163 of file TexturePage.h.
is this spot used
Is this spot in the texture page open?
Definition at line 688 of file TexturePage.cpp.
| Bool TexturePage::writeFile | ( | char * | baseFilename | ) |
write generated texture to file
Write the texture data that has already been generated to a file starting with the baseName passed in with the texture id of this texture page appended to the end of it
Definition at line 1269 of file TexturePage.cpp.
|
protected |
as big as the texture page, a used spot is non zero
Definition at line 151 of file TexturePage.h.
|
protected |
texture page ID
Definition at line 149 of file TexturePage.h.
|
protected |
list of images packed on this page
Definition at line 153 of file TexturePage.h.
| TexturePage* TexturePage::m_next |
Definition at line 105 of file TexturePage.h.
|
protected |
final generated image data
Definition at line 155 of file TexturePage.h.
| TexturePage* TexturePage::m_prev |
Definition at line 106 of file TexturePage.h.
|
protected |
dimensions of texture page
Definition at line 150 of file TexturePage.h.
| UnsignedInt TexturePage::m_status |
status bits
Definition at line 108 of file TexturePage.h.
|
protected |
final packed image all in a nice little targa file
Definition at line 156 of file TexturePage.h.