日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

基于ARM开发板GEC6818的电子相册项目

發(fā)布時(shí)間:2024/1/18 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 基于ARM开发板GEC6818的电子相册项目 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

項(xiàng)目技術(shù)簡介

本項(xiàng)目主要是基于ARM開發(fā)板GEC6818,使用Linux平臺(tái)進(jìn)行代碼的編寫和交叉編譯。
項(xiàng)目主要通過freambuffer幀緩存驅(qū)動(dòng)來進(jìn)行圖片以及對應(yīng)字庫的顯示。

項(xiàng)目功能

  • 實(shí)現(xiàn)滑動(dòng)解鎖界面
  • 實(shí)現(xiàn)對圖片的檢索和顯示(包括正常顯示和縮放)
  • 游戲的移植(五子棋小游戲)

項(xiàng)目實(shí)現(xiàn)

項(xiàng)目頭文件

本項(xiàng)目通過調(diào)用Linux內(nèi)核鏈表來實(shí)現(xiàn)對圖片信息的儲(chǔ)存。

#ifndef _E_ALBUM_H#define _E_ALBUM_H/* ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 頭文件 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ */#include "list.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/mman.h> #include <sys/ioctl.h> #include <linux/input.h> #include <linux/fb.h> #include <unistd.h> #include <dirent.h> #include <pthread.h> #include <time.h> #include<math.h>#define LCD_PATH "/dev/fb0" #define IO_PATH "/dev/input/event0" #define SLIDE_PATH "./yelan.bmp" #define DESKTOP_PATH "./desktop.bmp" #define EXIT_PATH "./sea.bmp" #define LOAD_PATH "./picture/color.bmp" #define DZK_CHN_PATH "./kaiti.Dzk" #define DZK_ASC_PATH "./ascii.Dzk" #define DIR_PATH "./photo/" #define LENGTH 256*2 #define RATIO 4 //縮小倍數(shù) #define NORMAL 1 #define SMALL 0/* ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ 頭文件 ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ *//* ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 結(jié)構(gòu)體 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ */ typedef struct dev_inf // 設(shè)備初始化信息 {int lcd_fd;int touch_fd;int * lcd_mmap;int lcd_w,lcd_h;}DEV_INF, * P_DEV_INF;typedef struct Chinese_character //字庫結(jié)構(gòu)體 {int fd;int size;char * mmap_p; }CH,* P_CH;typedef struct data_list // 鏈表數(shù)據(jù) {int num;char * name;char * path;struct list_head pointer;} DL, *DL_LINK;struct get_coordinates // 獲取坐標(biāo)信息 {int where_x;int where_y;bool press; }Coords;/* ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ 結(jié)構(gòu)體 ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ *//* ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 函數(shù)聲明 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ */ P_DEV_INF Dev_inf_init();//設(shè)備信息初始化 DL_LINK Create_node();//初始化創(chuàng)建鏈表 P_CH Character_init(char * str);// 初始化字庫 int Free_space(P_DEV_INF inf_d,DL_LINK head);//釋放空間int Traverse_list(DL_LINK head,P_DEV_INF inf_d); //遍歷鏈表,顯示縮略圖 DL_LINK Find_node(DL_LINK head,int num);//檢索節(jié)點(diǎn)void * Get_instant_coordinates(P_DEV_INF inf_d); //獲取坐標(biāo) int Search_save_bmp(const char * dir_name,DL_LINK head);//檢索圖片并保存到鏈表中 int Clean_lcd(P_DEV_INF inf_d);//清屏 int Show_picture(P_DEV_INF inf_d,const char * picture,int flag,int times);//展示圖片 int Touch_change_picture(P_DEV_INF inf_d,DL_LINK head);//按下切換圖片int Display_Chinese(P_DEV_INF inf_d,char * string,int where_x,int where_y);//顯示漢字 int Display_Ascii(P_DEV_INF inf_d,char * string,int where_x,int where_y);//顯示字母int Slidelocker(P_DEV_INF inf_d,DL_LINK head);// 滑動(dòng)解鎖界面 int Desktop(P_DEV_INF inf_d,DL_LINK head);//主界面顯示 int Loading_UI(P_DEV_INF inf_d,char * str);//檢索加載界面 int Album_UI(P_DEV_INF inf_d,DL_LINK head); //相冊界面 void * Time_display(P_DEV_INF inf_d);//顯示時(shí)間/* ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ 函數(shù)聲明 ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ *///游戲函數(shù) int Go_point(int *XP,int *YP,int *mark_who,P_DEV_INF inf_d); int panduan(int x,int y); void star_game(P_DEV_INF inf_d,int *XP,int *YP); void lcd_point(int x,int y,unsigned int color,P_DEV_INF inf_d); void yuan(int x,int y,int r,unsigned int color,P_DEV_INF inf_d); void chessboard(P_DEV_INF inf_d);#endif

主函數(shù)

#include "e_album.h"int main() {DL_LINK head = Create_node();if (head == (DL_LINK)NULL){printf("創(chuàng)建頭節(jié)點(diǎn)出錯(cuò)!\n");return -1;}P_DEV_INF inf_d = Dev_inf_init();if(inf_d == (P_DEV_INF)-1){printf("初始化失敗!\n");return -1;}//創(chuàng)建線程實(shí)時(shí)獲取坐標(biāo)pthread_t coords_id;if(pthread_create(&coords_id,NULL,(void *)&Get_instant_coordinates,(void *)(inf_d)) != 0){perror("pthread_create ...");return -1;}pthread_t time_id;if(pthread_create(&time_id,NULL,(void*)&Time_display,(void *)(inf_d)) != 0){perror("pthread_create ...");return -1;}struct fb_var_screeninfo var;memset(&var,0,sizeof(var));var.xoffset = 0;var.yoffset = 0;ioctl(inf_d->lcd_fd,FB_ACTIVATE_NOW,&var);ioctl(inf_d->lcd_fd,FBIOPAN_DISPLAY,&var);Search_save_bmp(DIR_PATH,head);Slidelocker(inf_d,head);pthread_cancel(time_id);pthread_cancel(coords_id);Free_space(inf_d,head);return 0; }

兩個(gè)線程Get_instant_coordinates(),Time_display()

void * Get_instant_coordinates(P_DEV_INF inf_d) //��?���� {struct input_event touch;while(1){if(read(inf_d->touch_fd,&touch,sizeof(touch)) == -1){perror("read touch screen");return (void*)-1;}if(touch.type == EV_ABS && touch.code == ABS_X) {Coords.where_x = touch.value*800/1024;}if(touch.type == EV_ABS && touch.code == ABS_Y) {Coords.where_y = touch.value*480/600;}if(touch.type == EV_KEY && touch.code == BTN_TOUCH){Coords.press = touch.value;}printf("where_x: %d where_y: %d\npress:%d\n",Coords.where_x,Coords.where_y,Coords.press);}return 0; }void * Time_display(P_DEV_INF inf_d)//顯示時(shí)間 {char date[100];while(1){time_t nowtime;time(&nowtime); //printf("%ld\n",nowtime);strcpy(date,ctime(&nowtime));//printf("%s\n",date);Display_Ascii(inf_d,date,0,0);}return 0; }

設(shè)備初始化

lcd屏幕的初始化以及觸摸屏的初始化

P_DEV_INF Dev_inf_init()//設(shè)備信息初始化 {P_DEV_INF inf_d = (P_DEV_INF)malloc(sizeof(DEV_INF));if(inf_d == (P_DEV_INF)NULL){perror("malloc dev failed");return (P_DEV_INF)-1;}memset(inf_d,0,sizeof(DEV_INF));//打開lcd,觸摸屏inf_d->lcd_fd = open(LCD_PATH,O_RDWR);if(inf_d->lcd_fd == -1){perror("open lcd failed");return (P_DEV_INF)-1;}inf_d->touch_fd = open(IO_PATH,O_RDWR);if(inf_d->touch_fd == -1){perror("open touch screen failed");return (P_DEV_INF)-1;}struct fb_var_screeninfo var_inf;memset(&var_inf,0,sizeof(var_inf));if(ioctl(inf_d->lcd_fd,FBIOGET_VSCREENINFO,&var_inf) == -1){perror("ioctl failed");return (P_DEV_INF)-1;}//映射lcd,觸摸屏inf_d->lcd_w = var_inf.xres;inf_d->lcd_h = var_inf.yres;printf("lcd屏幕寬度:%d 高度:%d\n",inf_d->lcd_w,inf_d->lcd_h);inf_d->lcd_mmap = mmap(NULL,4*(inf_d->lcd_w)*(inf_d->lcd_h),PROT_WRITE | PROT_READ,MAP_SHARED,inf_d->lcd_fd,0);if(inf_d->lcd_mmap == MAP_FAILED){perror("mmap lcd failed");return (P_DEV_INF)-1;}return inf_d; }

字庫初始化

P_CH Character_init(char * str)// 字庫初始化 {P_CH dzk = (P_CH)malloc(sizeof(CH));if(dzk == (P_CH)NULL){perror("malloc dzk failed");return (P_CH)-1;}dzk->fd = open(str,O_RDWR);if(dzk->fd == -1){perror("open dzk failed");return (P_CH)-1;}struct stat file_stat;if(stat(str,&file_stat) == -1){perror("stat failed ..");return (P_CH)-1;}dzk->size = file_stat.st_size;//printf("字庫大小:%d\n",dzk->size);dzk->mmap_p = mmap(NULL,dzk->size,PROT_READ | PROT_WRITE,MAP_SHARED,dzk->fd,0);if(dzk->mmap_p == MAP_FAILED){perror("mmap dzk failed");return (P_CH)-1;}return dzk; }

創(chuàng)建節(jié)點(diǎn)

DL_LINK Create_node()//創(chuàng)建節(jié)點(diǎn) {DL_LINK node = (DL_LINK)malloc(sizeof(DL));if(node == (DL_LINK)NULL){perror("malloc list");return (DL_LINK)-1;}memset(node,0,sizeof(DL));node->name = malloc(LENGTH);node->path = malloc(LENGTH);if(node->name==NULL || node->path==NULL){printf("malloc node");return (DL_LINK)-1;}memset(node->name,0,LENGTH);memset(node->path,0,LENGTH);node->num = 0;INIT_LIST_HEAD(&(node->pointer));return node; } DL_LINK Find_node(DL_LINK head,int num) //檢索節(jié)點(diǎn) {if(head == NULL){printf("頭節(jié)點(diǎn)異常!\n");return (DL_LINK)-1;}if(list_empty(&(head->pointer)))//{printf("空鏈表,無法檢索!\n");return (DL_LINK)0;}DL_LINK pos = NULL;list_for_each_entry(pos,&(head->pointer),pointer){if(pos->num == num){printf("擊中目標(biāo)!\n");return pos;}}printf("未找到目標(biāo)!\n");return (DL_LINK)0; }

釋放空間

int Free_space(P_DEV_INF inf_d,DL_LINK head)//釋放空間 {if(close(inf_d->lcd_fd)==-1 || close(inf_d->touch_fd)==-1){perror("close inf_d failed");return -1;}if(munmap(inf_d->lcd_mmap,4*(inf_d->lcd_w)*(inf_d->lcd_h))==-1){perror("munmap inf_d failed");return -1;}free(inf_d);DL_LINK pos;DL_LINK last_node = list_entry(head->pointer.prev,DL,pointer);list_for_each_entry(pos,&(head->pointer),pointer){DL_LINK free_node = list_entry(pos->pointer.prev,DL,pointer);free_node->pointer.next = free_node->pointer.prev = NULL;free(free_node->name);free(free_node->path);free(free_node);printf("---\n");}free(last_node->name);free(last_node->path);free(last_node);return 0; }

主函數(shù)

滑動(dòng)解鎖

實(shí)例代碼如下:
手指觸碰生成50*50的方塊,其余位置補(bǔ)色;當(dāng)觸碰到結(jié)尾區(qū)域時(shí)進(jìn)入主界面。

int Slidelocker(P_DEV_INF inf_d,DL_LINK head)// 滑動(dòng)解鎖界面 {Show_picture(inf_d,SLIDE_PATH,NORMAL,0);while (1){if(Coords.where_y>350 && Coords.where_y<450)//滑動(dòng)的模塊{for(int y = 363; y<438; y++){for(int x = 0; x<800; x++){if(x > Coords.where_x-50 && x < Coords.where_x+50){*(inf_d->lcd_mmap+inf_d->lcd_w*y+x) = 0x3A61BD;}else{*(inf_d->lcd_mmap+inf_d->lcd_w*y+x) = 0x4F4F6B;}}}if(Coords.where_x>740 && Coords.where_x<800){Desktop(inf_d,head);return 0;}}}

圖片的檢索和顯示

圖片檢索

對指定路徑的的圖片進(jìn)行檢索并將圖片順序,名字和路徑存入鏈表中。

int Search_save_bmp(const char * dir_name,DL_LINK head)//檢索圖片目錄路徑并保存到鏈表中 {DIR * dp = opendir(dir_name);if(dp == NULL){ perror("opendir failed");return -1;}char * obj = ".bmp";char * name = NULL;char complete_path[LENGTH];int n = 0;while(1){memset(complete_path,0,LENGTH);struct dirent * eq = readdir(dp);if(eq == NULL){//printf("已讀取到文件末尾!\n");break;}if(eq->d_name[0] == '.') continue;if(dir_name[strlen(dir_name)-1] == '/'){sprintf(complete_path,"%s%s",dir_name,eq->d_name);}else{sprintf(complete_path,"%s/%s",dir_name,eq->d_name);}if(eq->d_type == DT_DIR){if(Search_save_bmp(complete_path,head)==-1){printf("檢索失敗!\n");return -1;} }if(eq->d_type == DT_REG){name = rindex(eq->d_name,'.');if(name != NULL && strcmp(name,obj)==0){printf("找到目標(biāo)文件:%s\n",complete_path);DL_LINK new_node = Create_node();if(new_node == (DL_LINK)NULL){printf("創(chuàng)建新節(jié)點(diǎn)失敗!\n");return -1;}strcpy(new_node->name,eq->d_name);strcpy(new_node->path,complete_path);list_add_tail(&(new_node->pointer),&(head->pointer));//將節(jié)點(diǎn)尾插進(jìn)鏈表n += 1; new_node->num = n;}}}if(closedir(dp) == -1){perror("closedir failed");return -1;}return 0; }

顯示圖片(縮略是SMALL,普通顯示為NORMAL)

int Show_picture(P_DEV_INF inf_d,const char * picture,int flag,int times)//展示圖片 {//Clean_lcd(inf_d);int bmp_w,bmp_h;int skip;int bmp_fd = open(picture,O_RDONLY);if(bmp_fd == -1){perror("open bmp");return -1;}lseek(bmp_fd,18,SEEK_SET);if(read(bmp_fd,&bmp_w,4) == -1 || read(bmp_fd,&bmp_h,4)==-1){perror("read failed");return -1;}if(bmp_w*3%4 == 0){skip = 0;}else{skip = 4-bmp_w*3%4;}int pixel_size = 3*bmp_w*bmp_h+skip*bmp_h;char rgb[pixel_size];lseek(bmp_fd,54,SEEK_SET);if(read(bmp_fd,&rgb,pixel_size) == -1){perror("read bmp");return -1;}if(flag == NORMAL)//在中心正常大小顯示{int * new_mmap_p = inf_d->lcd_mmap+ (inf_d->lcd_w \* (inf_d->lcd_h/2-bmp_h/2) \+ (inf_d->lcd_w/2-bmp_w/2)); for(int y=0,n=0; y<bmp_h; y++){for(int x=0; x<bmp_w; x++,n+=3){*(new_mmap_p+(inf_d->lcd_w)*(bmp_h-1-y)+x) \= rgb[n]<<0 | rgb[n+1]<<8 | rgb[n+2]<<16;}n += skip;}}else if(flag == SMALL)//縮略顯示{int y_new,x_new;int m = times%3;int n = times/3;x_new = bmp_w/RATIO*m + 30*(m+1);//計(jì)算顯示位置y_new = bmp_h/RATIO*n + 30*(n+1);int * new_mmap_p = inf_d->lcd_mmap + (inf_d->lcd_w*y_new+x_new);for(int y=0,rgb_y=0; y<bmp_h/RATIO; y++,rgb_y+=(RATIO)){for(int x=0,rgb_x=0; x<bmp_w/RATIO; x++,rgb_x+=3*RATIO){*(new_mmap_p + (inf_d->lcd_w)*(bmp_h/RATIO-1-y)+x) = \rgb[(3*bmp_w+skip)*rgb_y+rgb_x] <<0 | \rgb[((3*bmp_w+skip)*rgb_y+rgb_x)+1] <<8 | \rgb[((3*bmp_w+skip)*rgb_y+rgb_x)+2] <<16; // 200 x 120} }printf("mmap: %p\n",new_mmap_p);printf("x_new:%d y_new:%d\n",x_new,y_new);printf("offset:%d\n",(inf_d->lcd_w*y_new+x_new));printf("times:%d\n",times);} if(close(bmp_fd)==-1){perror("close bmp");return -1;}return 0; }

展示圖片

int Traverse_list(DL_LINK head,P_DEV_INF inf_d) //遍歷鏈表 顯示縮略圖片 {if(head == NULL){printf("頭節(jié)點(diǎn)異常!\n");return -1;}if(list_empty(&(head->pointer)))//{printf("空鏈表,無需遍歷!\n");return 0;}DL_LINK pos = NULL;//調(diào)用內(nèi)核鏈表int times = 0;// DL_LINK tmp_node = list_entry(head->pointer.next,DL,pointer);// Show_picture(inf_d,tmp_node->path,NORMAL,0);Clean_lcd(inf_d);list_for_each_entry(pos,&(head->pointer),pointer){printf("%s\n",pos->path);if(pos->num == 0) break;if(times < 9){Show_picture(inf_d,pos->path,SMALL,times);int m = times%3;int n = times/3;Display_Ascii(inf_d,pos->name,50+230*m,157+150*n);//顯示圖名times++;} else break; }return 0; }

清屏函數(shù)

int Clean_lcd(P_DEV_INF inf_d)//清屏 {for(int y=0; y<inf_d->lcd_h; y++){for(int x=0; x<inf_d->lcd_w; x++){*(inf_d->lcd_mmap + (inf_d->lcd_w)*y+x) = 0xFFEEFF;}}return 0; }

按下切換上下張圖片,遇到頭結(jié)點(diǎn)跳過

int Touch_change_picture(P_DEV_INF inf_d,DL_LINK head)//按下切換圖片 {Coords.press = false;DL_LINK tmp_node = list_entry(head->pointer.next,DL,pointer);while(1){//點(diǎn)擊切換上下張if(Coords.press == true){printf("坐標(biāo)x:%d y:%d\n",Coords.where_x,Coords.where_y); if(Coords.where_x <= 200){tmp_node = list_entry(tmp_node->pointer.prev,DL,pointer);}else if(Coords.where_x >= 600){tmp_node = list_entry(tmp_node->pointer.next,DL,pointer);}else{return 0;}if(tmp_node == head){if(Coords.where_x <= 200){tmp_node = list_entry(tmp_node->pointer.prev,DL,pointer);}else if(Coords.where_x >= 600){tmp_node = list_entry(tmp_node->pointer.next,DL,pointer);}}Show_picture(inf_d,tmp_node->path,NORMAL,0);Coords.press = false;}}return 0; }

調(diào)用字庫顯示漢字、字母

//漢字 int Display_Chinese(P_DEV_INF inf_d,char * string,int where_x,int where_y) {P_CH dzk = Character_init(DZK_CHN_PATH);int len = strlen(string);char * fontl;for(int lp = 0; lp<len; lp += 2){fontl = string+lp;int offset = (94*(fontl[0]-1-0xa0)+(fontl[1]-1-0xa0)) * 72;char * new_dzk_mmap = dzk->mmap_p + offset;int * new_lcd_mmap = inf_d->lcd_mmap + (inf_d->lcd_w)*where_y+where_x;char datatype;for(int y = 0; y<24; y++){for(int x = 0; x<24/8; x++){datatype = *(new_dzk_mmap+(24/8)*y+x);for(int z = 0; z<8; z++){if(datatype & 0x80>>z){*(new_lcd_mmap+(inf_d->lcd_w*y+8*x+z)) = 0x000000;}else{*(new_lcd_mmap+(inf_d->lcd_w*y+8*x+z)) = 0x57DDFF;}}}}where_x += 24;} if(close(dzk->fd) == -1){perror("close failed ");return -1;}if(munmap(dzk->mmap_p,dzk->size) == -1){perror("mumap failed");return -1;}free(dzk);return 0; }//字母 int Display_Ascii(P_DEV_INF inf_d,char * string,int where_x,int where_y) {P_CH dzk = Character_init(DZK_ASC_PATH);int len = strlen(string);char character;for(int lp = 0; lp<len; lp ++){character = string[lp];int offset = character * 32;char * new_dzk_mmap = dzk->mmap_p + offset;int * new_lcd_mmap = inf_d->lcd_mmap + (inf_d->lcd_w)*where_y+where_x;char datatype;for(int y = 0; y<16; y++){for(int x = 0; x<16/8; x++){datatype = *(new_dzk_mmap+(16/8)*y+x);for(int z = 0; z<8; z++){if(datatype & 0x80>>z){*(new_lcd_mmap+(inf_d->lcd_w*y+8*x+z)) = 0x000000;}else{*(new_lcd_mmap+(inf_d->lcd_w*y+8*x+z)) = 0x57DDFF;}}}}where_x += 16;}if(close(dzk->fd) == -1){perror("close failed ");return -1;}if(munmap(dzk->mmap_p,dzk->size) == -1){perror("mumap failed");return -1;}free(dzk); return 0; }

主界面顯示(Desktop)

主界面主要包括相冊,游戲以及退出按鈕

int Desktop(P_DEV_INF inf_d,DL_LINK head)//主界面顯示 {while(1){Coords.where_x = -1;Coords.where_y = -1;Show_picture(inf_d,DESKTOP_PATH,NORMAL,0);if(Coords.press == 1){if((Coords.where_x>130 && Coords.where_x<243)&&\(Coords.where_y>190 && Coords.where_y<300)){Loading_UI(inf_d,LOAD_PATH);//檢索加載界面Album_UI(inf_d,head);continue; }else if((Coords.where_x>570 && Coords.where_x<690)&&\(Coords.where_y>180 && Coords.where_y<300)){Clean_lcd(inf_d);int XP;int YP;star_game(inf_d,&XP,&YP);// Clean_lcd(inf_d);// Display_Chinese(inf_d,"開發(fā)中,敬請期待!",300,210);//游戲// Display_Ascii(inf_d,"Under development, stay tuned!",160,245);// sleep(1);continue;}else if((Coords.where_x>720 && Coords.where_x<790)&&\(Coords.where_y>10 && Coords.where_y<90)){Show_picture(inf_d,EXIT_PATH,NORMAL,0);Display_Chinese(inf_d,"正在退出!",350,216);sleep(1);Clean_lcd(inf_d);return 0;//退出}}}return 0; }int Album_UI(P_DEV_INF inf_d,DL_LINK head) //相冊界面 {Coords.where_x = -1;Coords.where_y = -1;int flags = 0;Traverse_list(head,inf_d);Display_Chinese(inf_d,"退出",720,60+105*0);Display_Chinese(inf_d,"相冊",720,60+105*1);Display_Chinese(inf_d,"上一頁",710,60+105*2);Display_Chinese(inf_d,"下一頁",710,60+105*3);struct fb_var_screeninfo var;memset(&var,0,sizeof(var));printf("1visual:%d\n",var.yoffset);while(1){if(Coords.where_x>710 && Coords.where_x<770)//相冊目錄操作{if(Coords.where_y>50 && Coords.where_y<110){ return 0;//退出}else if(Coords.where_y>155 && Coords.where_y<215){Touch_change_picture(inf_d,head);//進(jìn)入相冊Album_UI(inf_d,head);continue;}else if(Coords.where_y>260 && Coords.where_y<320)//上一頁{Album_UI(inf_d,head);continue;//printf("2visual:%d\n",var.yoffset); }else if(Coords.where_y>365 && Coords.where_y<425)//下一頁{// var.xoffset = 0;// var.yoffset = 480;// ioctl(inf_d->lcd_fd,FB_ACTIVATE_NOW,&var);// ioctl(inf_d->lcd_fd,FBIOPAN_DISPLAY,&var);Coords.where_x = -1;Coords.where_y = -1;DL_LINK tmp = Find_node(head,9); Traverse_list(tmp,inf_d);Display_Chinese(inf_d,"退出",720,60+105*0);Display_Chinese(inf_d,"相冊",720,60+105*1);Display_Chinese(inf_d,"上一頁",710,60+105*2);Display_Chinese(inf_d,"下一頁",710,60+105*3);flags = 1;//Coords.press = 0;continue; }}DL_LINK tmp_node = NULL;if(Coords.press == 1){if((Coords.where_y>35 && Coords.where_y<155))//第一行{if(Coords.where_x>30 && Coords.where_x<230){tmp_node = Find_node(head,1+flags*9); }else if(Coords.where_x>260 && Coords.where_x<460){tmp_node = Find_node(head,2+flags*9); }else if(Coords.where_x>490 && Coords.where_x<690){tmp_node = Find_node(head,3+flags*9); }}else if(Coords.where_y>190 && Coords.where_y<310)//第二行{if(Coords.where_x>30 && Coords.where_x<230){tmp_node = Find_node(head,4+flags*9); }else if(Coords.where_x>260 && Coords.where_x<460){tmp_node = Find_node(head,5+flags*9); }else if(Coords.where_x>490 && Coords.where_x<690){tmp_node = Find_node(head,6+flags*9); }}else if(Coords.where_y>345 && Coords.where_y<465)//第三行{if(Coords.where_x>30 && Coords.where_x<230){tmp_node = Find_node(head,7+flags*9); }else if(Coords.where_x>260 && Coords.where_x<460){ tmp_node = Find_node(head,8+flags*9);}else if(Coords.where_x>490 && Coords.where_x<690){tmp_node = Find_node(head,9+flags*9);}}if(tmp_node != NULL){Show_picture(inf_d,tmp_node->path,NORMAL,0);sleep(1);}if(flags == 0)Album_UI(inf_d,head);else if(flags == 1){Coords.where_x = 720;Coords.where_y = 390;}continue;}}return 0; }int Loading_UI(P_DEV_INF inf_d,char * str)//檢索加載界面 {Show_picture(inf_d,str,NORMAL,0);int load_x = 200, load_y = 200;int load_w = 400, load_h = 80;int * new_mmap = inf_d->lcd_mmap + (inf_d->lcd_w *load_y+load_x);Display_Chinese(inf_d,"圖片檢索中。。。",300,150);for(int x = 0; x<load_w; x++){for(int y = 0; y<load_h; y++){*(new_mmap+inf_d->lcd_w*y+x) = 0x57DDFF;}usleep(1000);}Display_Chinese(inf_d,"檢索完成!",330,330);Display_Chinese(inf_d,"共有十二張圖片",310,360);sleep(1);return 0; }

以上就是項(xiàng)目全況。

總結(jié)

以上是生活随笔為你收集整理的基于ARM开发板GEC6818的电子相册项目的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。