// Purpose: graphics context methods common to all platforms
// Author: Stefan Csomor
// Modified by:
-// Created:
+// Created:
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
#include "wx/region.h"
#endif
+#ifndef wxMAC_USE_CORE_GRAPHICS_BLEND_MODES
+ #define wxMAC_USE_CORE_GRAPHICS_BLEND_MODES 0
+#endif
+
//-----------------------------------------------------------------------------
// constants
//-----------------------------------------------------------------------------
}
void wxGCDC::SetGraphicsContext( wxGraphicsContext* ctx )
-{
+{
delete m_graphicContext;
m_graphicContext = ctx;
if ( m_graphicContext )
wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid DC") );
wxCHECK_RET( bmp.Ok(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid bitmap") );
- m_graphicContext->DrawBitmap( bmp, x , y , bmp.GetWidth() , bmp.GetHeight() );
+ if ( bmp.GetDepth() == 1 )
+ {
+ m_graphicContext->SetPen(*wxTRANSPARENT_PEN);
+ m_graphicContext->SetBrush( wxBrush( m_textBackgroundColour , wxSOLID ) );
+ m_graphicContext->DrawRectangle( x , y , bmp.GetWidth() , bmp.GetHeight() );
+ m_graphicContext->SetBrush( wxBrush( m_textForegroundColour , wxSOLID ) );
+ m_graphicContext->DrawBitmap( bmp, x , y , bmp.GetWidth() , bmp.GetHeight() );
+ m_graphicContext->SetBrush( m_graphicContext->CreateBrush(m_brush));
+ m_graphicContext->SetPen( m_graphicContext->CreatePen(m_pen));
+ }
+ else
+ m_graphicContext->DrawBitmap( bmp, x , y , bmp.GetWidth() , bmp.GetHeight() );
}
void wxGCDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
m_matrixCurrent = m_graphicContext->CreateMatrix();
m_matrixCurrent.Translate( m_deviceOriginX, m_deviceOriginY );
m_matrixCurrent.Scale( m_scaleX, m_scaleY );
- m_matrixCurrent.Translate( m_logicalOriginX, m_logicalOriginY );
-
+ // the logical origin sets the origin to have new coordinates
+ m_matrixCurrent.Translate( -m_logicalOriginX, -m_logicalOriginY );
+
m_graphicContext->SetTransform( m_matrixOriginal );
m_graphicContext->ConcatTransform( m_matrixCurrent );
}
{
wxCHECK_MSG( Ok(), false, wxT("wxGCDC(cg)::DoBlit - invalid DC") );
wxCHECK_MSG( source->Ok(), false, wxT("wxGCDC(cg)::DoBlit - invalid source DC") );
-
+
if ( logical_func == wxNO_OP )
return true;
else if ( logical_func != wxCOPY )
wxRect subrect(source-> LogicalToDeviceX(xsrc),source-> LogicalToDeviceY(ysrc),
source-> LogicalToDeviceXRel(width),source-> LogicalToDeviceYRel(height));
-
+
wxBitmap blit = source->GetAsBitmap( &subrect );
-
+
if ( blit.Ok() )
{
m_graphicContext->DrawBitmap( blit, xdest , ydest , width , height );
m_graphicContext->GetTextExtent( str, &w, &h, &d, &e );
if ( height )
- *height = h;
+ *height = (wxCoord)h;
if ( descent )
- *descent = d;
+ *descent = (wxCoord)d;
if ( externalLeading )
- *externalLeading =e;
+ *externalLeading = (wxCoord)e;
if ( width )
- *width = w;
+ *width = (wxCoord)w;
if ( theFont )
{
wxPen p = *wxTRANSPARENT_PEN;
m_graphicContext->SetPen( p );
DoDrawRectangle( 0, 0, 32000 , 32000 );
- m_graphicContext->SetPen( m_pen );
+ m_graphicContext->SetPen( m_pen );
m_graphicContext->SetBrush( m_brush );
}