fixed to the IFF handler, moved into one file
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13613 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -79,6 +79,7 @@ enum wxBitmapType
|
||||
wxBITMAP_TYPE_ICON,
|
||||
wxBITMAP_TYPE_ICON_RESOURCE,
|
||||
wxBITMAP_TYPE_ANI,
|
||||
wxBITMAP_TYPE_IFF,
|
||||
wxBITMAP_TYPE_MACCURSOR,
|
||||
wxBITMAP_TYPE_MACCURSOR_RESOURCE,
|
||||
wxBITMAP_TYPE_ANY = 50
|
||||
|
@@ -1,94 +0,0 @@
|
||||
//
|
||||
// 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
|
||||
|
@@ -1,52 +1,47 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagiff.h
|
||||
// Purpose: wxImage handler for Amiga IFF images
|
||||
// Author: Steffen Gutmann
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Steffen Gutmann, 2002
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef WX_IMAGE_IFF_H
|
||||
#define WX_IMAGE_IFF_H
|
||||
#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
|
||||
#if wxUSE_IMAGE && 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";
|
||||
m_name = wxT("IFF file");
|
||||
m_extension = wxT("iff");
|
||||
m_type = wxBITMAP_TYPE_IFF;
|
||||
m_mime = wxT("image/x-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 LoadFile(wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1);
|
||||
virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=TRUE);
|
||||
virtual bool DoCanRead(wxInputStream& stream);
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif // wxUSE_IMAGE && wxUSE_IFF
|
||||
|
||||
#endif // _WX_IMAGE_IFF_H_
|
||||
|
Reference in New Issue
Block a user