Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
vtImage Class Reference

#include <ImageOSG.h>

Inheritance diagram for vtImage:
vtBitmapBase vtImageGeo

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
 
vtBitmapGetBitmap ()
 
void GetProjection (vtProjection &proj) const
 
vtProjectionGetAtProjection ()
 
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
 
BitmapInfoGetBitmapInfo (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)
 
- Public Member Functions inherited from vtBitmapBase
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< BitmapInfom_Bitmaps
 
int m_iTotal
 
int m_iCompleted
 
ImageGLCanvas * m_pCanvas
 

Detailed Description

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().

Member Function Documentation

bool vtImage::GetColorSolid ( const DPoint2 p,
RGBi rgb,
double  dRes = 0.0 
)

Sample image color at a given point, assuming that the pixels are solid.

Returns
true if a value was found, false if the point is outside the extent or (if the option is enabled) the value was 'nodata'.
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.

Parameters
proj_newThe new projection to convert to.
Returns
True if successful.
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.


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