本文整理汇总了C++中wxMemoryDC::DrawBitmap方法的典型用法代码示例。如果您正苦于以下问题:C++ wxMemoryDC::DrawBitmap方法的具体用法?C++ wxMemoryDC::DrawBitmap怎么用?C++ wxMemoryDC::DrawBitmap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxMemoryDC
的用法示例。
在下文中一共展示了wxMemoryDC::DrawBitmap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Paint
void wxBuildUI::Paint(wxMemoryDC &dc)
{
wxSize size = GetSize();
dc.SetBrush(wxBrush(sBackgroundBuild, wxSOLID));
dc.SetPen(wxPen(mClickable ? sClickable : sOutline, 1, wxSOLID));
dc.DrawRectangle(0, 0, size.x, size.y);
// If we're not clickable, draw hatch lines over the bitmap to show it.
if(false == mClickable)
{
wxBrush brush(sOutline);
brush.SetStyle(wxBDIAGONAL_HATCH);
dc.SetBrush(brush);
dc.DrawRectangle(0, 0, size.x, size.y);
dc.DrawBitmap(mDisabledBitmap, 1, 1, true);
}
}
示例2: drawTable
//.........这里部分代码省略.........
bdc.GetTextExtent(queryTable->getName()+wxT(" (")+queryTable->getAlias()+wxT(")"),&w,&h);
else
bdc.GetTextExtent(queryTable->getName(),&w,&h);
width= rowLeftMargin + w + rowRightMargin;
// Get Columns Metrics
bdc.SetFont(normalFont);
// Don't use h value from font metrics to get consistency between columns vertical separation (height)
height+=rowHeight*queryTable->parent->countCols()+rowTopMargin*queryTable->parent->countCols();
gqbIteratorBase *iterator = queryTable->parent->createColumnsIterator();
while(iterator->HasNext())
{
gqbColumn *tmp= (gqbColumn *)iterator->Next();
bdc.GetTextExtent(tmp->getName(),&w,&h);
if((rowLeftMargin + w + rowRightMargin) > width)
width=rowLeftMargin + w + rowRightMargin;
}
//Don't delete iterator because will be use below;
// Set table Size in ObjectModel (Temporary Values for object representation,
// and for this reason the view can modified model without using the controller
// because this values are used by controller when use object's size in internal operations)
if( (height+2) < minTableHeight) // +2 from BackgroundLayers addition
{
queryTable->setHeight(minTableHeight);
height=minTableHeight;
}
else
queryTable->setHeight(height+2);
if( (width+2) < minTableWidth)
{
queryTable->setWidth(minTableWidth);
width=minTableWidth;
}
else
queryTable->setWidth(width+2);
//Decorate Table
bdc.SetPen(*wxTRANSPARENT_PEN);
//draw second Layer
bdc.SetBrush(BackgroundLayer2);
bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width+2,height+2)));
//draw third Layer
bdc.SetBrush(BackgroundLayer1);
bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width+1,height+1)));
//draw real frame layer
bdc.SetBrush(*wxWHITE_BRUSH);
if(queryTable->getSelected())
{
bdc.SetPen(selectedPen);
}
else
{
bdc.SetPen(*wxBLACK_PEN);
}
bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width,height)));
//draw title layer
bdc.SetBrush(BackgroundTitle);
bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width,rowHeight+rowTopMargin)));
bdc.SetFont(TableTitleFont);
if(queryTable->getAlias().length()>0)
bdc.DrawText(queryTable->getName()+wxT(" (")+queryTable->getAlias()+wxT(")"),origin->x+margin,origin->y+rowTopMargin);
else
bdc.DrawText(queryTable->getName(),origin->x+margin,origin->y+rowTopMargin);
bdc.SetFont(normalFont);
// GQB-TODO: in a future reuse a little more the iterator creating it inside the Query or Table Object
// and only delete it when delete the query object.
// Draw Columns
height=rowHeight+rowTopMargin;
iterator->ResetIterator();
while(iterator->HasNext())
{
gqbColumn *tmp= (gqbColumn *)iterator->Next();
if(queryTable->existsColumn(tmp))
{
bdc.SetTextForeground(* wxRED);
bdc.SetFont(normalFont);
bdc.DrawBitmap(imgSelBoxSelected,origin->x+3,origin->y+height,true);
}
else
{
bdc.SetFont(normalFont);
bdc.DrawBitmap(imgSelBoxEmpty,origin->x+3,origin->y+height,true);
}
bdc.DrawText(tmp->getName(),origin->x+rowLeftMargin,origin->y+height);
bdc.SetTextForeground( *wxBLACK);
height+=rowHeight+rowTopMargin;
}
delete iterator; //now if delete because it's not needed anymore
}
示例3: Paint
void wxListSelection::Paint(wxMemoryDC &dc)
{
const StringArray &displayOrder = mParent->GetDisplayOrder();
wxASSERT(false == displayOrder.empty());
wxASSERT(displayOrder.size() == mpImpl->mPoints.size());
wxSize size = GetSize();
wxColour background = mpImpl->mBackground;
// Set background color.
if(mpImpl->mIsHighlight && mpImpl->mIsSelected)
{
background = mpImpl->mHighlightAndSelected;
}
else if(mpImpl->mIsHighlight)
{
background = mpImpl->mHighlight;
}
else if(mpImpl->mIsSelected)
{
background = mpImpl->mSelected;
}
dc.SetPen(wxPen(background));
dc.SetBrush(wxBrush(background));
dc.DrawRectangle(0, 0, size.x, size.y);
// Bitmap (if any)
if(true == mpImpl->mBitmap.Ok())
{
dc.DrawBitmap(mpImpl->mBitmap, sImageBufferX, mpImpl->mImageBufferY, true);
}
// Draw text.
dc.SetFont(mpImpl->mMainFont);
wxColour shadow = mpImpl->mMainTextShadow;
wxColour main = IsEnabled() ? mpImpl->mMainText :
mpImpl->mMainTextDisabled;
for(size_t i = 0; i < displayOrder.size(); ++i)
{
if(1 == i)
{
dc.SetFont(mpImpl->mSubFont);
shadow = mpImpl->mSubTextShadow;
main = mpImpl->mSubText;
}
const wxString &str = mpImpl->mFields[displayOrder[i]];
if(false == str.IsEmpty())
{
const wxPoint &point = mpImpl->mPoints[i];
if(shadow != mpImpl->mTransparent)
{
dc.SetTextForeground(shadow);
dc.DrawText(str, point.x + 1, point.y + 1);
}
dc.SetTextForeground(main);
dc.DrawText(str, point.x, point.y);
}
}
}
示例4: RenderPageFragment
bool wxWindowsPrintPreview::RenderPageFragment(float scaleX, float scaleY,
int *nextFinalLine,
wxPrinterDC& printer,
wxMemoryDC& finalDC,
const wxRect& rect,
int pageNum)
{
// compute 'rect' equivalent in the small final bitmap:
const wxRect smallRect(wxPoint(0, *nextFinalLine),
wxPoint(int(rect.GetRight() * scaleX),
int(rect.GetBottom() * scaleY)));
wxLogTrace("printing",
"rendering fragment of page %i: [%i,%i,%i,%i] scaled down to [%i,%i,%i,%i]",
pageNum,
rect.x, rect.y, rect.GetRight(), rect.GetBottom(),
smallRect.x, smallRect.y, smallRect.GetRight(), smallRect.GetBottom()
);
// create DC and bitmap compatible with printer DC:
wxBitmap large(rect.width, rect.height, printer);
if ( !large.IsOk() )
return false;
// render part of the page into it:
{
PageFragmentDC memoryDC(&printer, large,
rect.GetPosition(),
wxSize(m_pageWidth, m_pageHeight));
if ( !memoryDC.IsOk() )
return false;
memoryDC.Clear();
if ( !RenderPageIntoDC(memoryDC, pageNum) )
return false;
} // release bitmap from memoryDC
// now scale the rendered part down and blit it into final output:
wxImage img;
{
wxDIB dib(large);
if ( !dib.IsOk() )
return false;
large = wxNullBitmap; // free memory a.s.a.p.
img = dib.ConvertToImage();
} // free the DIB now that it's no longer needed, too
if ( !img.IsOk() )
return false;
img.Rescale(smallRect.width, smallRect.height, wxIMAGE_QUALITY_HIGH);
if ( !img.IsOk() )
return false;
wxBitmap bmp(img);
if ( !bmp.IsOk() )
return false;
img = wxNullImage;
finalDC.DrawBitmap(bmp, smallRect.x, smallRect.y);
if ( bmp.IsOk() )
{
*nextFinalLine += smallRect.height;
return true;
}
return false;
}