X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c9a828e77fec39b9a2a9e2d26d20c75057fef9b1..96c9640205933ad0673d5af2c96af0816c50160c:/src/msw/graphics.cpp diff --git a/src/msw/graphics.cpp b/src/msw/graphics.cpp index e5161c5d5b..dd6ff85899 100644 --- a/src/msw/graphics.cpp +++ b/src/msw/graphics.cpp @@ -272,7 +272,7 @@ private: GraphicsPath* m_brushPath; }; -class WXDLLIMPEXP_CORE wxGDIPlusBitmapData : public wxGraphicsObjectRefData +class WXDLLIMPEXP_CORE wxGDIPlusBitmapData : public wxGraphicsBitmapData { public: wxGDIPlusBitmapData( wxGraphicsRenderer* renderer, Bitmap* bitmap ); @@ -280,6 +280,7 @@ public: ~wxGDIPlusBitmapData (); virtual Bitmap* GetGDIPlusBitmap() { return m_bitmap; } + void* GetNativeBitmap() const { return (void*)m_bitmap; } #if wxUSE_IMAGE wxImage ConvertToImage() const; @@ -396,10 +397,7 @@ protected: void Init(Graphics* graphics, int width, int height); private: - virtual void DoDrawText(const wxString& str, wxDouble x, wxDouble y) - { DoDrawFilledText(str, x, y, wxNullGraphicsBrush); } - virtual void DoDrawFilledText(const wxString& str, wxDouble x, wxDouble y, - const wxGraphicsBrush& backgroundBrush); + virtual void DoDrawText(const wxString& str, wxDouble x, wxDouble y); Graphics* m_context; wxStack m_stateStack; @@ -946,13 +944,13 @@ wxGDIPlusFontData::~wxGDIPlusFontData() //----------------------------------------------------------------------------- wxGDIPlusBitmapData::wxGDIPlusBitmapData( wxGraphicsRenderer* renderer, Bitmap* bitmap ) : - wxGraphicsObjectRefData( renderer ), m_bitmap( bitmap ) + wxGraphicsBitmapData( renderer ), m_bitmap( bitmap ) { m_helper = NULL; } wxGDIPlusBitmapData::wxGDIPlusBitmapData( wxGraphicsRenderer* renderer, - const wxBitmap &bmp) : wxGraphicsObjectRefData( renderer ) + const wxBitmap &bmp) : wxGraphicsBitmapData( renderer ) { m_bitmap = NULL; m_helper = NULL; @@ -1390,6 +1388,7 @@ void wxGDIPlusContext::Init(Graphics* graphics, int width, int height) m_context->SetTextRenderingHint(TextRenderingHintSystemDefault); m_context->SetPixelOffsetMode(PixelOffsetModeHalf); m_context->SetSmoothingMode(SmoothingModeHighQuality); + m_context->SetInterpolationMode(InterpolationModeHighQuality); m_state1 = m_context->Save(); m_state2 = m_context->Save(); } @@ -1535,10 +1534,44 @@ bool wxGDIPlusContext::SetAntialiasMode(wxAntialiasMode antialias) return true; } -bool wxGDIPlusContext::SetInterpolationQuality(wxInterpolationQuality WXUNUSED(interpolation)) +bool wxGDIPlusContext::SetInterpolationQuality(wxInterpolationQuality interpolation) { - // placeholder - return false; + if (m_interpolation == interpolation) + return true; + + InterpolationMode interpolationMode = InterpolationModeDefault; + switch (interpolation) + { + case wxINTERPOLATION_DEFAULT: + interpolationMode = InterpolationModeDefault; + break; + + case wxINTERPOLATION_NONE: + interpolationMode = InterpolationModeNearestNeighbor; + break; + + case wxINTERPOLATION_FAST: + interpolationMode = InterpolationModeLowQuality; + break; + + case wxINTERPOLATION_GOOD: + interpolationMode = InterpolationModeHighQuality; + break; + + case wxINTERPOLATION_BEST: + interpolationMode = InterpolationModeHighQualityBicubic; + break; + + default: + return false; + } + + if ( m_context->SetInterpolationMode(interpolationMode) != Gdiplus::Ok ) + return false; + + m_interpolation = interpolation; + + return true; } bool wxGDIPlusContext::SetCompositionMode(wxCompositionMode op) @@ -1698,9 +1731,8 @@ void wxGDIPlusContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxD DeleteObject(iconInfo.hbmMask); } -void wxGDIPlusContext::DoDrawFilledText(const wxString& str, - wxDouble x, wxDouble y, - const wxGraphicsBrush& brush) +void wxGDIPlusContext::DoDrawText(const wxString& str, + wxDouble x, wxDouble y ) { if (m_composition == wxCOMPOSITION_DEST) return; @@ -1713,9 +1745,7 @@ void wxGDIPlusContext::DoDrawFilledText(const wxString& str, wxGDIPlusFontData * const fontData = (wxGDIPlusFontData *)m_font.GetRefData(); - wxGDIPlusBrushData * const - brushData = (wxGDIPlusBrushData *)brush.GetRefData(); - + m_context->DrawString ( str.wc_str(*wxConvUI), // string to draw, always Unicode @@ -1723,8 +1753,7 @@ void wxGDIPlusContext::DoDrawFilledText(const wxString& str, fontData->GetGDIPlusFont(), PointF(x, y), StringFormat::GenericTypographic(), - brushData ? brushData->GetGDIPlusBrush() - : fontData->GetGDIPlusBrush() + fontData->GetGDIPlusBrush() ); }