本文整理汇总了C++中TCanvas::BeginScene方法的典型用法代码示例。如果您正苦于以下问题:C++ TCanvas::BeginScene方法的具体用法?C++ TCanvas::BeginScene怎么用?C++ TCanvas::BeginScene使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCanvas
的用法示例。
在下文中一共展示了TCanvas::BeginScene方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawTextOnLayer
void __fastcall TMainForm::DrawTextOnLayer(const int Index, const String Text)
{
int LayerIndex = MainDataModule->ImageList1->Destination->Items[Index]->Layers->Count - 1;
if(LayerIndex >= 0) {
TLayer * Layer = MainDataModule->ImageList1->Destination->Items[Index]->Layers->Items[LayerIndex];
String SourceName = Layer->Name;
TSize Size;
TCustomBitmapItem * Item;
// Create a new source image if earlier its was not
if(!MainDataModule->ImageList1->BitmapItemByName(SourceName, Item, Size)) {
Size.cx = Layer->SourceRect->Rect.Width();
Size.cy = Layer->SourceRect->Rect.Height();
TCustomSourceItem * NewSource = MainDataModule->ImageList1->Source->Add();
NewSource->Name = SourceName;
Item = NewSource->MultiResBitmap->ItemByScale(1, false, true);
if(Item == NULL) {
Item = NewSource->MultiResBitmap->Add();
}
Item->Bitmap->SetSize(Size.cx, Size.cy);
}
// Output some text
if(Item != NULL) {
Item->Bitmap->Clear(TAlphaColor(0x0));
TCanvas * canvas = Item->Bitmap->Canvas;
if(canvas->BeginScene()) {
__try {
canvas->Font->Size = 15;
canvas->Fill->Color = TAlphaColor(TAlphaColorRec::Red);
canvas->Fill->Kind = TBrushKind::Solid;
canvas->FillText(TRectF(1, 0, Size.cx - 1, Size.cy / 2), Text, false, 1, TFillTextFlags(),
TTextAlign::Center, TTextAlign::Center);
}
__finally {
canvas->EndScene();
}
}