本文整理汇总了C++中IDirectFBSurface::SetColorIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBSurface::SetColorIndex方法的具体用法?C++ IDirectFBSurface::SetColorIndex怎么用?C++ IDirectFBSurface::SetColorIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFBSurface
的用法示例。
在下文中一共展示了IDirectFBSurface::SetColorIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc,char *argv[])
{
int videofd1 = open("/dev/video0",O_RDWR);
int videofd2 = open("/dev/video0",O_RDWR);
IDirectFBSurface *SurfaceHandle;
IDirectFBSurface *SurfaceHandle2;
void *ptr,*ptr2;
int pitch,pitch2;
int colour_palette[256];
int colour_palette2_real[256]; /* random... */
int *colour_palette2 = colour_palette2_real;
int is_lut8;
is_lut8 = (argc > 1 && !strcmp (argv[1], "both"));
memset(&colour_palette,0x0,4*256);
//memset(&colour_palette[1],0xff,255*4);
colour_palette[0] = 0xff000000; // black
colour_palette[1] = 0xffff0000; // red
colour_palette[2] = 0xff00ff00; // green
colour_palette[3] = 0xff0000ff; // blue
colour_palette[4] = 0xffffffff; // white
colour_palette[5] = 0x80808000; // half-transp yellow
colour_palette[6] = 0x00000000; // transp black
if (videofd1 < 0)
perror("Couldn't open video device 1\n");
if (videofd2 < 0)
perror("Couldn't open video device 2\n");
v4l2_list_outputs (videofd1);
fb_make_transparent();
init_dfb(&SurfaceHandle,is_lut8);
init_dfb(&SurfaceHandle2,1);
v4l2_set_output_by_name (videofd1, "RGB1");
v4l2_set_output_by_name (videofd2, "RGB2");
init_v4l(videofd1,0,0,1280,720,is_lut8);
init_v4l(videofd2,0,0,1280,720,1);
printf("%s:%d\n",__FUNCTION__,__LINE__);
// memcpy (colour_palette, colour_palette2, sizeof (colour_palette));
colour_palette2 = colour_palette;
{
int coords = 60;
int size = 100;
// clear
if (!is_lut8) SurfaceHandle->Clear (SurfaceHandle, 0x00, 0x00, 0x00, 0x00);
else {
SurfaceHandle->SetColorIndex (SurfaceHandle, 0x6);
SurfaceHandle->FillRectangle (SurfaceHandle, 0, 0, 600, 600);
}
// White
if (is_lut8) SurfaceHandle->SetColorIndex (SurfaceHandle, 0x4);
else SurfaceHandle->SetColor (SurfaceHandle, 0xff, 0xff, 0xff, 0xff);
SurfaceHandle->FillRectangle (SurfaceHandle, coords, coords, size, size);
coords += size;
// Red
if (is_lut8) SurfaceHandle->SetColorIndex (SurfaceHandle, 0x1);
else SurfaceHandle->SetColor (SurfaceHandle, 0xff, 0x00, 0x00, 0xff);
SurfaceHandle->FillRectangle (SurfaceHandle, coords, coords, size, size);
coords += size;
// Green
if (is_lut8) SurfaceHandle->SetColorIndex (SurfaceHandle, 0x2);
else SurfaceHandle->SetColor (SurfaceHandle, 0x00, 0xff, 0x00, 0xff);
SurfaceHandle->FillRectangle (SurfaceHandle, coords, coords, size, size);
coords += size;
// Blue
if (is_lut8) SurfaceHandle->SetColorIndex (SurfaceHandle, 0x3);
else SurfaceHandle->SetColor (SurfaceHandle, 0x00, 0x00, 0xff, 0xff);
SurfaceHandle->FillRectangle (SurfaceHandle, coords, coords, size, size);
coords += size;
// half transp yellow
if (is_lut8) SurfaceHandle->SetColorIndex (SurfaceHandle, 0x5);
else SurfaceHandle->SetColor (SurfaceHandle, 0x80, 0x80, 0x00, 0x80);
SurfaceHandle->FillRectangle (SurfaceHandle, coords, coords, size, size);
coords += size;
// transp
if (is_lut8) SurfaceHandle->SetColorIndex (SurfaceHandle, 0x6);
else SurfaceHandle->SetColor (SurfaceHandle, 0x00, 0x00, 0x00, 0x00);
SurfaceHandle->FillRectangle (SurfaceHandle, coords, coords, size, size);
coords += size;
}
{
int xcoords = 60 + (100 * 6), ycoords = 60;
int size = 100;
// clear
SurfaceHandle2->SetColorIndex (SurfaceHandle2, 0x6);
SurfaceHandle2->FillRectangle (SurfaceHandle2, 220, 220, 440, 440);
// transp
//.........这里部分代码省略.........