dc.DrawText( "PNM handler", 30, 1285 );
if (my_horse_pnm && my_horse_pnm->Ok()) dc.DrawBitmap( *my_horse_pnm, 30, 1300 );
- dc.DrawText( "TIFF handler", 30, 1415 );
- if (my_horse_tiff && my_horse_tiff->Ok()) dc.DrawBitmap( *my_horse_pnm, 30, 1430 );
+ dc.DrawText( "TIFF handler", 30, 1515 );
+ if (my_horse_tiff && my_horse_tiff->Ok()) dc.DrawBitmap( *my_horse_pnm, 30, 1530 );
}
void MyCanvas::CreateAntiAliasedBitmap()
{
wxInputStream *stream = (wxInputStream*) handle;
stream->Read( (void*) buf, (size_t) size );
- if (!*stream) return 0;
- return size;
+ return stream->LastRead();
}
static tsize_t
{
wxOutputStream *stream = (wxOutputStream*) handle;
stream->Write( (void*) buf, (size_t) size );
- if (!*stream) return 0;
- return size;
+ return stream->LastWrite();
}
static toff_t
_tiffSizeProc(thandle_t handle)
{
wxInputStream *stream = (wxInputStream*) handle;
- long fsize;
- return ((fsize = stream->SeekI(0, wxFromEnd)) < 0 ? 0 : fsize);
+ return (toff_t) stream->GetSize();
}
static int
{
image->Destroy();
- TIFF *tif = TIFFwxOpen( stream, "horse.tif", "r" );
+ TIFF *tif = TIFFwxOpen( stream, "image", "r" );
if (!tif)
{
bool wxTIFFHandler::DoCanRead( wxInputStream& stream )
{
- return TRUE;
-
-/*
- unsigned char hdr[4];
+ unsigned char hdr[2];
- stream.Read(&hdr, 4);
- stream.SeekI(-4, wxFromCurrent);
- return (hdr[0] == 'T' && hdr[1] == 'I' && hdr[2] == 'F' && hdr[3] == 'F');
-*/
+ stream.Read(&hdr, 2);
+ stream.SeekI(-2, wxFromCurrent);
+
+ return ((hdr[0] == 0x49 && hdr[1] == 0x49) ||
+ (hdr[0] == 0x4D && hdr[1] == 0x4D));
}
void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window )
{
+/*
wxString tmp = name;
tmp += wxT(" FROM ");
tmp += window;
gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
GTK_SIGNAL_FUNC(gtk_debug_focus_in_callback), (gpointer)s );
+*/
}
#endif // Debug
void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window )
{
+/*
wxString tmp = name;
tmp += wxT(" FROM ");
tmp += window;
gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
GTK_SIGNAL_FUNC(gtk_debug_focus_in_callback), (gpointer)s );
+*/
}
#endif // Debug