compilation fixes for wxUSE_IMAGE==0
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47324 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -140,7 +140,9 @@ public:
|
||||
virtual int GetWidth() const = 0;
|
||||
virtual int GetDepth() const = 0;
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
virtual wxImage ConvertToImage() const = 0;
|
||||
#endif // wxUSE_IMAGE
|
||||
|
||||
virtual wxMask *GetMask() const = 0;
|
||||
virtual void SetMask(wxMask *mask) = 0;
|
||||
|
@@ -62,7 +62,9 @@ public:
|
||||
}
|
||||
#endif
|
||||
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM );
|
||||
#if wxUSE_IMAGE
|
||||
wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
|
||||
#endif // wxUSE_IMAGE
|
||||
virtual ~wxBitmap();
|
||||
bool Ok() const { return IsOk(); }
|
||||
bool IsOk() const;
|
||||
@@ -73,7 +75,9 @@ public:
|
||||
int GetWidth() const;
|
||||
int GetDepth() const;
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
wxImage ConvertToImage() const;
|
||||
#endif // wxUSE_IMAGE
|
||||
|
||||
// copies the contents and mask of the given (colour) icon to the bitmap
|
||||
virtual bool CopyFromIcon(const wxIcon& icon);
|
||||
@@ -119,15 +123,19 @@ public:
|
||||
bool HasAlpha() const;
|
||||
|
||||
protected:
|
||||
#if wxUSE_IMAGE
|
||||
bool CreateFromImage(const wxImage& image, int depth);
|
||||
#endif // wxUSE_IMAGE
|
||||
|
||||
virtual wxObjectRefData* CreateRefData() const;
|
||||
virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const;
|
||||
|
||||
private:
|
||||
#if wxUSE_IMAGE
|
||||
// to be called from CreateFromImage only!
|
||||
bool CreateFromImageAsPixmap(const wxImage& image, int depth);
|
||||
bool CreateFromImageAsPixbuf(const wxImage& image);
|
||||
#endif // wxUSE_IMAGE
|
||||
|
||||
enum Representation
|
||||
{
|
||||
|
@@ -37,6 +37,7 @@ public:
|
||||
|
||||
wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
wxRegion( const wxBitmap& bmp)
|
||||
{
|
||||
Union(bmp);
|
||||
@@ -46,6 +47,7 @@ public:
|
||||
{
|
||||
Union(bmp, transColour, tolerance);
|
||||
}
|
||||
#endif // wxUSE_IMAGE
|
||||
|
||||
virtual ~wxRegion();
|
||||
|
||||
|
@@ -363,6 +363,8 @@ wxBitmap wxBitmap::Rescale(int clipx, int clipy, int clipwidth, int clipheight,
|
||||
return bmp;
|
||||
}
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
|
||||
bool wxBitmap::CreateFromImage(const wxImage& image, int depth)
|
||||
{
|
||||
UnRef();
|
||||
@@ -593,6 +595,8 @@ wxImage wxBitmap::ConvertToImage() const
|
||||
return image;
|
||||
}
|
||||
|
||||
#endif // wxUSE_IMAGE
|
||||
|
||||
bool wxBitmap::IsOk() const
|
||||
{
|
||||
return (m_refData != NULL) &&
|
||||
@@ -692,9 +696,13 @@ bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalett
|
||||
{
|
||||
wxCHECK_MSG( Ok(), false, wxT("invalid bitmap") );
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
// Try to save the bitmap via wxImage handlers:
|
||||
wxImage image = ConvertToImage();
|
||||
return image.Ok() && image.SaveFile(name, type);
|
||||
#else // !wxUSE_IMAGE
|
||||
return false;
|
||||
#endif // wxUSE_IMAGE
|
||||
}
|
||||
|
||||
bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type )
|
||||
@@ -712,12 +720,14 @@ bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type )
|
||||
M_BMPDATA->m_mask->m_bitmap = mask;
|
||||
}
|
||||
}
|
||||
#if wxUSE_IMAGE
|
||||
else // try if wxImage can load it
|
||||
{
|
||||
wxImage image;
|
||||
if (image.LoadFile(name, type) && image.Ok())
|
||||
CreateFromImage(image, -1);
|
||||
}
|
||||
#endif // wxUSE_IMAGE
|
||||
|
||||
return Ok();
|
||||
}
|
||||
@@ -786,7 +796,7 @@ GdkPixmap *wxBitmap::GetPixmap() const
|
||||
gdk_pixbuf_render_pixmap_and_mask(M_BMPDATA->m_pixbuf,
|
||||
&M_BMPDATA->m_pixmap,
|
||||
pmask,
|
||||
wxIMAGE_ALPHA_THRESHOLD);
|
||||
0x80 /* alpha threshold */);
|
||||
}
|
||||
|
||||
return M_BMPDATA->m_pixmap;
|
||||
|
@@ -448,17 +448,22 @@ void wxGTKWindowImplDC::DoGetSize( int* width, int* height ) const
|
||||
m_owner->GetSize(width, height);
|
||||
}
|
||||
|
||||
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
|
||||
const wxColour & col, int style);
|
||||
|
||||
bool wxGTKWindowImplDC::DoFloodFill(wxCoord x, wxCoord y,
|
||||
const wxColour& col, int style)
|
||||
{
|
||||
#if wxUSE_IMAGE
|
||||
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
|
||||
const wxColour & col, int style);
|
||||
|
||||
return wxDoFloodFill(this, x, y, col, style);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool wxGTKWindowImplDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
|
||||
{
|
||||
#if wxUSE_IMAGE
|
||||
// Generic (and therefore rather inefficient) method.
|
||||
// Could be improved.
|
||||
wxMemoryDC memdc;
|
||||
@@ -470,6 +475,9 @@ bool wxGTKWindowImplDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) cons
|
||||
wxImage image = bitmap.ConvertToImage();
|
||||
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
|
||||
return true;
|
||||
#else // !wxUSE_IMAGE
|
||||
return false;
|
||||
#endif // wxUSE_IMAGE/!wxUSE_IMAGE
|
||||
}
|
||||
|
||||
void wxGTKWindowImplDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
|
||||
@@ -1619,6 +1627,7 @@ void wxGTKWindowImplDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
|
||||
void wxGTKWindowImplDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, double angle )
|
||||
{
|
||||
#if wxUSE_IMAGE
|
||||
if (!m_window || text.empty())
|
||||
return;
|
||||
|
||||
@@ -1717,6 +1726,7 @@ void wxGTKWindowImplDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCo
|
||||
// update the bounding box
|
||||
CalcBoundingBox(x + minX, y + minY);
|
||||
CalcBoundingBox(x + maxX, y + maxY);
|
||||
#endif // wxUSE_IMAGE
|
||||
}
|
||||
|
||||
void wxGTKWindowImplDC::DoGetTextExtent(const wxString &string,
|
||||
|
Reference in New Issue
Block a user