本文整理汇总了C++中IDirectFBSurface::SetClip方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBSurface::SetClip方法的具体用法?C++ IDirectFBSurface::SetClip怎么用?C++ IDirectFBSurface::SetClip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFBSurface
的用法示例。
在下文中一共展示了IDirectFBSurface::SetClip方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
static DFBResult
draw_progressbar(LiteBox *box,
const DFBRegion *region,
DFBBoolean clear)
{
LiteProgressBar *progressbar = LITE_PROGRESSBAR(box);
IDirectFBSurface *surface = box->surface;
DFBRectangle rect;
D_ASSERT(box != NULL);
surface->SetClip(surface, region);
rect.x = 0;
rect.y = 0;
rect.h = box->rect.h;
rect.w = (int) ((float) box->rect.w * progressbar->value);
if (progressbar->surface_fg) {
if (progressbar->surface_bg)
surface->Blit(surface, progressbar->surface_bg, NULL, 0, 0);
surface->Blit(surface, progressbar->surface_fg, &rect, 0, 0);
} else if (clear)
lite_clear_box(box, region);
return DFB_OK;
}
示例2:
static int
DirectFB_UpdateClipRect(SDL_Renderer * renderer)
{
const SDL_Rect *rect = &renderer->clip_rect;
DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
IDirectFBSurface *destsurf = get_dfb_surface(data->window);
DFBRegion region;
if (!SDL_RectEmpty(rect)) {
region.x1 = rect->x;
region.x2 = rect->x + rect->w;
region.y1 = rect->y;
region.y2 = rect->y + rect->h;
SDL_DFB_CHECKERR(destsurf->SetClip(destsurf, ®ion));
} else {
SDL_DFB_CHECKERR(destsurf->SetClip(destsurf, NULL));
}
return 0;
error:
return -1;
}
示例3: surface_set_clip
static mrb_value surface_set_clip(mrb_state *mrb, mrb_value self)
{
IDirectFBSurface* surface = mrb_directfb_surface(mrb, self);
DFBResult ret = -1;
if (surface != NULL) {
const DFBRegion* clip;
mrb_value clip_object;
mrb_get_args(mrb, "o", &clip_object);
clip = mrb_directfb_region(mrb, clip_object);
ret = surface->SetClip(surface, clip);
}
return mrb_fixnum_value(ret);
}
示例4:
static int
DirectFB_UpdateViewport(SDL_Renderer * renderer)
{
IDirectFBSurface *winsurf = get_dfb_surface(renderer->window);
DFBRegion dreg;
dreg.x1 = renderer->viewport.x;
dreg.y1 = renderer->viewport.y;
dreg.x2 = dreg.x1 + renderer->viewport.w - 1;
dreg.y2 = dreg.y1 + renderer->viewport.h - 1;
winsurf->SetClip(winsurf, &dreg);
return 0;
}
示例5: show_usage
//.........这里部分代码省略.........
}
/* Create an image provider for the image to be loaded. */
ret = dfb->CreateImageProvider( dfb, url, &provider );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: IDirectFB::CreateImageProvider( '%s' ) failed!\n", url );
goto out;
}
/* Get the surface description. */
ret = provider->GetSurfaceDescription( provider, &desc );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: IDirectFBImageProvider::GetSurfaceDescription() failed!\n" );
goto out;
}
desc.pixelformat = DSPF_NV21;
D_INFO( "DFBTest/Scale: Source is %dx%d using %s\n",
desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) );
/* Create a surface for the image. */
ret = dfb->CreateSurface( dfb, &desc, &source );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: IDirectFB::CreateSurface() failed!\n" );
goto out;
}
ret = provider->RenderTo( provider, source, NULL );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: IDirectFBImageProvider::RenderTo() failed!\n" );
goto out;
}
desc.width = desc.width * 3 / 4;
desc.height = desc.height * 3 / 4;
D_INFO( "DFBTest/Scale: Destination is %dx%d using %s\n",
desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) );
/* Create a surface for the image. */
ret = dfb->CreateSurface( dfb, &desc, &dest );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: IDirectFB::CreateSurface() failed!\n" );
goto out;
}
DFBRectangle srect = {
10, 10, 200, 200
};
DFBRectangle drect = {
10, 10, 300, 300
};
DFBRegion clip = {
40, 40, 199, 199
};
dest->Clear( dest, 0xff, 0xff, 0xff, 0xff );
dest->SetClip( dest, &clip );
dest->StretchBlit( dest, source, &srect, &drect );
desc.pixelformat = DSPF_ARGB;
D_INFO( "DFBTest/Scale: Destination2 is %dx%d using %s\n",
desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) );
/* Create a surface for the image. */
ret = dfb->CreateSurface( dfb, &desc, &dest2 );
if (ret) {
D_DERROR( ret, "DFBTest/Scale: IDirectFB::CreateSurface() failed!\n" );
goto out;
}
dest2->Blit( dest2, dest, NULL, 0, 0 );
dest2->Dump( dest2, "dfbtest_scale_nv21", NULL );
out:
if (dest2)
dest2->Release( dest2 );
if (dest)
dest->Release( dest );
if (source)
source->Release( source );
if (provider)
provider->Release( provider );
/* Shutdown DirectFB. */
dfb->Release( dfb );
return ret;
}