Added IFF handler.
Minor doc updates. Corrected configure for SGI OpenGL (wx-config related). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
94
include/wx/iffdecod.h
Normal file
94
include/wx/iffdecod.h
Normal file
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// iffdecod.h - image handler for IFF/ILBM images
|
||||
//
|
||||
// (c) Steffen Gutmann, 2002
|
||||
//
|
||||
// Creation date: 08.01.2002
|
||||
// Last modified: 12.01.2002
|
||||
//
|
||||
|
||||
#ifndef WX_IIF_DECODE_H
|
||||
#define WX_IIF_DECODE_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "iffdecod.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
#define wxUSE_IFF 1
|
||||
|
||||
#if wxUSE_STREAMS && wxUSE_IFF
|
||||
|
||||
#include "wx/stream.h"
|
||||
#include "wx/image.h"
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Constants
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Error codes:
|
||||
// Note that the error code wxIFF_TRUNCATED means that the image itself
|
||||
// is most probably OK, but the decoder didn't reach the end of the data
|
||||
// stream; this means that if it was not reading directly from file,
|
||||
// the stream will not be correctly positioned.
|
||||
//
|
||||
|
||||
enum
|
||||
{
|
||||
wxIFF_OK = 0, /* everything was OK */
|
||||
wxIFF_INVFORMAT, /* error in iff header */
|
||||
wxIFF_MEMERR, /* error allocating memory */
|
||||
wxIFF_TRUNCATED /* file appears to be truncated */
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// wxIFFDecoder class
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// internal class for storing IFF image data
|
||||
class IFFImage
|
||||
{
|
||||
public:
|
||||
unsigned int w; /* width */
|
||||
unsigned int h; /* height */
|
||||
int transparent; /* transparent color (-1 = none) */
|
||||
int colors; /* number of colors */
|
||||
unsigned char *p; /* bitmap */
|
||||
unsigned char *pal; /* palette */
|
||||
|
||||
IFFImage() : w(0), h(0), colors(0), p(0), pal(0) {}
|
||||
~IFFImage() { delete [] p; delete [] pal; }
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxIFFDecoder
|
||||
{
|
||||
private:
|
||||
IFFImage *m_image; // image data
|
||||
wxInputStream *m_f; // input stream
|
||||
unsigned char *databuf;
|
||||
unsigned char *picptr;
|
||||
unsigned char *decomp_mem;
|
||||
|
||||
void Destroy();
|
||||
|
||||
public:
|
||||
// get data of current frame
|
||||
unsigned char* GetData() const;
|
||||
unsigned char* GetPalette() const;
|
||||
int GetNumColors() const;
|
||||
unsigned int GetWidth() const;
|
||||
unsigned int GetHeight() const;
|
||||
int GetTransparentColour() const;
|
||||
|
||||
// constructor, destructor, etc.
|
||||
wxIFFDecoder(wxInputStream *s);
|
||||
~wxIFFDecoder() { Destroy(); }
|
||||
bool CanRead();
|
||||
int ReadIFF();
|
||||
bool ConvertToImage(wxImage *image) const;
|
||||
};
|
||||
|
||||
|
||||
#endif // wxUSE_STREAM && wxUSE_IFF
|
||||
#endif // _WX_IFFDECOD_H
|
||||
|
@@ -266,6 +266,7 @@ WXDLLEXPORT_DATA(extern wxImage) wxNullImage;
|
||||
#include "wx/imagtiff.h"
|
||||
#include "wx/imagpnm.h"
|
||||
#include "wx/imagxpm.h"
|
||||
#include "wx/imagiff.h"
|
||||
|
||||
#endif // wxUSE_IMAGE
|
||||
|
||||
|
52
include/wx/imagiff.h
Normal file
52
include/wx/imagiff.h
Normal file
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// imgiff.h - image handler for Amiga IFF images
|
||||
// parts of the source taken by xv source code.
|
||||
//
|
||||
// (c) Steffen Gutmann, 2002
|
||||
//
|
||||
// Creation date: 08.01.2002
|
||||
// Last modified: 08.01.2002
|
||||
//
|
||||
|
||||
#ifndef WX_IMAGE_IFF_H
|
||||
#define WX_IMAGE_IFF_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "imagiff.h"
|
||||
#endif
|
||||
|
||||
#include "wx/image.h"
|
||||
#define wxUSE_IFF 1
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxIFFHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_IFF
|
||||
|
||||
class WXDLLEXPORT wxIFFHandler : public wxImageHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxIFFHandler)
|
||||
|
||||
public:
|
||||
|
||||
wxIFFHandler()
|
||||
{
|
||||
m_name = "IFF file";
|
||||
m_extension = "iff";
|
||||
m_type = wxBITMAP_TYPE_ANY;
|
||||
// m_mime = "image/iff";
|
||||
};
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
virtual bool LoadFile(wxImage *image, wxInputStream& stream,
|
||||
bool verbose=TRUE, int index=0);
|
||||
virtual bool SaveFile(wxImage *image, wxOutputStream& stream,
|
||||
bool verbose=TRUE);
|
||||
virtual bool DoCanRead(wxInputStream& stream);
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -866,6 +866,9 @@
|
||||
// Set to 1 for PCX format support
|
||||
#define wxUSE_PCX 1
|
||||
|
||||
// Set to 1 for IFF format support
|
||||
#define wxUSE_IFF 1
|
||||
|
||||
// Set to 1 for XPM format support
|
||||
#define wxUSE_XPM 1
|
||||
|
||||
|
@@ -931,6 +931,9 @@
|
||||
// Set to 1 for PCX format support
|
||||
#define wxUSE_PCX 1
|
||||
|
||||
// Set to 1 for IFF format support
|
||||
#define wxUSE_IFF 1
|
||||
|
||||
// Set to 1 for XPM format support
|
||||
#define wxUSE_XPM 1
|
||||
|
||||
|
@@ -918,6 +918,9 @@
|
||||
// Set to 1 for PCX format support
|
||||
#define wxUSE_PCX 0
|
||||
|
||||
// Set to 1 for IFF format support
|
||||
#define wxUSE_IFF 0
|
||||
|
||||
// Set to 1 for XPM format support
|
||||
#define wxUSE_XPM 1
|
||||
|
||||
|
@@ -247,6 +247,8 @@
|
||||
// Set to 1 for PNM format support
|
||||
#define wxUSE_PCX 1
|
||||
// Set to 1 for PCX format support
|
||||
#define wxUSE_IFF 1
|
||||
// Set to 1 for IFF format support
|
||||
#define wxUSE_XPM 1
|
||||
// Set to 1 for XPM format support
|
||||
|
||||
|
Reference in New Issue
Block a user