Exemplo n.º 1
0
/*****************************************************
**
**   PdfPainter   ---   setBrush
**
******************************************************/
void PdfPainter::setBrush( const wxBrush &b )
{
	// TODO howto scale width und height 
	if ( b.GetStyle() == wxSTIPPLE )
	{
		wxImage image;
		wxBitmap *bitmap = b.GetStipple();
		if ( bitmap && bitmap->IsOk())
		{
			image = bitmap->ConvertToImage();

			double width = image.GetWidth() / 3;
			double height = image.GetHeight() / 3;

			// setup a hash value for the image
			wxString s = createImageHash( &image );

			pdf->AddPattern( s, image, width, height );
			drawmode = wxPDF_STYLE_FILL;
			pdf->SetFillPattern( s );
			pdf->SetDrawPattern( s );
		}
	}
	else if ( b.GetStyle() != wxTRANSPARENT && b.GetColour().IsOk() ) setBrushColor( b.GetColour() );
	else
	{
		drawmode = wxPDF_STYLE_DRAW;
	}
}
Exemplo n.º 2
0
void wxGenericBrush::Set( const wxBrush &brush )
{
    wxCHECK_RET(Ok() && brush.Ok(), wxT("Invalid generic brush"));
    SetColour(brush.GetColour());
    M_GBRUSHDATA->m_style = brush.GetStyle();
    wxBitmap* stipple = brush.GetStipple();
    if (stipple && stipple->Ok())
        M_GBRUSHDATA->m_stipple = *stipple;
}