/*
- * File: pngread.h
- * Purpose: PNG file reader
- * Author: Alejandro Aguilar Sierra/Julian Smart
- * Created: 1995
- * Copyright: (c) 1995, Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
+ * File: wx/os2/pngread.h
+ * Purpose: PNG file reader
+ * Author: Alejandro Aguilar Sierra/Julian Smart
+ * Created: 1995
+ * Copyright: (c) 1995, Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
*
*
*/
typedef struct
{
- byte red;
- byte green;
- byte blue;
+ byte red;
+ byte green;
+ byte blue;
} rgb_color_struct;
-#define COLORTYPE_PALETTE 1
-#define COLORTYPE_COLOR 2
-#define COLORTYPE_ALPHA 4
+#define COLORTYPE_PALETTE 1
+#define COLORTYPE_COLOR 2
+#define COLORTYPE_ALPHA 4
class wxPNGReader
{
long EfeWidth; // Efective Width
- LPBITMAPINFOHEADER lpbi;
+ BITMAPINFOHEADER2* lpbi;
int bgindex;
wxPalette* Palette;
bool imageOK;
bool ReadFile( wxChar* ImageFileName=0 );
bool SaveFile( wxChar* ImageFileName=0 );
bool SaveXPM(wxChar *filename, wxChar *name = 0);
- int GetWidth( void ) const { return Width; };
- int GetHeight( void ) const { return Height; };
- int GetDepth( void ) const { return Depth; };
- int GetColorType( void ) const { return ColorType; };
+ int GetWidth( void ) const { return Width; }
+ int GetHeight( void ) const { return Height; }
+ int GetDepth( void ) const { return Depth; }
+ int GetColorType( void ) const { return ColorType; }
int GetIndex(int x, int y);
bool GetRGB(int x, int y, byte* r, byte* g, byte* b);
virtual bool InstantiateBitmap(wxBitmap *bitmap);
wxMask *CreateMask(void);
- inline bool Ok(void) { return imageOK; }
+ inline bool Ok() const { return IsOk(); }
+ inline bool IsOk(void) { return imageOK; }
};
class wxPNGReaderIter
wxPNGReaderIter::wxPNGReaderIter(wxPNGReader *imax): ima(imax)
{
if (ima)
- IterImage = ima->RawImage;
+ IterImage = ima->RawImage;
Itx = Ity = 0;
Stepx = Stepy = 0;
}
bool wxPNGReaderIter::ItOK ()
{
if (ima)
- return ima->Inside(Itx, Ity);
+ return ima->Inside(Itx, Ity);
else
- return FALSE;
+ return FALSE;
}
// Here should be bcopy or memcpy
//_fmemcpy(IterImage, (void far *)buf, n);
if (n<0)
- n = ima->GetWidth();
+ n = ima->GetWidth();
for (int i=0; i<n; i++) IterImage[i] = buf[i];
}
Itx -= Stepx;
if (Itx >= 0)
return 1;
- else {
+ else {
Ity -= Stepy;
if (Ity >= 0 && Ity < ima->Height)
{
}
#endif
-
+ // _WX_PNGREAD__