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;
}
#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;
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);
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
{
wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
+#if wxUSE_IMAGE
wxRegion( const wxBitmap& bmp)
{
Union(bmp);
{
Union(bmp, transColour, tolerance);
}
+#endif // wxUSE_IMAGE
virtual ~wxRegion();
return bmp;
}
+#if wxUSE_IMAGE
+
bool wxBitmap::CreateFromImage(const wxImage& image, int depth)
{
UnRef();
return image;
}
+#endif // wxUSE_IMAGE
+
bool wxBitmap::IsOk() const
{
return (m_refData != NULL) &&
{
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 )
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();
}
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;
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;
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 )
void wxGTKWindowImplDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, double angle )
{
+#if wxUSE_IMAGE
if (!m_window || text.empty())
return;
// update the bounding box
CalcBoundingBox(x + minX, y + minY);
CalcBoundingBox(x + maxX, y + maxY);
+#endif // wxUSE_IMAGE
}
void wxGTKWindowImplDC::DoGetTextExtent(const wxString &string,