wxGDIPlusFontData( wxGraphicsRenderer* renderer,
const wxFont &font,
const wxColour& col );
+ wxGDIPlusFontData(wxGraphicsRenderer* renderer,
+ const wxString& name,
+ REAL sizeInPixels,
+ int style,
+ const wxColour& col);
~wxGDIPlusFontData();
virtual Brush* GetGDIPlusBrush() { return m_textBrush; }
void Init(const wxString& name,
REAL size,
int style,
- const wxColour& col);
+ const wxColour& col,
+ Unit fontUnit);
Brush* m_textBrush;
Font* m_font;
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap );
#if wxUSE_IMAGE
virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image);
+ virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp);
#endif // wxUSE_IMAGE
virtual wxGraphicsFont CreateFont( const wxFont& font,
const wxColour& col);
+ virtual wxGraphicsFont CreateFont(double size,
+ const wxString& facename,
+ int flags = wxFONTFLAG_DEFAULT,
+ const wxColour& col = *wxBLACK);
+
// create a graphics bitmap from a native bitmap
virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap );
wxGDIPlusFontData::Init(const wxString& name,
REAL size,
int style,
- const wxColour& col)
+ const wxColour& col,
+ Unit fontUnit)
{
- m_font = new Font(name, size, style, UnitPoint);
+ m_font = new Font(name.wc_str(), size, style, fontUnit);
m_textBrush = new SolidBrush(wxColourToColor(col));
}
if ( font.GetWeight() == wxFONTWEIGHT_BOLD )
style |= FontStyleBold;
- Init(font.GetFaceName(), font.GetPointSize(), style, col);
+ Init(font.GetFaceName(), font.GetPointSize(), style, col, UnitPoint);
+}
+
+wxGDIPlusFontData::wxGDIPlusFontData(wxGraphicsRenderer* renderer,
+ const wxString& name,
+ REAL sizeInPixels,
+ int style,
+ const wxColour& col) :
+ wxGraphicsObjectRefData(renderer)
+{
+ Init(name, sizeInPixels, style, col, UnitPixel);
}
wxGDIPlusFontData::~wxGDIPlusFontData()
delete m_helper;
}
-// ----------------------------------------------------------------------------
-// wxGraphicsBitmap implementation
-// ----------------------------------------------------------------------------
-
-#if wxUSE_IMAGE
-
-wxImage wxGraphicsBitmap::ConvertToImage() const
-{
- const wxGDIPlusBitmapData* const
- data = static_cast<wxGDIPlusBitmapData*>(GetGraphicsData());
-
- return data ? data->ConvertToImage() : wxNullImage;
-}
-
-#endif // wxUSE_IMAGE
-
//-----------------------------------------------------------------------------
// wxGDIPlusPath implementation
//-----------------------------------------------------------------------------
return wxNullGraphicsFont;
}
+wxGraphicsFont
+wxGDIPlusRenderer::CreateFont(double size,
+ const wxString& facename,
+ int flags,
+ const wxColour& col)
+{
+ ENSURE_LOADED_OR_RETURN(wxNullGraphicsFont);
+
+ // Convert wxFont flags to GDI+ style:
+ int style = FontStyleRegular;
+ if ( flags & wxFONTFLAG_ITALIC )
+ style |= FontStyleItalic;
+ if ( flags & wxFONTFLAG_UNDERLINED )
+ style |= FontStyleUnderline;
+ if ( flags & wxFONTFLAG_BOLD )
+ style |= FontStyleBold;
+ if ( flags & wxFONTFLAG_STRIKETHROUGH )
+ style |= FontStyleStrikeout;
+
+
+ wxGraphicsFont f;
+ f.SetRefData(new wxGDIPlusFontData(this, facename, size, style, col));
+ return f;
+}
+
wxGraphicsBitmap wxGDIPlusRenderer::CreateBitmap( const wxBitmap &bitmap )
{
ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap);
return wxNullGraphicsBitmap;
}
+
+wxImage wxGDIPlusRenderer::CreateImageFromBitmap(const wxGraphicsBitmap& bmp)
+{
+ ENSURE_LOADED_OR_RETURN(wxNullImage);
+ const wxGDIPlusBitmapData* const
+ data = static_cast<wxGDIPlusBitmapData*>(bmp.GetGraphicsData());
+
+ return data ? data->ConvertToImage() : wxNullImage;
+}
+
#endif // wxUSE_IMAGE
+
wxGraphicsBitmap wxGDIPlusRenderer::CreateBitmapFromNativeBitmap( void *bitmap )
{
ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap);