9 #include "vtdata/vtDIB.h"
13 #include <osgDB/ReadFile>
32 bool Create(
int width,
int height,
int bitdepth,
bool create_palette =
false);
33 bool WritePNG(
const char *fname,
bool progress_callback(
int) = NULL);
34 bool WriteJPEG(
const char *fname,
int quality = 99,
bool progress_callback(
int) = NULL);
35 bool HasData() {
return valid() && data() != NULL; }
36 void Scale(
int w,
int h);
42 uchar GetPixel8(
int x,
int y)
const;
43 void GetPixel24(
int x,
int y,
RGBi &rgb)
const;
44 void GetPixel32(
int x,
int y,
RGBAi &rgba)
const;
46 void SetPixel8(
int x,
int y, uchar color);
47 void SetPixel24(
int x,
int y,
const RGBi &rgb);
48 void SetPixel32(
int x,
int y,
const RGBAi &rgba);
50 uint GetWidth()
const;
51 uint GetHeight()
const;
52 uint GetDepth()
const;
54 uchar *GetData() {
return data(); }
55 uchar *GetRowData(
int row) {
return data(0, row); }
60 void _CreateFromDIB(
vtDIB *pDIB,
bool b16bit =
false);
61 bool _ReadPNG(
const char *filename);
63 typedef osg::ref_ptr<vtImage> vtImagePtr;
64 typedef osg::ref_ptr<osg::Image> ImagePtr;
77 uchar GetPixel8(
int x,
int y)
const;
78 void GetPixel24(
int x,
int y,
RGBi &rgb)
const;
79 void GetPixel32(
int x,
int y,
RGBAi &rgba)
const;
81 void SetPixel8(
int x,
int y, uchar color);
82 void SetPixel24(
int x,
int y,
const RGBi &rgb);
83 void SetPixel32(
int x,
int y,
const RGBAi &rgba);
85 uint GetWidth()
const {
return m_image->s(); }
86 uint GetHeight()
const {
return m_image->t(); }
87 uint GetDepth()
const {
return m_image->getPixelSizeInBits(); }
89 uchar *GetData() {
return m_image->data(); }
90 uchar *GetRowData(
int row) {
return m_image->data(0, row); }
96 uchar GetPixel8(
const osg::Image *image,
int x,
int y);
97 void GetPixel24(
const osg::Image *image,
int x,
int y,
RGBi &rgb);
98 void GetPixel32(
const osg::Image *image,
int x,
int y,
RGBAi &rgba);
99 void SetPixel8(osg::Image *image,
int x,
int y, uchar color);
100 void SetPixel24(osg::Image *image,
int x,
int y,
const RGBi &rgb);
101 void SetPixel32(osg::Image *image,
int x,
int y,
const RGBAi &rgba);
102 uint GetWidth(
const osg::Image *image);
103 uint GetHeight(
const osg::Image *image);
104 uint GetDepth(
const osg::Image *image);
105 void Set16BitInternal(osg::Image *image,
bool bFlag);
114 bool ReadTIF(
const char *filename,
bool progress_callback(
int) = NULL);
115 void ReadExtents(
const char *filename);
120 DRECT &GetExtents() {
return m_extents; }
127 typedef osg::ref_ptr<vtImageGeo> vtImageGeoPtr;
129 bool vtImageInfo(
const char *filename,
int &width,
int &height,
int &depth);
131 #endif // VTOSG_IMAGEH