本文整理汇总了C++中wxBitmap::GetScaledWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ wxBitmap::GetScaledWidth方法的具体用法?C++ wxBitmap::GetScaledWidth怎么用?C++ wxBitmap::GetScaledWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxBitmap
的用法示例。
在下文中一共展示了wxBitmap::GetScaledWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Add
int wxImageList::Add( const wxBitmap &bitmap )
{
wxASSERT_MSG( (bitmap.GetScaledWidth() >= m_width && bitmap.GetScaledHeight() == m_height)
|| (m_width == 0 && m_height == 0),
wxT("invalid bitmap size in wxImageList: this might work ")
wxT("on this platform but definitely won't under Windows.") );
// Mimic behaviour of Windows ImageList_Add that automatically breaks up the added
// bitmap into sub-images of the correct size
if (m_width > 0 && bitmap.GetScaledWidth() > m_width && bitmap.GetScaledHeight() >= m_height)
{
int numImages = bitmap.GetScaledWidth() / m_width;
for (int subIndex = 0; subIndex < numImages; subIndex++)
{
wxRect rect(m_width * subIndex, 0, m_width, m_height);
wxBitmap tmpBmp = bitmap.GetSubBitmap(rect);
m_images.Append( new wxBitmap(tmpBmp) );
}
}
else
{
m_images.Append( new wxBitmap(bitmap) );
}
if (m_width == 0 && m_height == 0)
{
m_width = bitmap.GetScaledWidth();
m_height = bitmap.GetScaledHeight();
}
return m_images.GetCount() - 1;
}
示例2: DoDrawBitmap
void wxGCDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y,
bool useMask )
{
wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid DC") );
wxCHECK_RET( bmp.IsOk(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid bitmap") );
int w = bmp.GetScaledWidth();
int h = bmp.GetScaledHeight();
if ( bmp.GetDepth() == 1 )
{
m_graphicContext->SetPen(*wxTRANSPARENT_PEN);
m_graphicContext->SetBrush(m_textBackgroundColour);
m_graphicContext->DrawRectangle( x, y, w, h );
m_graphicContext->SetBrush(m_textForegroundColour);
m_graphicContext->DrawBitmap( bmp, x, y, w, h );
m_graphicContext->SetBrush( m_graphicContext->CreateBrush(m_brush));
m_graphicContext->SetPen( m_graphicContext->CreatePen(m_pen));
}
else // not a monochrome bitmap, handle it normally
{
// make a copy in case we need to remove its mask, if we don't modify
// it the copy is cheap as bitmaps are reference-counted
wxBitmap bmpCopy(bmp);
if ( !useMask && bmp.GetMask() )
bmpCopy.SetMask(NULL);
m_graphicContext->DrawBitmap( bmpCopy, x, y, w, h );
}
CalcBoundingBox(x, y);
CalcBoundingBox(x + w, y + h);
}
示例3: DoSelect
void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
{
if ( m_selected.IsOk() )
{
m_selected.EndRawAccess() ;
wxDELETE(m_graphicContext);
}
m_selected = bitmap;
if (m_selected.IsOk())
{
if ( m_selected.GetDepth() != 1 )
m_selected.UseAlpha() ;
m_selected.BeginRawAccess() ;
m_width = bitmap.GetScaledWidth();
m_height = bitmap.GetScaledHeight();
m_contentScaleFactor = bitmap.GetScaleFactor();
CGColorSpaceRef genericColorSpace = wxMacGetGenericRGBColorSpace();
CGContextRef bmCtx = (CGContextRef) m_selected.GetHBITMAP();
if ( bmCtx )
{
CGContextSetFillColorSpace( bmCtx, genericColorSpace );
CGContextSetStrokeColorSpace( bmCtx, genericColorSpace );
SetGraphicsContext( wxGraphicsContext::CreateFromNative( bmCtx ) );
}
m_ok = (m_graphicContext != NULL) ;
}
else
{
m_ok = false;
}
}