fixed bitmap constructor for monochrome bitmaps
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2256 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
7ddb3812fd
commit
eefa26bed1
@ -144,6 +144,9 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
dc.DrawText( "Loaded image", 30, 10 );
|
||||
if (my_square && my_square->Ok()) dc.DrawBitmap( *my_square, 30, 30 );
|
||||
|
||||
wxBitmap bm( 1200, 1, 1 );
|
||||
dc.DrawBitmap( bm, 10, 10 );
|
||||
|
||||
dc.DrawText( "Drawn directly", 150, 10 );
|
||||
dc.SetBrush( wxBrush( "orange", wxSOLID ) );
|
||||
dc.SetPen( *wxWHITE_PEN );
|
||||
|
@ -105,17 +105,27 @@ wxBitmap::wxBitmap()
|
||||
wxBitmap::wxBitmap( int width, int height, int depth )
|
||||
{
|
||||
wxCHECK_RET( (width > 0) && (height > 0), _T("invalid bitmap size") )
|
||||
wxCHECK_RET( (depth > 0) || (depth == -1), _T("invalid bitmap depth") )
|
||||
|
||||
m_refData = new wxBitmapRefData();
|
||||
|
||||
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
|
||||
if (depth == -1) depth = gdk_window_get_visual( parent )->depth;
|
||||
|
||||
wxCHECK_RET( (depth == gdk_window_get_visual( parent )->depth) ||
|
||||
(depth == 1), _T("invalid bitmap depth") )
|
||||
|
||||
m_refData = new wxBitmapRefData();
|
||||
M_BMPDATA->m_mask = (wxMask *) NULL;
|
||||
M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth );
|
||||
M_BMPDATA->m_width = width;
|
||||
M_BMPDATA->m_height = height;
|
||||
if (depth == 1)
|
||||
{
|
||||
M_BMPDATA->m_bitmap = gdk_pixmap_new( parent, width, height, 1 );
|
||||
M_BMPDATA->m_bpp = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth );
|
||||
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth;
|
||||
}
|
||||
|
||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
@ -105,17 +105,27 @@ wxBitmap::wxBitmap()
|
||||
wxBitmap::wxBitmap( int width, int height, int depth )
|
||||
{
|
||||
wxCHECK_RET( (width > 0) && (height > 0), _T("invalid bitmap size") )
|
||||
wxCHECK_RET( (depth > 0) || (depth == -1), _T("invalid bitmap depth") )
|
||||
|
||||
m_refData = new wxBitmapRefData();
|
||||
|
||||
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
|
||||
if (depth == -1) depth = gdk_window_get_visual( parent )->depth;
|
||||
|
||||
wxCHECK_RET( (depth == gdk_window_get_visual( parent )->depth) ||
|
||||
(depth == 1), _T("invalid bitmap depth") )
|
||||
|
||||
m_refData = new wxBitmapRefData();
|
||||
M_BMPDATA->m_mask = (wxMask *) NULL;
|
||||
M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth );
|
||||
M_BMPDATA->m_width = width;
|
||||
M_BMPDATA->m_height = height;
|
||||
if (depth == 1)
|
||||
{
|
||||
M_BMPDATA->m_bitmap = gdk_pixmap_new( parent, width, height, 1 );
|
||||
M_BMPDATA->m_bpp = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth );
|
||||
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth;
|
||||
}
|
||||
|
||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user