projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added wx[W]CharBuffer/wxCStrData overloads to remaining wxString methods that need...
[wxWidgets.git]
/
include
/
wx
/
rawbmp.h
diff --git
a/include/wx/rawbmp.h
b/include/wx/rawbmp.h
index 105c85714cfdc286c119da95be01d7edb45ad0d5..d91754c8790a7fc59f20dbb1021341743a103408 100644
(file)
--- a/
include/wx/rawbmp.h
+++ b/
include/wx/rawbmp.h
@@
-5,13
+5,15
@@
// Modified by:
// Created: 10.03.03
// RCS-ID: $Id$
// Modified by:
// Created: 10.03.03
// RCS-ID: $Id$
-// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwi
ndow
s.org>
+// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwi
dget
s.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RAWBMP_H_BASE_
#define _WX_RAWBMP_H_BASE_
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RAWBMP_H_BASE_
#define _WX_RAWBMP_H_BASE_
+#include "wx/image.h"
+
// ----------------------------------------------------------------------------
// Abstract Pixel API
//
// ----------------------------------------------------------------------------
// Abstract Pixel API
//
@@
-69,10
+71,12
@@
}
*/
}
*/
-#ifdef __VISUALC__
- // VC++ gives an absolutely harmless warning for wxPixelData<wxBitmap> ctor
- #pragma warning(disable: 4355) // 'this' used in initializer list
-#endif
+/*
+ Note: we do not use WXDLLEXPORT with classes in this file because VC++ has
+ problems with exporting inner class defined inside a specialization of a
+ template class from a DLL. Besides, as all the methods are inline it's not
+ really necessary to put them in DLL at all.
+ */
// ----------------------------------------------------------------------------
// wxPixelFormat
// ----------------------------------------------------------------------------
// wxPixelFormat
@@
-105,7
+109,7
@@
template <class Channel,
size_t Bpp, int R, int G, int B, int A = -1,
class Pixel = wxUint32>
size_t Bpp, int R, int G, int B, int A = -1,
class Pixel = wxUint32>
-struct
WXDLLEXPORT
wxPixelFormat
+struct wxPixelFormat
{
// iterator over pixels is usually of type "ChannelType *"
typedef Channel ChannelType;
{
// iterator over pixels is usually of type "ChannelType *"
typedef Channel ChannelType;
@@
-144,7
+148,7
@@
typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxImagePixelFormat;
// the (most common) native bitmap format without alpha support
#if defined(__WXMSW__)
// the (most common) native bitmap format without alpha support
#if defined(__WXMSW__)
- // under MSW the RGB components are
in
versed, they're in BGR order
+ // under MSW the RGB components are
re
versed, they're in BGR order
typedef wxPixelFormat<unsigned char, 24, 2, 1, 0> wxNativePixelFormat;
#define wxPIXEL_FORMAT_ALPHA 3
typedef wxPixelFormat<unsigned char, 24, 2, 1, 0> wxNativePixelFormat;
#define wxPIXEL_FORMAT_ALPHA 3
@@
-158,6
+162,11
@@
typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxImagePixelFormat;
// Cocoa is standard RGB or RGBA (normally it is RGBA)
typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat;
// Cocoa is standard RGB or RGBA (normally it is RGBA)
typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat;
+ #define wxPIXEL_FORMAT_ALPHA 3
+#elif defined(__WXGTK__)
+ // Under GTK+ 2.X we use GdkPixbuf, which is standard RGB or RGBA
+ typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxNativePixelFormat;
+
#define wxPIXEL_FORMAT_ALPHA 3
#endif
#define wxPIXEL_FORMAT_ALPHA 3
#endif
@@
-174,14
+183,16
@@
typedef wxPixelFormat<unsigned char, 24, 0, 1, 2> wxImagePixelFormat;
// used as default value for the pixel format in wxPixelIterator template
template <class T> struct wxPixelFormatFor;
// used as default value for the pixel format in wxPixelIterator template
template <class T> struct wxPixelFormatFor;
+#if wxUSE_IMAGE
// wxPixelFormatFor is only defined for wxImage, attempt to use it with other
// classes (wxBitmap...) will result in compile errors which is exactly what we
// want
template <>
// wxPixelFormatFor is only defined for wxImage, attempt to use it with other
// classes (wxBitmap...) will result in compile errors which is exactly what we
// want
template <>
-struct
WXDLLEXPORT
wxPixelFormatFor<wxImage>
+struct wxPixelFormatFor<wxImage>
{
typedef wxImagePixelFormat Format;
};
{
typedef wxImagePixelFormat Format;
};
+#endif //wxUSE_IMAGE
// ----------------------------------------------------------------------------
// wxPixelData
// ----------------------------------------------------------------------------
// wxPixelData
@@
-191,7
+202,7
@@
struct WXDLLEXPORT wxPixelFormatFor<wxImage>
wxPixelDataBase is just a helper for wxPixelData: it contains things common
to both wxImage and wxBitmap specializations.
*/
wxPixelDataBase is just a helper for wxPixelData: it contains things common
to both wxImage and wxBitmap specializations.
*/
-class
WXDLLEXPORT
wxPixelDataBase
+class wxPixelDataBase
{
public:
// origin of the rectangular region we represent
{
public:
// origin of the rectangular region we represent
@@
-259,26
+270,28
@@
protected:
// we need to define this skeleton template to mollify VC++
template <class Image>
// we need to define this skeleton template to mollify VC++
template <class Image>
-struct
WXDLLEXPORT
wxPixelDataOut
+struct wxPixelDataOut
{
template <class PixelFormat>
{
template <class PixelFormat>
- class
WXDLLEXPORT
wxPixelDataIn
+ class wxPixelDataIn
{
public:
class Iterator { };
};
};
{
public:
class Iterator { };
};
};
+#if wxUSE_IMAGE
// wxPixelData specialization for wxImage: this is the simplest case as we
// don't have to care about different pixel formats here
template <>
// wxPixelData specialization for wxImage: this is the simplest case as we
// don't have to care about different pixel formats here
template <>
-struct
WXDLLEXPORT
wxPixelDataOut<wxImage>
+struct wxPixelDataOut<wxImage>
{
// NB: this is a template class even though it doesn't use its template
// parameter because otherwise wxPixelData couldn't compile
template <class dummyPixelFormat>
{
// NB: this is a template class even though it doesn't use its template
// parameter because otherwise wxPixelData couldn't compile
template <class dummyPixelFormat>
- class
WXDLLEXPORT
wxPixelDataIn : public wxPixelDataBase
+ class wxPixelDataIn : public wxPixelDataBase
{
{
+ public:
// the type of the class we're working with
typedef wxImage ImageType;
// the type of the class we're working with
typedef wxImage ImageType;
@@
-388,9
+401,9
@@
struct WXDLLEXPORT wxPixelDataOut<wxImage>
// -----------
// access to invidividual colour components
// -----------
// access to invidividual colour components
- ChannelType& Red() { return m_p
tr
[PixelFormat::RED]; }
- ChannelType& Green() { return m_p
tr
[PixelFormat::GREEN]; }
- ChannelType& Blue() { return m_p
tr
[PixelFormat::BLUE]; }
+ ChannelType& Red() { return m_p
RGB
[PixelFormat::RED]; }
+ ChannelType& Green() { return m_p
RGB
[PixelFormat::GREEN]; }
+ ChannelType& Blue() { return m_p
RGB
[PixelFormat::BLUE]; }
ChannelType& Alpha() { return *m_pAlpha; }
// private: -- see comment in the beginning of the file
ChannelType& Alpha() { return *m_pAlpha; }
// private: -- see comment in the beginning of the file
@@
-426,7
+439,7
@@
struct WXDLLEXPORT wxPixelDataOut<wxImage>
{
m_stride = Iterator::SizePixel * m_width;
{
m_stride = Iterator::SizePixel * m_width;
- InitRect(rect.GetPosition
s
(), rect.GetSize());
+ InitRect(rect.GetPosition(), rect.GetSize());
}
// we evaluate to true only if we could get access to bitmap data
}
// we evaluate to true only if we could get access to bitmap data
@@
-453,14
+466,16
@@
struct WXDLLEXPORT wxPixelDataOut<wxImage>
Iterator m_pixels;
};
};
Iterator m_pixels;
};
};
+#endif //wxUSE_IMAGE
+#if wxUSE_GUI
// wxPixelData specialization for wxBitmap: here things are more interesting as
// we also have to support different pixel formats
template <>
// wxPixelData specialization for wxBitmap: here things are more interesting as
// we also have to support different pixel formats
template <>
-struct
WXDLLEXPORT
wxPixelDataOut<wxBitmap>
+struct wxPixelDataOut<wxBitmap>
{
template <class Format>
{
template <class Format>
- class
WXDLLEXPORT
wxPixelDataIn : public wxPixelDataBase
+ class wxPixelDataIn : public wxPixelDataBase
{
public:
// the type of the class we're working with
{
public:
// the type of the class we're working with
@@
-505,6
+520,12
@@
struct WXDLLEXPORT wxPixelDataOut<wxBitmap>
bmp.GetRawData(data, PixelFormat::BitsPerPixel);
}
bmp.GetRawData(data, PixelFormat::BitsPerPixel);
}
+ // default constructor
+ Iterator()
+ {
+ m_ptr = NULL;
+ }
+
// return true if this iterator is valid
bool IsOk() const { return m_ptr != NULL; }
// return true if this iterator is valid
bool IsOk() const { return m_ptr != NULL; }
@@
-635,14
+656,7
@@
struct WXDLLEXPORT wxPixelDataOut<wxBitmap>
}
};
};
}
};
};
-
-#ifdef __VISUALC__
- // typedef-name 'foo' used as synonym for class-name 'bar'
- // (VC++ gives this warning each time wxPixelData::Base is used but it
- // doesn't make any sense here -- what's wrong with using typedef instead
- // of class, this is what it is here for!)
- #pragma warning(disable: 4097)
-#endif // __VISUALC__
+#endif //wxUSE_GUI
template <class Image, class PixelFormat = wxPixelFormatFor<Image> >
class wxPixelData :
template <class Image, class PixelFormat = wxPixelFormatFor<Image> >
class wxPixelData :
@@
-665,10
+679,15
@@
public:
// some "predefined" pixel data classes
// some "predefined" pixel data classes
+#if wxUSE_IMAGE
typedef wxPixelData<wxImage> wxImagePixelData;
typedef wxPixelData<wxImage> wxImagePixelData;
+#endif //wxUSE_IMAGE
+#if wxUSE_GUI
typedef wxPixelData<wxBitmap, wxNativePixelFormat> wxNativePixelData;
typedef wxPixelData<wxBitmap, wxAlphaPixelFormat> wxAlphaPixelData;
typedef wxPixelData<wxBitmap, wxNativePixelFormat> wxNativePixelData;
typedef wxPixelData<wxBitmap, wxAlphaPixelFormat> wxAlphaPixelData;
+#endif //wxUSE_GUI
+
// ----------------------------------------------------------------------------
// wxPixelIterator
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxPixelIterator
// ----------------------------------------------------------------------------
@@
-686,14
+705,9
@@
typedef wxPixelData<wxBitmap, wxAlphaPixelFormat> wxAlphaPixelData;
partial template specialization then and neither VC6 nor VC7 provide it.
*/
template < class Image, class PixelFormat = wxPixelFormatFor<Image> >
partial template specialization then and neither VC6 nor VC7 provide it.
*/
template < class Image, class PixelFormat = wxPixelFormatFor<Image> >
-struct
WXDLLEXPORT wxPixelIterator :
wxPixelData<Image, PixelFormat>::Iterator
+struct
wxPixelIterator : public
wxPixelData<Image, PixelFormat>::Iterator
{
};
{
};
-#ifdef __VISUALC__
- #pragma warning(default: 4355)
- #pragma warning(default: 4097)
-#endif
-
#endif // _WX_RAWBMP_H_BASE_
#endif // _WX_RAWBMP_H_BASE_