本文整理汇总了C++中Painter::clearClipRectangle方法的典型用法代码示例。如果您正苦于以下问题:C++ Painter::clearClipRectangle方法的具体用法?C++ Painter::clearClipRectangle怎么用?C++ Painter::clearClipRectangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Painter
的用法示例。
在下文中一共展示了Painter::clearClipRectangle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawFPSGraph
void EconomyGraph::drawFPSGraph( Painter& painter, Rect2D fpsRect ){
Color grey, blue;
blue.parse( "blue" );
grey.parse("#A9A9A9FF");
int mgX = (int) fpsRect.p1.x;
int mgY = (int) fpsRect.p1.y;
int mgW = (int) fpsRect.getWidth();
int mgH = (int) fpsRect.getHeight();
painter.setFillColor( grey );
painter.fillRectangle( fpsRect );
painter.setClipRectangle( fpsRect );
Vector2 a;
Vector2 b;
painter.setLineColor( blue );
float scale = (float) mgH / 64; //MONTHGRAPH_H ;
b.y = mgY + mgH;
for( int i = mgW - 1; i >= 0; i-- ){
a.x = mgX + mgW - i;
a.y = mgY + mgH - scale * fps[i];
b.x = mgX + mgW - i;
painter.drawLine( a, b );
}
painter.clearClipRectangle();
}
示例2: drawHistoryLineGraph
void EconomyGraph::drawHistoryLineGraph( Painter& painter, Rect2D mg ){
// see oldgui/screen.cpp do_history_linegraph
Vector2 a;
Vector2 b;
Color red, yellow, blue, brown, grey;
red.parse( "red");
yellow.parse( "yellow" );
blue.parse( "blue" );
brown.parse( "brown" );
grey.parse("#A9A9A9FF");
painter.setClipRectangle( mg );
painter.setFillColor( grey );
painter.fillRectangle( mg );
int mgX = (int) mg.p1.x;
int mgY = (int) mg.p1.y;
int mgW = (int) mg.getWidth();
int mgH = (int) mg.getHeight();
float scale = (float) mgH / 64; //MONTHGRAPH_H ;
b.y = mgY + mgH;
for( int i = mgW - 1; i >= 0; i-- ){
painter.setLineColor( yellow );
a.x = mgX + mgW - i;
a.y = mgY + mgH - scale * monthgraph_nojobs[i];
b.x = mgX + mgW - i;
painter.drawLine( a, b );
painter.setLineColor( red );
a.y = mgY + mgH - scale * monthgraph_starve[i];
painter.drawLine( a, b );
}
for( int i = mgW - 1; i > 0; i-- ){
painter.setLineColor( brown );
a.x = mgX + mgW - i;
a.y = mgY + mgH - scale * monthgraph_pop[ i ];
b.x = mgX + mgW - i-1;
b.y = mgY + mgH - scale * monthgraph_pop[ i-1 ];
painter.drawLine( a, b );
a.y = mgY + mgH - scale * monthgraph_ppool[ i ];
b.y = mgY + mgH - scale * monthgraph_ppool[ i-1 ];
painter.setLineColor( blue );
painter.drawLine( a, b );
}
painter.clearClipRectangle();
}
示例3: assert
void
Component::drawChild(Child& child, Painter& painter)
{
assert(child.getComponent() != 0);
if(child.useClipRect) {
painter.setClipRectangle(child.clipRect);
}
if(child.position != Vector2(0, 0)) {
painter.pushTransform();
painter.translate(child.position);
}
child.component->draw(painter);
if(child.position != Vector2(0, 0)) {
painter.popTransform();
}
if(child.useClipRect) {
painter.clearClipRectangle();
}
}