本文整理汇总了C++中Rect::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::Draw方法的具体用法?C++ Rect::Draw怎么用?C++ Rect::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect::Draw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: specified
void
Image::Render (cairo_t *cr, Region *region, bool path_only)
{
ImageSource *source = GetSource ();
cairo_pattern_t *pattern = NULL;
cairo_matrix_t matrix;
if (!source)
return;
source->Lock ();
cairo_save (cr);
Size specified (GetActualWidth (), GetActualHeight ());
Size stretched = ApplySizeConstraints (specified);
bool adjust = specified != GetRenderSize ();
if (GetStretch () != StretchUniformToFill)
specified = specified.Min (stretched);
Rect paint = Rect (0, 0, specified.width, specified.height);
if (!path_only) {
Rect image = Rect (0, 0, source->GetPixelWidth (), source->GetPixelHeight ());
if (GetStretch () == StretchNone)
paint = paint.Union (image);
if (image.width == 0.0 && image.height == 0.0)
goto cleanup;
pattern = cairo_pattern_create_for_surface (source->GetSurface (cr));
image_brush_compute_pattern_matrix (&matrix, paint.width, paint.height,
image.width, image.height,
GetStretch (),
AlignmentXCenter, AlignmentYCenter, NULL, NULL);
cairo_pattern_set_matrix (pattern, &matrix);
#if MAKE_EVERYTHING_SLOW_AND_BUGGY
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD);
#endif
if (cairo_pattern_status (pattern) == CAIRO_STATUS_SUCCESS) {
cairo_set_source (cr, pattern);
}
cairo_pattern_destroy (pattern);
}
if (adjust) {
// FIXME: Propagate error properly
MoonError error;
specified = MeasureOverrideWithError (specified, &error);
paint = Rect ((stretched.width - specified.width) * 0.5, (stretched.height - specified.height) * 0.5, specified.width, specified.height);
}
if (!path_only)
RenderLayoutClip (cr);
paint = paint.Intersection (Rect (0, 0, stretched.width, stretched.height));
paint.Draw (cr);
if (!path_only)
cairo_fill (cr);
cleanup:
cairo_restore (cr);
source->Unlock ();
}
示例2: ShowMenu
void Game::ShowMenu()//显示菜单
{
static bool firstrun=true;
//创建界面元素
static FullScrAni menubk;
static Button butnew(clientw/2,clienth/3+20);
static Button butold(clientw/2,clienth/3+80);
static Button butsel(clientw/2,clienth/3+140);
static Button buthelp(clientw/2,clienth/3+200);
static Button butquit(clientw/2,clienth/3+260);
static SelBox sel(clientw/8+110,clienth*2/5+45,150,50);
static Rect selbkground(clientw/8,clienth*2/5,clientw/3,clienth/3);
static Button butok(clientw/8+20,clienth*2/5+120,100,50);
static Button butcl(clientw/8+145,clienth*2/5+120,100,50);
manager.Play(MID_MENUBKM);
if(firstrun)
{
//设置动画
menubk.SetAni(ANI_MENUBK);
butnew.SetAni(ANI_BUTTON,ANI_BUTTON_NEW);
butold.SetAni(ANI_BUTTON,ANI_BUTTON_OLD);
butsel.SetAni(ANI_BUTTON,ANI_BUTTON_SEL);
buthelp.SetAni(ANI_BUTTON,ANI_BUTTON_HELP);
butquit.SetAni(ANI_BUTTON,ANI_BUTTON_QUIT);
butok.SetAni(ANI_BUTTON,ANI_BUTTON_OK);
butcl.SetAni(ANI_BUTTON,ANI_BUTTON_CANCEL);
sel.Add(1).Add(2).Add(3).Add(4).Add(5).Add(6).Add(7).Add(8).Add(9);
sel.SetAni(-1,ANI_BUTTON,ANI_BUTTON,-1,ANI_BUTTON_LEFT,ANI_BUTTON_RIGHT);
selbkground.SetAni(ANI_SELBKGROUND);
}
//界面元素的响应
butnew.Deal();
butold.Deal();
butsel.Deal();
buthelp.Deal();
butquit.Deal();
//界面元素的绘制
menubk.Draw();
butnew.Draw();
butold.Draw();
butsel.Draw();
buthelp.Draw();
butquit.Draw();
//检测界面元素的状态
if(butnew.MousePressed())//新的开始
{
level=1;
butnew.Recover();
state=GAME_CREATE;
}
if(butold.MousePressed())//旧的回忆
{
ReadArchive();
butold.Recover();
state=GAME_RUN;
}
if(butsel.MousePressed())//选择关卡
{
selbkground.Draw();
sel.Deal();
sel.Draw();
butok.Deal();
butcl.Deal();
butok.Draw();
butcl.Draw();
if(butok.MousePressed())
{
butsel.Recover();
butok.Recover();
level=atoi(sel.str().c_str());
state=GAME_CREATE;
}
if(butcl.MousePressed())
{
butcl.Recover();
butsel.Recover();
}
}
if(buthelp.MousePressed())//帮助
{
buthelp.Recover();
state=GAME_SHOWHELP;
}
if(butquit.MousePressed())
{
::PostQuitMessage(0);
}
firstrun=false;
}
示例3: do_dmx_config
int do_dmx_config(int cfgdmx_X, int cfgdmx_Y, int largeurCFGdmxwindow,int hauteurCFGdmxwindow)
{
//definition des aires devices
Rect DeviceArtNetDevice( Vec2D((cfgdmx_X+10),(cfgdmx_Y+50)),Vec2D(180,30));
DeviceArtNetDevice.SetRoundness(15);
Rect DeviceEnttecOpen( Vec2D((cfgdmx_X+10),(cfgdmx_Y+80)),Vec2D(180,30));
DeviceEnttecOpen.SetRoundness(15);
Rect DeviceEnttecPro( Vec2D((cfgdmx_X+10),(cfgdmx_Y+110)),Vec2D(180,30));
DeviceEnttecPro.SetRoundness(15);
Rect DeviceSunlite ( Vec2D((cfgdmx_X+10),(cfgdmx_Y+170)),Vec2D(180,30));
DeviceSunlite.SetRoundness(15);
//definition des aires univers
Rect ArtNetSendUniverse( Vec2D((cfgdmx_X+220),(cfgdmx_Y+50)),Vec2D(70,30));
ArtNetSendUniverse.SetRoundness(15);
//definition des aire d edition d adresse
Rect ArtNetSendAdress( Vec2D((cfgdmx_X+320),(cfgdmx_Y+50)),Vec2D(170,30));
ArtNetSendAdress.SetRoundness(15);
//SPEC. ARTNET: BROADCAST MODE
Rect ArtNetBroadcastMode( Vec2D((cfgdmx_X+520),(cfgdmx_Y+50)),Vec2D(130,30));
ArtNetBroadcastMode.SetRoundness(15);
//SPEC ARTNET ARTPOLL
Rect ArtNetPollforDevices( Vec2D((cfgdmx_X+670),(cfgdmx_Y+50)),Vec2D(100,30));
ArtNetPollforDevices.SetRoundness(15);
//SPEC ARTNET DOUBLE DMX
Rect ArtNetDoubleDMX( Vec2D((cfgdmx_X+770),(cfgdmx_Y+50)),Vec2D(60,30));
ArtNetDoubleDMX.SetRoundness(15);
//SPEC ENTTEC PROIN
Rect EnttecProIN( Vec2D((cfgdmx_X+240),(cfgdmx_Y+110)),Vec2D(170,30));
EnttecProIN.SetRoundness(15);
//SPEC SUNLITE
Rect SunliteAllowsIN( Vec2D((cfgdmx_X+240),(cfgdmx_Y+170)),Vec2D(150,30));
SunliteAllowsIN.SetRoundness(15);
{
//SELECTION DE L INTERFACE
if(window_focus_id==W_CFGMENU && mouse_x>cfgdmx_X+20 && mouse_x<cfgdmx_X+200 )
{
if( mouse_y>(cfgdmx_Y+60) && mouse_y< (cfgdmx_Y+80)) //artnet
{
DeviceArtNetDevice.Draw(CouleurFond.WithAlpha(0.5));
Survol_interface_numero=1;
if(mouse_button==1 && mouse_released==0 )
{
SelectDmxDevice(1);
}
}
else if( mouse_y>(cfgdmx_Y+90) && mouse_y< (cfgdmx_Y+110)) //enttec open
{
DeviceEnttecOpen.Draw(CouleurFond.WithAlpha(0.5));
Survol_interface_numero=2;
if(mouse_button==1 && mouse_released==0 )
{
SelectDmxDevice(2);
}
}
else if( mouse_y>(cfgdmx_Y+120) && mouse_y< (cfgdmx_Y+140)) //enttec pro
{
DeviceEnttecPro.Draw(CouleurFond.WithAlpha(0.5));
Survol_interface_numero=3;
if(mouse_button==1 && mouse_released==0 )
{
SelectDmxDevice(3);
}
}
else if( mouse_y>(cfgdmx_Y+170) && mouse_y< (cfgdmx_Y+200)) //sunlite
{
DeviceSunlite.Draw(CouleurFond.WithAlpha(0.5));
Survol_interface_numero=4;
if(mouse_button==1 && mouse_released==0 )
{
SelectDmxDevice(4);
}
}
}
//SELECTION DE L UNIVERS
//.........这里部分代码省略.........