91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

linux從framebuffer獲取image源碼

資源截圖

代碼片段和文件信息

/*
?*?File:????gsnap.c
?*?Author:??Li?XianJing?
?*?Brief:???snap?the?linux?mobile?device?screen.
?*
?*?Copyright?(c)?2009-2011??Li?XianJing?
?*
?*/

/*
?*?History:
?*?================================================================
?*?2009-08-20?Li?XianJing??created
?*?2011-02-28?Li?XianJing??suppport?RGB888?framebuffer.
?*?2011-04-09?Li?XianJing??merge?figofuture‘s?png?output.
?*? ref:?http://blog.chinaunix.net/space.php?uid=15059847&do=blog&cuid=2040565
?*
?*/

#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?

struct?_FBInfo;
typedef?struct?_FBInfo?FBInfo;
typedef?int?(*UnpackPixel)(FBInfo*?fb?unsigned?char*?pixel?
unsigned?char*?r?unsigned?char*?g?unsigned?char*?b);

struct?_FBInfo
{
int?fd;
UnpackPixel?unpack;
unsigned?char?*bits;
struct?fb_fix_screeninfo?fi;
struct?fb_var_screeninfo?vi;
};

#define?fb_width(fb)??((fb)->vi.xres)
#define?fb_height(fb)?((fb)->vi.yres)
#define?fb_bpp(fb)????((fb)->vi.bits_per_pixel>>3)
#define?fb_size(fb)???((fb)->vi.xres?*?(fb)->vi.yres?*?fb_bpp(fb))
#define?fb_line_length(fb)?((fb)->fi.line_length)

static?int?fb_unpack_rgb565(FBInfo*?fb?unsigned?char*?pixel?
unsigned?char*?r?unsigned?char*?g?unsigned?char*?b)
{
unsigned?short?color?=?*(unsigned?short*)pixel;

*r?=?((color?>>?11)?&?0xff)?< *g?=?((color?>>?5)?&?0xff)??< *b?=?(color?&?0xff?)<
return?0;
}

static?int?fb_unpack_rgb24(FBInfo*?fb?unsigned?char*?pixel?
unsigned?char*?r?unsigned?char*?g?unsigned?char*?b)
{
*r?=?pixel[fb->vi.red.offset>>3];
*g?=?pixel[fb->vi.green.offset>>3];
*b?=?pixel[fb->vi.blue.offset>>3];

return?0;
}

static?int?fb_unpack_argb32(FBInfo*?fb?unsigned?char*?pixel?
unsigned?char*?r?unsigned?char*?g?unsigned?char*?b)
{
*r?=?pixel[fb->vi.red.offset>>3];
*g?=?pixel[fb->vi.green.offset>>3];
*b?=?pixel[fb->vi.blue.offset>>3];

return?0;
}

static?int?fb_unpack_none(FBInfo*?fb?unsigned?char*?pixel?
unsigned?char*?r?unsigned?char*?g?unsigned?char*?b)
{
*r?=?*g?=?*b?=?0;

return?0;
}

static?void?set_pixel_unpacker(FBInfo*?fb)
{
if(fb_bpp(fb)?==?2)
{
fb->unpack?=?fb_unpack_rgb565;
}
else?if(fb_bpp(fb)?==?3)
{
fb->unpack?=?fb_unpack_rgb24;
}
else?if(fb_bpp(fb)?==?4)
{
fb->unpack?=?fb_unpack_argb32;
}
else
{
fb->unpack?=?fb_unpack_none;
printf(“%s:?not?supported?format.\n“?__func__);
}

return;
}

static?int?fb_open(FBInfo*?fb?const?char*?fbfilename)
{
fb->fd?=?open(fbfilename?O_RDWR);

if?(fb->fd? {
fprintf(stderr?“can‘t?open?%s\n“?fbfilename);

return?-1;
}

if?(ioctl(fb->fd?FBIOGET_FSCREENINFO?&fb->fi)? goto?fail;

if?(ioctl(fb->fd?FBIOGET_VSCREENINFO?&fb->vi)? goto?fail;

fb->bits?=?mmap(0?fb_size(fb)?PROT_READ?|?PR

評(píng)論

共有 條評(píng)論