本文整理汇总了C++中Rect::Clip方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::Clip方法的具体用法?C++ Rect::Clip怎么用?C++ Rect::Clip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect::Clip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void Painter32::FillRect(Rect rect, Uint32 color) {
Rect clipped_rect = rect.Clip(bounds);
Uint8 *start = (Uint8 *)_video_aquire_buffer(screen)
+ (clipped_rect.y * screen->pitch) + (clipped_rect.x * 4);
Uint8 r = (Uint8)((color & 0xff0000) >> 16);
Uint8 g = (Uint8)((color & 0x00ff00) >> 8);
Uint8 b = (Uint8)(color & 0x0000ff);
for ( Uint32 y = 0; y < clipped_rect.height; ++y ) {
Uint8 *dest = start;
for ( Uint32 x = 0; x < clipped_rect.width; ++x ) {
dest[0] = b;
dest[1] = g;
dest[2] = r;
dest[3] = 0xff;
dest += 4;
}
start = (Uint8 *)((Uint32)start + screen->pitch);
}
_video_release_buffer(screen);
}
示例2: VideoModeChange
void Window::VideoModeChange( void ) {
Rect pos = *this;
pos.Align( *view );
pos.Clip( *view );
if ( flags & WIN_CENTER ) pos.Center( *view );
if ( (pos.w != w) || (pos.h != h) ) {
SetSize( pos.x, pos.y, pos.w, pos.h );
Draw();
} else {
x = pos.x;
y = pos.y;
}
}