]> git.saurik.com Git - wxWidgets.git/commitdiff
Use wxGCDC in wxGTK to draw "Alpha" test page
authorRobert Roebling <robert@roebling.de>
Sat, 21 Oct 2006 18:44:44 +0000 (18:44 +0000)
committerRobert Roebling <robert@roebling.de>
Sat, 21 Oct 2006 18:44:44 +0000 (18:44 +0000)
    in drawing sample. Pretty amazing...

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/drawing/drawing.cpp

index 3c210599474354b91eaaa5d3042269b5aafbfca9..31918e3f082e05c0a0e5bbc02131b4a0bfbf14dd 100644 (file)
@@ -895,8 +895,17 @@ void MyCanvas::DrawWithLogicalOps(wxDC& dc)
 }
 
 #if wxUSE_GRAPHICS_CONTEXT
+#ifdef __WXGTK20__
+void MyCanvas::DrawAlpha(wxDC& no_dc)
+#else
 void MyCanvas::DrawAlpha(wxDC& dc)
+#endif
 {
+#ifdef __WXGTK__
+    wxGCDC dc( this );
+    PrepareDC( dc );
+#endif
+
     wxDouble margin = 20 ;
     wxDouble width = 180 ;
     wxDouble radius = 30 ;
@@ -925,6 +934,10 @@ void MyCanvas::DrawAlpha(wxDC& dc)
     dc.SetPen( *wxTRANSPARENT_PEN ) ;
     dc.SetBrush( wxBrush( wxColour(255,255,128,128) ) );
     dc.DrawRoundedRectangle( 0 , margin + width / 2 , width * 3 , 100 , radius) ;
+    
+    dc.SetTextForeground( wxColour(255,255,0,128) );
+    dc.SetFont( wxFont( 40, wxFONTFAMILY_SWISS, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_NORMAL ) );
+    dc.DrawText( wxT("Hello!"), 120, 80 );
 }
 
 #endif