adding construction from native bitmaps
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62226 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -658,6 +658,9 @@ public:
|
|||||||
// create a native bitmap representation
|
// create a native bitmap representation
|
||||||
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) = 0;
|
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) = 0;
|
||||||
|
|
||||||
|
// create a graphics bitmap from a native bitmap
|
||||||
|
virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap ) = 0;
|
||||||
|
|
||||||
// create a subimage from a native image representation
|
// create a subimage from a native image representation
|
||||||
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
|
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
|
||||||
|
|
||||||
|
@@ -290,6 +290,7 @@ class wxCairoBitmapData : public wxGraphicsObjectRefData
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp );
|
wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp );
|
||||||
|
wxCairoBitmapData( wxGraphicsRenderer* renderer, cairo_surface_t* bitmap );
|
||||||
~wxCairoBitmapData();
|
~wxCairoBitmapData();
|
||||||
|
|
||||||
virtual cairo_surface_t* GetCairoSurface() { return m_surface; }
|
virtual cairo_surface_t* GetCairoSurface() { return m_surface; }
|
||||||
@@ -1014,6 +1015,13 @@ void * wxCairoMatrixData::GetNativeMatrix() const
|
|||||||
// wxCairoBitmap implementation
|
// wxCairoBitmap implementation
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, cairo_surface_t* bitmap ) :
|
||||||
|
wxGraphicsObjectRefData( renderer )
|
||||||
|
{
|
||||||
|
m_surface = bitmap;
|
||||||
|
m_pattern = cairo_pattern_create_for_surface(m_surface);
|
||||||
|
}
|
||||||
|
|
||||||
wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp ) : wxGraphicsObjectRefData( renderer )
|
wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp ) : wxGraphicsObjectRefData( renderer )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( bmp.IsOk(), wxT("Invalid bitmap in wxCairoContext::DrawBitmap"));
|
wxCHECK_RET( bmp.IsOk(), wxT("Invalid bitmap in wxCairoContext::DrawBitmap"));
|
||||||
@@ -1708,6 +1716,9 @@ public :
|
|||||||
// create a native bitmap representation
|
// create a native bitmap representation
|
||||||
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap );
|
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap );
|
||||||
|
|
||||||
|
// create a graphics bitmap from a native bitmap
|
||||||
|
virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap );
|
||||||
|
|
||||||
// create a subimage from a native image representation
|
// create a subimage from a native image representation
|
||||||
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
|
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
|
||||||
|
|
||||||
@@ -1879,6 +1890,18 @@ wxGraphicsBitmap wxCairoRenderer::CreateBitmap( const wxBitmap& bmp )
|
|||||||
return wxNullGraphicsBitmap;
|
return wxNullGraphicsBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxGraphicsBitmap wxCairoRenderer::CreateBitmapFromNativeBitmap( void* bitmap )
|
||||||
|
{
|
||||||
|
if ( bitmap != NULL )
|
||||||
|
{
|
||||||
|
wxGraphicsBitmap p;
|
||||||
|
p.SetRefData(new wxCairoBitmapData( this , (cairo_surface_t*) bitmap ));
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return wxNullGraphicsBitmap;
|
||||||
|
}
|
||||||
|
|
||||||
wxGraphicsBitmap
|
wxGraphicsBitmap
|
||||||
wxCairoRenderer::CreateSubBitmap(const wxGraphicsBitmap& WXUNUSED(bitmap),
|
wxCairoRenderer::CreateSubBitmap(const wxGraphicsBitmap& WXUNUSED(bitmap),
|
||||||
wxDouble WXUNUSED(x),
|
wxDouble WXUNUSED(x),
|
||||||
|
@@ -1580,6 +1580,9 @@ public :
|
|||||||
// create a native bitmap representation
|
// create a native bitmap representation
|
||||||
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap );
|
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap );
|
||||||
|
|
||||||
|
// create a graphics bitmap from a native bitmap
|
||||||
|
virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap );
|
||||||
|
|
||||||
// create a subimage from a native image representation
|
// create a subimage from a native image representation
|
||||||
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
|
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
|
||||||
|
|
||||||
@@ -1807,6 +1810,19 @@ wxGraphicsBitmap wxGDIPlusRenderer::CreateBitmap( const wxBitmap &bitmap )
|
|||||||
return wxNullGraphicsBitmap;
|
return wxNullGraphicsBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxGraphicsBitmap wxGDIPlusRenderer::CreateBitmapFromNativeBitmap( void *bitmap )
|
||||||
|
{
|
||||||
|
ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap);
|
||||||
|
if ( bitmap != NULL )
|
||||||
|
{
|
||||||
|
wxGraphicsBitmap p;
|
||||||
|
p.SetRefData(new wxGDIPlusBitmapData( this , (Bitmap*) bitmap ));
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return wxNullGraphicsBitmap;
|
||||||
|
}
|
||||||
|
|
||||||
wxGraphicsBitmap wxGDIPlusRenderer::CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h )
|
wxGraphicsBitmap wxGDIPlusRenderer::CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h )
|
||||||
{
|
{
|
||||||
ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap);
|
ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap);
|
||||||
|
@@ -2635,6 +2635,9 @@ public :
|
|||||||
// create a native bitmap representation
|
// create a native bitmap representation
|
||||||
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) ;
|
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) ;
|
||||||
|
|
||||||
|
// create a graphics bitmap from a native bitmap
|
||||||
|
virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap );
|
||||||
|
|
||||||
// create a native bitmap representation
|
// create a native bitmap representation
|
||||||
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) ;
|
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) ;
|
||||||
private :
|
private :
|
||||||
@@ -2784,9 +2787,19 @@ wxGraphicsBitmap wxMacCoreGraphicsRenderer::CreateBitmap( const wxBitmap& bmp )
|
|||||||
if ( bmp.Ok() )
|
if ( bmp.Ok() )
|
||||||
{
|
{
|
||||||
wxGraphicsBitmap p;
|
wxGraphicsBitmap p;
|
||||||
#ifdef __WXMAC__
|
|
||||||
p.SetRefData(new wxMacCoreGraphicsBitmapData( this , bmp.CreateCGImage(), bmp.GetDepth() == 1 ) );
|
p.SetRefData(new wxMacCoreGraphicsBitmapData( this , bmp.CreateCGImage(), bmp.GetDepth() == 1 ) );
|
||||||
#endif
|
return p;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return wxNullGraphicsBitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxGraphicsBitmap wxMacCoreGraphicsRenderer::CreateBitmapFromNativeBitmap( void* bitmap )
|
||||||
|
{
|
||||||
|
if ( bitmap != NULL )
|
||||||
|
{
|
||||||
|
wxGraphicsBitmap p;
|
||||||
|
p.SetRefData(new wxMacCoreGraphicsBitmapData( this , (CGImageRef) bitmap, false ));
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user