support 1 bit deep bitmaps as masks
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41967 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -393,14 +393,24 @@ void wxMacCGContext::Scale( wxCoord xScale , wxCoord yScale )
|
|||||||
void wxMacCGContext::DrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, wxCoord w, wxCoord h )
|
void wxMacCGContext::DrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, wxCoord w, wxCoord h )
|
||||||
{
|
{
|
||||||
CGImageRef image = (CGImageRef)( bmp.CGImageCreate() ) ;
|
CGImageRef image = (CGImageRef)( bmp.CGImageCreate() ) ;
|
||||||
HIRect r = CGRectMake( x , y , w , h ) ;
|
HIRect r = CGRectMake( 0 , 0 , w , h );
|
||||||
HIViewDrawCGImage( m_cgContext , &r , image ) ;
|
|
||||||
|
CGContextSaveGState( m_cgContext );
|
||||||
|
CGContextTranslateCTM( m_cgContext, x , y + h );
|
||||||
|
CGContextScaleCTM( m_cgContext, 1, -1 );
|
||||||
|
|
||||||
|
// in case image is a mask, set the foreground color
|
||||||
|
CGContextSetRGBFillColor( m_cgContext , m_textForegroundColor.Red() / 255.0 , m_textForegroundColor.Green() / 255.0 ,
|
||||||
|
m_textForegroundColor.Blue() / 255.0 , m_textForegroundColor.Alpha() / 255.0 ) ;
|
||||||
|
CGContextDrawImage( m_cgContext, r, image );
|
||||||
|
CGContextRestoreGState( m_cgContext );
|
||||||
|
|
||||||
CGImageRelease( image ) ;
|
CGImageRelease( image ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacCGContext::DrawIcon( const wxIcon &icon, wxCoord x, wxCoord y, wxCoord w, wxCoord h )
|
void wxMacCGContext::DrawIcon( const wxIcon &icon, wxCoord x, wxCoord y, wxCoord w, wxCoord h )
|
||||||
{
|
{
|
||||||
CGRect r = CGRectMake( 00 , 00 , w , h ) ;
|
CGRect r = CGRectMake( 0 , 0 , w , h ) ;
|
||||||
CGContextSaveGState( m_cgContext );
|
CGContextSaveGState( m_cgContext );
|
||||||
CGContextTranslateCTM( m_cgContext, x , y + h );
|
CGContextTranslateCTM( m_cgContext, x , y + h );
|
||||||
CGContextScaleCTM( m_cgContext, 1, -1 );
|
CGContextScaleCTM( m_cgContext, 1, -1 );
|
||||||
@@ -1209,7 +1219,18 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
|
|||||||
wxCoord ww = XLOG2DEVREL(w);
|
wxCoord ww = XLOG2DEVREL(w);
|
||||||
wxCoord hh = YLOG2DEVREL(h);
|
wxCoord hh = YLOG2DEVREL(h);
|
||||||
|
|
||||||
m_graphicContext->DrawBitmap( bmp, xx , yy , ww , hh ) ;
|
if ( bmp.GetDepth()==1 )
|
||||||
|
{
|
||||||
|
wxGraphicPath* path = m_graphicContext->CreatePath() ;
|
||||||
|
path->AddRectangle( xx , yy , ww , hh ) ;
|
||||||
|
m_graphicContext->FillPath( path , m_textBackgroundColour, wxODDEVEN_RULE) ;
|
||||||
|
delete path;
|
||||||
|
m_graphicContext->DrawBitmap( bmp, xx , yy , ww , hh ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_graphicContext->DrawBitmap( bmp, xx , yy , ww , hh ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
|
void wxDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
|
||||||
|
Reference in New Issue
Block a user