本文整理汇总了C++中PageContentContext::DrawSquare方法的典型用法代码示例。如果您正苦于以下问题:C++ PageContentContext::DrawSquare方法的具体用法?C++ PageContentContext::DrawSquare怎么用?C++ PageContentContext::DrawSquare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageContentContext
的用法示例。
在下文中一共展示了PageContentContext::DrawSquare方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
EStatusCode HighLevelContentContext::Run(const TestConfiguration& inTestConfiguration)
{
EStatusCode status = eSuccess;
PDFWriter pdfWriter;
do
{
status = pdfWriter.StartPDF(RelativeURLToLocalPath(inTestConfiguration.mSampleFileBase,"HighLevelContentContext.PDF"),
ePDFVersion13,
LogConfiguration(true,true,
RelativeURLToLocalPath(inTestConfiguration.mSampleFileBase,"HighLevelContentContext.log")));
if(status != eSuccess)
{
cout<<"Failed to start file\n";
break;
}
PDFPage* page = new PDFPage();
page->SetMediaBox(PDFRectangle(0,0,595,842));
PageContentContext* cxt = pdfWriter.StartPageContentContext(page);
AbstractContentContext::TextOptions textOptions(pdfWriter.GetFontForFile(
RelativeURLToLocalPath(
inTestConfiguration.mSampleFileBase,
"TestMaterials/fonts/arial.ttf")),
14,
AbstractContentContext::eGray,
0);
AbstractContentContext::GraphicOptions pathFillOptions(AbstractContentContext::eFill,
AbstractContentContext::eCMYK,
0xFF000000);
AbstractContentContext::GraphicOptions pathStrokeOptions(AbstractContentContext::eStroke,
AbstractContentContext::eRGB,
AbstractContentContext::ColorValueForName("DarkMagenta"),
4);
DoubleAndDoublePairList pathPoints;
// draw path
pathPoints.push_back(DoubleAndDoublePair(75,640));
pathPoints.push_back(DoubleAndDoublePair(149,800));
pathPoints.push_back(DoubleAndDoublePair(225,640));
cxt->DrawPath(pathPoints,pathFillOptions);
pathPoints.clear();
pathPoints.push_back(DoubleAndDoublePair(75,540));
pathPoints.push_back(DoubleAndDoublePair(110,440));
pathPoints.push_back(DoubleAndDoublePair(149,540));
pathPoints.push_back(DoubleAndDoublePair(188,440));
pathPoints.push_back(DoubleAndDoublePair(223,540));
cxt->DrawPath(pathPoints,pathStrokeOptions);
// draw square
cxt->DrawSquare(375,640,120,pathFillOptions);
cxt->DrawSquare(375,440,120,pathStrokeOptions);
// draw rectangle
cxt->DrawRectangle(375,220,50,160,pathFillOptions);
cxt->DrawRectangle(375,10,50,160,pathStrokeOptions);
// draw circle
cxt->DrawCircle(149,300,80,pathFillOptions);
cxt->DrawCircle(149,90,80,pathStrokeOptions);
// wrote text (writing labels for each of the shapes)
cxt->WriteText(75,805,"Paths",textOptions);
cxt->WriteText(375,805,"Squares",textOptions);
cxt->WriteText(375,400,"Rectangles",textOptions);
cxt->WriteText(75,400,"Circles",textOptions);
status = pdfWriter.EndPageContentContext(cxt);
if(status != eSuccess)
{
status = PDFHummus::eFailure;
cout<<"Failed to end content context\n";
break;
}
status = pdfWriter.WritePageAndRelease(page);
if(status != eSuccess)
{
status = PDFHummus::eFailure;
cout<<"Failed to write page\n";
break;
}
status = pdfWriter.EndPDF();
if(status != eSuccess)
{
status = PDFHummus::eFailure;
cout<<"Failed to end pdf\n";
break;
}
}while(false);
return status;
}