added wxUSE_PALETTE and fixed compilation with it set to 0
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11749 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -774,6 +774,7 @@ if test $DEBUG_CONFIGURE = 1; then
|
||||
DEFAULT_wxUSE_UNICODE=no
|
||||
DEFAULT_wxUSE_WCSRTOMBS=no
|
||||
|
||||
DEFAULT_wxUSE_PALETTE=no
|
||||
DEFAULT_wxUSE_IMAGE=no
|
||||
DEFAULT_wxUSE_GIF=no
|
||||
DEFAULT_wxUSE_PCX=no
|
||||
@@ -933,6 +934,7 @@ else
|
||||
DEFAULT_wxUSE_UNICODE=no
|
||||
DEFAULT_wxUSE_WCSRTOMBS=no
|
||||
|
||||
DEFAULT_wxUSE_PALETTE=yes
|
||||
DEFAULT_wxUSE_IMAGE=yes
|
||||
DEFAULT_wxUSE_GIF=yes
|
||||
DEFAULT_wxUSE_PCX=yes
|
||||
@@ -1290,6 +1292,7 @@ dnl ---------------------------------------------------------------------------
|
||||
dnl support for image formats that do not rely on external library
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
WX_ARG_ENABLE(palette, [ --enable-palette use wxPalette class], wxUSE_PALETTE)
|
||||
WX_ARG_ENABLE(image, [ --enable-image use wxImage class], wxUSE_IMAGE)
|
||||
WX_ARG_ENABLE(gif, [ --enable-gif use gif images (GIF file format)], wxUSE_GIF)
|
||||
WX_ARG_ENABLE(pcx, [ --enable-pcx use pcx images (PCX file format)], wxUSE_PCX)
|
||||
@@ -4258,6 +4261,10 @@ if test "$wxUSE_VALIDATORS" = "yes"; then
|
||||
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS validate"
|
||||
fi
|
||||
|
||||
if test "$wxUSE_PALETTE" = "yes" ; then
|
||||
AC_DEFINE(wxUSE_PALETTE)
|
||||
fi
|
||||
|
||||
if test "$wxUSE_IMAGE" = "yes" ; then
|
||||
AC_DEFINE(wxUSE_IMAGE)
|
||||
fi
|
||||
|
@@ -309,6 +309,14 @@
|
||||
# endif
|
||||
#endif /* !defined(wxUSE_NOTEBOOK) */
|
||||
|
||||
#ifndef wxUSE_PALETTE
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_PALETTE must be defined."
|
||||
# else
|
||||
# define wxUSE_PALETTE 0
|
||||
# endif
|
||||
#endif /* !defined(wxUSE_PALETTE) */
|
||||
|
||||
#ifndef wxUSE_POPUPWIN
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_POPUPWIN must be defined."
|
||||
|
@@ -316,7 +316,9 @@ public:
|
||||
virtual void SetBrush(const wxBrush& brush) = 0;
|
||||
virtual void SetBackground(const wxBrush& brush) = 0;
|
||||
virtual void SetBackgroundMode(int mode) = 0;
|
||||
#if wxUSE_PALETTE
|
||||
virtual void SetPalette(const wxPalette& palette) = 0;
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
// clipping region
|
||||
// ---------------
|
||||
@@ -588,12 +590,17 @@ public:
|
||||
#endif // !Win16
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
virtual void SetColourMap(const wxPalette& palette) { SetPalette(palette); }
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
void GetTextExtent(const wxString& string, float *x, float *y,
|
||||
float *descent = NULL, float *externalLeading = NULL,
|
||||
wxFont *theFont = NULL, bool use16bit = FALSE) const ;
|
||||
void GetSize(float* width, float* height) const { int w, h; GetSize(& w, & h); *width = w; *height = h; }
|
||||
void GetSizeMM(float *width, float *height) const { long w, h; GetSizeMM(& w, & h); *width = (float) w; *height = (float) h; }
|
||||
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
protected:
|
||||
@@ -731,7 +738,10 @@ protected:
|
||||
wxColour m_textForegroundColour;
|
||||
wxColour m_textBackgroundColour;
|
||||
wxFont m_font;
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
wxPalette m_palette;
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
private:
|
||||
DECLARE_NO_COPY_CLASS(wxDCBase)
|
||||
|
@@ -185,10 +185,12 @@ public:
|
||||
void SetMask( bool mask = TRUE );
|
||||
bool HasMask() const;
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
// Palette functions
|
||||
bool HasPalette() const;
|
||||
const wxPalette& GetPalette() const;
|
||||
void SetPalette(const wxPalette& palette);
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
// Option functions (arbitrary name/value mapping)
|
||||
void SetOption(const wxString& name, const wxString& value);
|
||||
|
@@ -29,6 +29,7 @@ class WXDLLEXPORT wxMask;
|
||||
class WXDLLEXPORT wxCursor;
|
||||
class WXDLLEXPORT wxControl;
|
||||
class WXDLLEXPORT wxImage;
|
||||
class WXDLLEXPORT wxPalette;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Bitmap data
|
||||
@@ -47,7 +48,9 @@ public:
|
||||
|
||||
public:
|
||||
int m_numColors;
|
||||
#if wxUSE_PALETTE
|
||||
wxPalette m_bitmapPalette;
|
||||
#endif // wxUSE_PALETTE
|
||||
int m_quality;
|
||||
|
||||
// MSW-specific
|
||||
@@ -147,8 +150,10 @@ public:
|
||||
int GetQuality() const { return (GetBitmapData() ? GetBitmapData()->m_quality : 0); }
|
||||
void SetQuality(int q);
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
wxPalette* GetPalette() const { return (GetBitmapData() ? (& GetBitmapData()->m_bitmapPalette) : (wxPalette*) NULL); }
|
||||
void SetPalette(const wxPalette& palette);
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
wxMask *GetMask() const { return (GetBitmapData() ? GetBitmapData()->m_bitmapMask : (wxMask*) NULL); }
|
||||
void SetMask(wxMask *mask) ;
|
||||
@@ -160,10 +165,12 @@ public:
|
||||
void SetOk(bool isOk);
|
||||
#endif // WXWIN_COMPATIBILITY_2
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
#if WXWIN_COMPATIBILITY
|
||||
wxPalette *GetColourMap() const { return GetPalette(); }
|
||||
void SetColourMap(wxPalette *cmap) { SetPalette(*cmap); };
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
|
@@ -115,7 +115,9 @@ public:
|
||||
virtual void SetBrush(const wxBrush& brush);
|
||||
virtual void SetBackground(const wxBrush& brush);
|
||||
virtual void SetBackgroundMode(int mode);
|
||||
#if wxUSE_PALETTE
|
||||
virtual void SetPalette(const wxPalette& palette);
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
virtual void DestroyClippingRegion();
|
||||
|
||||
@@ -255,7 +257,10 @@ protected:
|
||||
WXHPEN m_oldPen;
|
||||
WXHBRUSH m_oldBrush;
|
||||
WXHFONT m_oldFont;
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
WXHPALETTE m_oldPalette;
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
#if wxUSE_DC_CACHEING
|
||||
static wxList sm_bitmapCache;
|
||||
|
@@ -890,6 +890,9 @@
|
||||
// Set to 1 for XPM format support
|
||||
#define wxUSE_XPM 1
|
||||
|
||||
// Set to 1 to compile in wxPalette class
|
||||
#define wxUSE_PALETTE 1
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Windows-only settings
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -1,21 +1,25 @@
|
||||
#ifndef _WX_PALETTE_H_BASE_
|
||||
#define _WX_PALETTE_H_BASE_
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/palette.h"
|
||||
#include "wx/msw/palette.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/palette.h"
|
||||
#include "wx/motif/palette.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/paletteg.h"
|
||||
#include "wx/generic/paletteg.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/palette.h"
|
||||
#include "wx/mgl/palette.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/palette.h"
|
||||
#include "wx/mac/palette.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/palette.h"
|
||||
#include "wx/os2/palette.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/palette.h"
|
||||
#include "wx/stubs/palette.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
#endif
|
||||
// _WX_PALETTE_H_BASE_
|
||||
|
@@ -329,4 +329,6 @@
|
||||
|
||||
#endif
|
||||
|
||||
#define wxUSE_PALETTE 0
|
||||
|
||||
#endif // _WX_UNIV_SETUP_H_
|
||||
|
@@ -762,6 +762,11 @@
|
||||
*/
|
||||
#define wxUSE_ZIPSTREAM 0
|
||||
|
||||
/*
|
||||
* wxPalette class
|
||||
*/
|
||||
#define wxUSE_PALETTE 0
|
||||
|
||||
/*
|
||||
* wxImage support
|
||||
*/
|
||||
|
@@ -96,11 +96,14 @@ bool wxEffects::TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap)
|
||||
|
||||
wxMemoryDC dcMem;
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
if (bitmap.GetPalette() && !hiColour)
|
||||
{
|
||||
dc.SetPalette(* bitmap.GetPalette());
|
||||
dcMem.SetPalette(* bitmap.GetPalette());
|
||||
}
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
dcMem.SelectObject(bitmap);
|
||||
|
||||
int i, j;
|
||||
@@ -111,11 +114,13 @@ bool wxEffects::TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap)
|
||||
}
|
||||
dcMem.SelectObject(wxNullBitmap);
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
if (bitmap.GetPalette() && !hiColour)
|
||||
{
|
||||
dc.SetPalette(wxNullPalette);
|
||||
dcMem.SetPalette(wxNullPalette);
|
||||
}
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -58,7 +58,9 @@ public:
|
||||
unsigned char m_maskRed,m_maskGreen,m_maskBlue;
|
||||
bool m_ok;
|
||||
bool m_static;
|
||||
#if wxUSE_PALETTE
|
||||
wxPalette m_palette;
|
||||
#endif // wxUSE_PALETTE
|
||||
wxArrayString m_optionNames;
|
||||
wxArrayString m_optionValues;
|
||||
};
|
||||
@@ -718,6 +720,8 @@ int wxImage::GetHeight() const
|
||||
return M_IMGDATA->m_height;
|
||||
}
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
|
||||
// Palette functions
|
||||
|
||||
bool wxImage::HasPalette() const
|
||||
@@ -742,6 +746,8 @@ void wxImage::SetPalette(const wxPalette& palette)
|
||||
M_IMGDATA->m_palette = palette;
|
||||
}
|
||||
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
// Option functions (arbitrary name/value mapping)
|
||||
void wxImage::SetOption(const wxString& name, const wxString& value)
|
||||
{
|
||||
|
@@ -1483,8 +1483,11 @@ void wxQuantize::DoQuantize(unsigned w, unsigned h, unsigned char **in_rows, uns
|
||||
// TODO: somehow make use of the Windows system colours, rather than ignoring them for the
|
||||
// purposes of quantization.
|
||||
|
||||
bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalette, int desiredNoColours,
|
||||
unsigned char** eightBitData, int flags)
|
||||
bool wxQuantize::Quantize(const wxImage& src, wxImage& dest,
|
||||
wxPalette** pPalette,
|
||||
int desiredNoColours,
|
||||
unsigned char** eightBitData,
|
||||
int flags)
|
||||
|
||||
{
|
||||
int i;
|
||||
@@ -1559,6 +1562,7 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalett
|
||||
else
|
||||
delete[] data8bit;
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
// Make a wxWindows palette
|
||||
if (pPalette)
|
||||
{
|
||||
@@ -1604,6 +1608,7 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalett
|
||||
delete[] g;
|
||||
delete[] b;
|
||||
}
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1611,20 +1616,24 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalett
|
||||
// This version sets a palette in the destination image so you don't
|
||||
// have to manage it yourself.
|
||||
|
||||
bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, int desiredNoColours,
|
||||
unsigned char** eightBitData, int flags)
|
||||
bool wxQuantize::Quantize(const wxImage& src,
|
||||
wxImage& dest,
|
||||
int desiredNoColours,
|
||||
unsigned char** eightBitData,
|
||||
int flags)
|
||||
{
|
||||
wxPalette* palette = NULL;
|
||||
if (Quantize(src, dest, & palette, desiredNoColours, eightBitData, flags))
|
||||
{
|
||||
if ( !Quantize(src, dest, & palette, desiredNoColours, eightBitData, flags) )
|
||||
return FALSE;
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
if (palette)
|
||||
{
|
||||
dest.SetPalette(* palette);
|
||||
delete palette;
|
||||
}
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: palette.cpp
|
||||
// Name: src/generic/paletteg.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
@@ -13,8 +13,16 @@
|
||||
#pragma implementation "paletteg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/palette.h"
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
|
||||
#include "wx/palette.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxPalette
|
||||
@@ -153,4 +161,6 @@ bool wxPalette::GetRGB(int pixel,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
|
||||
|
@@ -467,12 +467,14 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
|
||||
hbitmap = ::CreateCompatibleBitmap( hdc, width, bmpHeight );
|
||||
::SelectObject( memdc, hbitmap);
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
HPALETTE hOldPalette = 0;
|
||||
if (image.GetPalette().Ok())
|
||||
{
|
||||
hOldPalette = ::SelectPalette(memdc, (HPALETTE) image.GetPalette().GetHPALETTE(), FALSE);
|
||||
::RealizePalette(memdc);
|
||||
}
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
// copy image data into DIB data and then into DDB (in a loop)
|
||||
unsigned char *data = image.GetData();
|
||||
@@ -523,8 +525,10 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
|
||||
}
|
||||
SetHBITMAP( (WXHBITMAP) hbitmap );
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
if (hOldPalette)
|
||||
SelectPalette(memdc, hOldPalette, FALSE);
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
// similarly, created an mono-bitmap for the possible mask
|
||||
if( image.HasMask() )
|
||||
@@ -792,7 +796,9 @@ bool wxBitmap::Create(void *data, long type, int width, int height, int depth)
|
||||
return handler->Create(this, data, type, width, height, depth);
|
||||
}
|
||||
|
||||
bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *palette)
|
||||
bool wxBitmap::SaveFile(const wxString& filename,
|
||||
int type,
|
||||
const wxPalette *palette)
|
||||
{
|
||||
wxBitmapHandler *handler = wxDynamicCast(FindHandler(type), wxBitmapHandler);
|
||||
|
||||
@@ -882,6 +888,8 @@ void wxBitmap::SetOk(bool isOk)
|
||||
}
|
||||
#endif // WXWIN_COMPATIBILITY_2
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
|
||||
void wxBitmap::SetPalette(const wxPalette& palette)
|
||||
{
|
||||
EnsureHasData();
|
||||
@@ -889,6 +897,8 @@ void wxBitmap::SetPalette(const wxPalette& palette)
|
||||
GetBitmapData()->m_bitmapPalette = palette;
|
||||
}
|
||||
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
void wxBitmap::SetMask(wxMask *mask)
|
||||
{
|
||||
EnsureHasData();
|
||||
@@ -911,6 +921,7 @@ wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const
|
||||
LPBITMAPINFO lpDib;
|
||||
void *lpBits = (void*) NULL;
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
if( GetPalette() && GetPalette()->Ok() )
|
||||
{
|
||||
tmpBitmap.SetPalette(*GetPalette());
|
||||
@@ -927,6 +938,9 @@ wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const
|
||||
memDC.SelectObject(tmpBitmap);
|
||||
memDC.SetPalette( palette );
|
||||
}
|
||||
#else // !wxUSE_PALETTE
|
||||
hPal = (HPALETTE) ::GetStockObject(DEFAULT_PALETTE);
|
||||
#endif // wxUSE_PALETTE/!wxUSE_PALETTE
|
||||
|
||||
// set the height negative because in a DIB the order of the lines is
|
||||
// reversed
|
||||
@@ -1032,6 +1046,8 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
|
||||
::DeleteObject((HBITMAP) m_maskBitmap);
|
||||
m_maskBitmap = 0;
|
||||
}
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
if (bitmap.Ok() && bitmap.GetPalette()->Ok())
|
||||
{
|
||||
unsigned char red, green, blue;
|
||||
@@ -1041,6 +1057,8 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
|
||||
return Create(bitmap, transparentColour);
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@@ -96,7 +96,9 @@ wxIcon wxNullIcon;
|
||||
wxCursor wxNullCursor;
|
||||
wxPen wxNullPen;
|
||||
wxBrush wxNullBrush;
|
||||
#if wxUSE_PALETTE
|
||||
wxPalette wxNullPalette;
|
||||
#endif // wxUSE_PALETTE
|
||||
wxFont wxNullFont;
|
||||
wxColour wxNullColour;
|
||||
|
||||
|
@@ -178,7 +178,9 @@ wxDC::wxDC()
|
||||
m_oldPen = 0;
|
||||
m_oldBrush = 0;
|
||||
m_oldFont = 0;
|
||||
#if wxUSE_PALETTE
|
||||
m_oldPalette = 0;
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
m_bOwnsDC = FALSE;
|
||||
m_hDC = 0;
|
||||
@@ -246,16 +248,21 @@ void wxDC::SelectOldObjects(WXHDC dc)
|
||||
::SelectObject((HDC) dc, (HFONT) m_oldFont);
|
||||
}
|
||||
m_oldFont = 0;
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
if (m_oldPalette)
|
||||
{
|
||||
::SelectPalette((HDC) dc, (HPALETTE) m_oldPalette, TRUE);
|
||||
}
|
||||
m_oldPalette = 0;
|
||||
#endif // wxUSE_PALETTE
|
||||
}
|
||||
|
||||
m_brush = wxNullBrush;
|
||||
m_pen = wxNullPen;
|
||||
#if wxUSE_PALETTE
|
||||
m_palette = wxNullPalette;
|
||||
#endif // wxUSE_PALETTE
|
||||
m_font = wxNullFont;
|
||||
m_backgroundBrush = wxNullBrush;
|
||||
m_selectedBitmap = wxNullBitmap;
|
||||
@@ -1065,6 +1072,8 @@ void wxDC::DoDrawRotatedText(const wxString& text,
|
||||
// set GDI objects
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
|
||||
void wxDC::SetPalette(const wxPalette& palette)
|
||||
{
|
||||
#ifdef __WXMICROWIN__
|
||||
@@ -1104,6 +1113,8 @@ void wxDC::SetPalette(const wxPalette& palette)
|
||||
}
|
||||
}
|
||||
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
void wxDC::SetFont(const wxFont& the_font)
|
||||
{
|
||||
#ifdef __WXMICROWIN__
|
||||
|
@@ -708,12 +708,14 @@ bool wxLoadIntoBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette **pal)
|
||||
|
||||
if (hPalette)
|
||||
{
|
||||
#if wxUSE_PALETTE
|
||||
if (pal)
|
||||
{
|
||||
*pal = new wxPalette;
|
||||
(*pal)->SetHPALETTE((WXHPALETTE) hPalette);
|
||||
}
|
||||
else
|
||||
#endif // wxUSE_PALETTE
|
||||
DeleteObject(hPalette);
|
||||
}
|
||||
else if (pal)
|
||||
@@ -928,8 +930,10 @@ HANDLE wxBitmapToDIB (HBITMAP hBitmap, HPALETTE hPal)
|
||||
bool wxSaveBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette *colourmap)
|
||||
{
|
||||
HPALETTE hPalette = 0;
|
||||
#if wxUSE_PALETTE
|
||||
if (colourmap)
|
||||
hPalette = (HPALETTE) colourmap->GetHPALETTE();
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
HANDLE dibHandle = wxBitmapToDIB((HBITMAP) bitmap->GetHBITMAP(), hPalette);
|
||||
if (dibHandle)
|
||||
|
@@ -355,6 +355,8 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap,
|
||||
#if wxUSE_IMAGE_LOADING_IN_MSW
|
||||
wxPalette *palette = NULL;
|
||||
bool success = wxLoadIntoBitmap(WXSTRINGCAST name, bitmap, &palette) != 0;
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
if ( success && palette )
|
||||
{
|
||||
bitmap->SetPalette(*palette);
|
||||
@@ -362,6 +364,7 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap,
|
||||
|
||||
// it was copied by the bitmap if it was loaded successfully
|
||||
delete palette;
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
return success;
|
||||
#else
|
||||
@@ -375,9 +378,15 @@ bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap,
|
||||
const wxPalette *pal)
|
||||
{
|
||||
#if wxUSE_IMAGE_LOADING_IN_MSW
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
wxPalette *actualPalette = (wxPalette *)pal;
|
||||
if ( !actualPalette )
|
||||
actualPalette = bitmap->GetPalette();
|
||||
#else
|
||||
wxPalette *actualPalette = NULL;
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
return wxSaveBitmap(WXSTRINGCAST name, bitmap, actualPalette) != 0;
|
||||
#else
|
||||
return FALSE;
|
||||
|
@@ -17,18 +17,16 @@
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include <stdio.h>
|
||||
#include "wx/setup.h"
|
||||
#include "wx/palette.h"
|
||||
#include "wx/palette.h"
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "assert.h"
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
|
||||
|
||||
@@ -149,3 +147,5 @@ void wxPalette::SetHPALETTE(WXHPALETTE pal)
|
||||
M_PALETTEDATA->m_hPalette = pal;
|
||||
}
|
||||
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
|
@@ -240,8 +240,7 @@ bool wxPen::RealizeResource()
|
||||
if (M_PENDATA->m_style==wxUSER_DASH && M_PENDATA->m_nbDash && M_PENDATA->m_dash)
|
||||
{
|
||||
real_dash = new wxMSWDash[M_PENDATA->m_nbDash];
|
||||
int i, dsh;
|
||||
for (i=0; i<M_PENDATA->m_nbDash; i++)
|
||||
for ( int i = 0; i < M_PENDATA->m_nbDash; i++ )
|
||||
real_dash[i] = M_PENDATA->m_dash[i] * M_PENDATA->m_width;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user