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

資源簡介

本程序中用比簡單的方法來進行bmp圖片的讀取,并用linux 下的framebuffer來顯示到屏幕上

資源截圖

代碼片段和文件信息

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

#include?“fbv.h“

int?openFB(const?char?*name);
void?closeFB(int?fh);
void?getVarScreenInfo(int?fh?struct?fb_var_screeninfo?*var);
void?getFixScreenInfo(int?fh?struct?fb_fix_screeninfo?*fix);

int?openFB(const?char?*name)
{
????int?fh;
????char?*dev;

????if(name?==?NULL){
dev?=?getenv(“frameBUFFER“);
if(dev)?name?=?dev;
else?name?=?DEFAULT_frameBUFFER;
????}
????
????if?((fh?=?open(name?O_RDWR))?==?-1){
????????fprintf(stderr?“open?%s:?%s\n“?name?strerror(errno));
exit(1);
????}
????return?fh;
}

void?closeFB(int?fh)
{
????close(fh);
}
void?getVarScreenInfo(int?fh?struct?fb_var_screeninfo?*var)
{
????if?(ioctl(fh?FBIOGET_VSCREENINFO?var)){
????????fprintf(stderr?“ioctl?FBIOGET_VSCREENINFO:?%s\n“?strerror(errno));
exit(1);
????}
}

void?getFixScreenInfo(int?fh?struct?fb_fix_screeninfo?*fix)
{
????if?(ioctl(fh?FBIOGET_FSCREENINFO?fix)){
????????fprintf(stderr?“ioctl?FBIOGET_FSCREENINFO:?%s\n“?strerror(errno));
exit(1);
????}
}


int?bmp_display(unsigned?char?*rgbbuffint?x_size?int?y_sizeint*x_offsint*y_offsint?bpp)
{
uint32_t?offset;
??? uint8_t?color[4];
??? int?width?=?0?height?=?0;???
unsigned?char?*tmp?=?(unsigned?char?*)(rgbbuff);
unsigned?long?fb_mem_offset;
???? unsigned?long?fb_mem;
struct?fb_var_screeninfo?var;
???? struct?fb_fix_screeninfo?fix;


int?fh=-1;
fh?=?openFB(NULL);

?int?i=0j=0;
??? ?int?bit4_flag?=?0;
??? ?int?bit2_flag?=?0;
??? ?????
getVarScreenInfo(fh?&var);
getFixScreenInfo(fh?&fix);

fb_mem_offset?=?(unsigned?long)(fix.smem_start)?&?(~PAGE_MASK);
fb_mem?=?(unsigned?long?int)mmap(NULL?fix.smem_len?+?fb_mem_offset
PROT_READ?|?PROT_WRITE?MAP_SHARED?fh?0);
if?(-1L?==?(long)fb_mem)
???? {
?????? ?printf(“mmap?error!?mem:%ld?offset:%ld\n“?fb_mem?fb_mem_offset);
??????? ?return?-1;
??? ?}
?
??? ?width?=?*x_offs?+?x_size;
??? ?height?=?*y_offs?+?y_size;
?? ?
??? ?for(i?=?*y_offs;?i????? {?
for(j?=?*x_offs;?j? {
???//?DBG_INFO(“i=%d--j=%d\n“i?j);
????switch?(bpp)
????{
case?1:
????//DBG_INFO(“BMP?BitCount?is?1?\n“);
????tmp[0]?=?(tmp[0]>>bit2_flag)&0x01;
????color[0]?=?(uint8_t)((int)(rgbbuff)?-?2*4?+?tmp[0]?+?0);
????color[1]?=?(uint8_t)((int)(rgbbuff)?-?2*4?+?tmp[0]?+?1);
????color[2]?=?(uint8_t)((int)(rgbbuff)?-?2*4?+?tmp[0]?+?2);
????color[3]?=?0x00;
????offset?=?(j?+?var.xoffset)?*?(var.bits_per_pixel/8)?+?(i?+?var.yoffset)?*?fix.line_length;
????memcpy((void*)(fb_mem?+?offset)?color?4);?
????if(bit2_flag? ????{
bit2_flag?++;
????}
????else
????{
tmp?=?tmp?+?1;
bit2_flag?=?0;
????}
????break;
case?4:
????if(bit4_flag?==?0)
????{
tmp[0]?=?(tmp

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????4434??2012-07-18?11:50??bmp\bmp_display.c

?????文件???????4453??2012-07-18?10:28??bmp\bmp_read.c

?????文件???????5400??2012-07-19?08:43??bmp\draw_picture.c

?????文件???????5628??2012-07-18?15:22??bmp\draw_picture.c~

?????文件???????1653??2012-07-19?08:57??bmp\draw_picture.h

?????文件???????1025??2012-07-18?11:44??bmp\fbv.h

?????文件??????54056??2007-03-06?14:39??bmp\logo24.bmp

?????文件????????632??2012-07-19?08:06??bmp\main.c

?????文件????????689??2012-07-18?15:18??bmp\main.c~

?????文件????????556??2012-07-16?15:36??bmp\makefile

?????目錄??????????0??2012-07-19?16:15??bmp

-----------?---------??----------?-----??----

????????????????78526????????????????????11


評論

共有 條評論