#include <wx/msw/dibutils.h>
extern "C" {
-#include "png.h"
+#include "../png/png.h"
}
extern "C" void png_read_init PNGARG((png_structp png_ptr));
imageOK = FALSE;
}
-wxPNGReader::wxPNGReader ( char* ImageFileName )
+wxPNGReader::wxPNGReader ( wxChar* ImageFileName )
{
imageOK = FALSE;
filetype = 0;
}
RawImage = 0;
Palette = 0;
- if (lpbi = DibCreate(Depth, Width, Height)) {
+ lpbi = DibCreate(Depth, Width, Height);
+ if (lpbi) {
RawImage = (ImagePointerType)DibPtr(lpbi);
EfeWidth = (long)(((long)Width*Depth + 31) / 32) * 4;
imageOK = TRUE;
if ( Palette )
{
- HPALETTE oldPal = ::SelectPalette(dc, (HPALETTE) Palette->GetHPALETTE(), FALSE);
+ ::SelectPalette(dc, (HPALETTE) Palette->GetHPALETTE(), FALSE);
::RealizePalette(dc);
}
return mask;
}
-bool wxPNGReader::ReadFile(char * ImageFileName)
+bool wxPNGReader::ReadFile(wxChar * ImageFileName)
{
int number_passes;
if (ImageFileName)
- strcpy(filename, ImageFileName);
+ wxStrcpy(filename, ImageFileName);
FILE *fp;
png_struct *png_ptr;
wxPNGReaderIter iter(this);
/* open the file */
- fp = fopen(filename, "rb");
+ fp = fopen(wxConvFile.cWX2MB(filename), "rb");
if (!fp)
return FALSE;
/* write a png file */
-bool wxPNGReader::SaveFile(char * ImageFileName)
+bool wxPNGReader::SaveFile(wxChar * ImageFileName)
{
if (ImageFileName)
- strcpy(filename, ImageFileName);
+ wxStrcpy(filename, ImageFileName);
wxPNGReaderIter iter(this);
FILE *fp;
png_info *info_ptr;
/* open the file */
- fp = fopen(filename, "wb");
+ fp = fopen(wxConvFile.cWX2MB(filename), "wb");
if (!fp)
return FALSE;
}
-bool wxPNGReader::SaveXPM(char *filename, char *name)
+bool wxPNGReader::SaveXPM(wxChar *filename, wxChar *name)
{
- char nameStr[256];
+ wxChar nameStr[256];
if ( name )
- strcpy(nameStr, name);
+ wxStrcpy(nameStr, name);
else
{
- strcpy(nameStr, filename);
+ wxStrcpy(nameStr, filename);
wxStripExtension(nameStr);
}
if ( !GetPalette() )
return FALSE;
- ofstream str(filename);
+ ofstream str(wxConvFile.cWX2MB(filename));
if ( str.bad() )
return FALSE;
int desiredWidth, int desiredHeight)
{
wxPNGReader reader;
- if (reader.ReadFile((char*) (const char*) name))
+ if (reader.ReadFile(WXSTRINGCAST name))
{
return reader.InstantiateBitmap(bitmap);
}