#include <ImageOSG.h>
Public Member Functions | |
vtImage (const DRECT &area, int xsize, int ysize, const vtProjection &proj) | |
bool | GetExtent (DRECT &rect) const |
void | SetExtent (const DRECT &rect) |
void | DrawToView (wxDC *pDC, vtScaledView *pView) |
bool | ConvertProjection (vtImage *input, vtProjection &proj_new, int iSampleN, bool progress_callback(int)=NULL) |
DPoint2 | GetSpacing (int bitmap=0) const |
vtBitmap * | GetBitmap () |
void | GetProjection (vtProjection &proj) const |
vtProjection & | GetAtProjection () |
void | SetProjection (const vtProjection &proj) |
bool | ReprojectExtents (const vtProjection &proj_new) |
void | GetDimensions (int &xsize, int &ysize) const |
IPoint2 | GetDimensions () const |
bool | GetColorSolid (const DPoint2 &p, RGBi &rgb, double dRes=0.0) |
bool | GetMultiSample (const DPoint2 &p, const DLine2 &offsets, RGBi &rgb, double dRes=0.0) |
void | GetRGB (int x, int y, RGBi &rgb, double dRes=0.0) |
void | SetRGB (int x, int y, uchar r, uchar g, uchar b) |
void | SetRGB (int x, int y, const RGBi &rgb) |
void | ReplaceColor (const RGBi &rgb1, const RGBi &rgb2) |
void | SetupBitmapInfo (int iXSize, int iYSize) |
bool | ReadPPM (const char *fname, bool progress_callback(int)=NULL) |
bool | WritePPM (const char *fname) const |
bool | SaveToFile (const char *fname) const |
bool | ReadPNGFromMemory (uchar *buf, int len) |
bool | LoadFromGDAL (const char *fname) |
bool | CreateOverviews () |
bool | ReadFeaturesFromTerraserver (const DRECT &area, int iTheme, int iMetersPerPixel, int iUTMZone, const char *filename) |
bool | WriteGridOfTilePyramids (TilingOptions &opts, BuilderView *pView) |
bool | WriteTile (const TilingOptions &opts, BuilderView *pView, vtString &dirname, DRECT &tile_area, DPoint2 &tile_dim, int col, int row, int lod) |
size_t | NumBitmaps () const |
BitmapInfo & | GetBitmapInfo (size_t i) |
int | NumBitmapsInMemory () |
int | NumBitmapsOnDisk () |
void | AllocMipMaps () |
void | DrawMipMaps () |
void | FreeMipMaps () |
vtImage (class vtDIB *pDIB) | |
vtImage (vtImage *copyfrom) | |
bool | Create (int width, int height, int bitdepth, bool create_palette=false) |
bool | WritePNG (const char *fname, bool progress_callback(int)=NULL) |
bool | WriteJPEG (const char *fname, int quality=99, bool progress_callback(int)=NULL) |
bool | HasData () |
void | Scale (int w, int h) |
std::string | GetFilename () const |
Return the name of the file, if any, from which the image was loaded. | |
uchar | GetPixel8 (int x, int y) const |
void | GetPixel24 (int x, int y, RGBi &rgb) const |
void | GetPixel32 (int x, int y, RGBAi &rgba) const |
void | SetPixel8 (int x, int y, uchar color) |
void | SetPixel24 (int x, int y, const RGBi &rgb) |
void | SetPixel32 (int x, int y, const RGBAi &rgba) |
uint | GetWidth () const |
uint | GetHeight () const |
uint | GetDepth () const |
uchar * | GetData () |
uchar * | GetRowData (int row) |
![]() | |
void | ScalePixel8 (int x, int y, float fScale) |
void | ScalePixel24 (int x, int y, float fScale) |
void | ScalePixel32 (int x, int y, float fScale) |
void | BlitTo (vtBitmapBase &target, int x, int y) |
Public Attributes | |
GDALDataset * | m_pDataset |
LineBufferGDAL | m_linebuf |
Static Public Attributes | |
static bool | bTreatBlackAsTransparent = false |
Protected Member Functions | |
void | SetDefaults () |
void | CleanupGDALUsage () |
void | _BasicInit () |
void | _CreateFromDIB (vtDIB *pDIB, bool b16bit=false) |
bool | _ReadPNG (const char *filename) |
Protected Attributes | |
vtProjection | m_proj |
DRECT | m_Extents |
std::vector< BitmapInfo > | m_Bitmaps |
int | m_iTotal |
int | m_iCompleted |
ImageGLCanvas * | m_pCanvas |
This class extends osg::Image with an interface to support vtdata's Bitmap operations and use vtdata's vtDIB. It is useful for creating images in memory.
If you are going to use OSG to load an image from disk, you must use osg::Image instead, which can be loaded with osgDB::readImageFile.
A common use for an image is as a texture map for a textured material, by passing it to vtMaterial::SetTexture().
Sample image color at a given point, assuming that the pixels are solid.
bool vtImage::GetMultiSample | ( | const DPoint2 & | p, |
const DLine2 & | offsets, | ||
RGBi & | rgb, | ||
double | dRes = 0.0 |
||
) |
Get image color by sampling several points and averaging them. The area to test is given by center and offsets, use MakeSampleOffsets() to make a set of N x N offsets.
bool vtImage::ReprojectExtents | ( | const vtProjection & | proj_new) |
Reprojects an image by converting just the extents to a new projection.
This is much faster than creating a new grid and reprojecting every heixel, but it only produces correct results when the difference between the projections is only a horizontal shift. For example, this occurs when the only difference between the old and new projection is choice of Datum.
proj_new | The new projection to convert to. |
bool vtImage::WriteJPEG | ( | const char * | fname, |
int | quality = 99 , |
||
bool | progress_callbackint = NULL |
||
) |
Write this image to a JPEG file. Quality setting is the same as libjpeg, in the range of 0..100. 99 is a typically useful quality setting.