No putchar ? No problem :D [DB3210] : Эльфостроение : Форум |
mc_kibel: |
25.05.10, 21:49 |
Hi, I tried to find a way how to draw images on screen without putchar. And I found it I didn't want to improve algorithm (maybe no time, maybe I'm not so good programmer), so image must be: +reversed in vertical +reversed in horizontal. It caused by .bmp file format. Colors are written from bottom to top. So image must be like this: Bmp header length is 0x36. So I'm starting to read data after the header and I'm writting them in an array. Код: #include "..\\include\Lib_Clara.h" #include "..\\include\Dir.h" #define fseek lseek int fpos = 0x36; int bmp[320*320]; (...) int fsize (int file) { int len = fseek (file,0,2); debug_printf ("\n len: %d \n", len); fseek (file,0,0); return (len); } int _fgetc (int file) { char tmp; fread(file,&tmp,1); fseek (file,++fpos,0); return (tmp); } int MyGuiOnCreate(DISP_OBJ *db) { gc = get_DisplayGC(); int f = fopen (L"/card/other/Ex1.bmp",WA_Read,0x180); int filesize = fsize (f); fseek (f,fpos,0); int bmppos = 0; while (fpos < filesize-10) { int b = _fgetc (f); int g = _fgetc (f); int r = _fgetc (f); int color = 0xFF000000 + r * 0x10000 + g * 0x100 + b; bmp[bmppos] = color; bmppos++; //debug_printf ("\n --->>>>color: #%X \n",color); } //redr_timer=Timer_Set(10,onRedrTimer,0); return 1; } (....) void MyGuiOnRedraw(DISP_OBJ *db,int ,int ,int ) { GC_WritePixels(gc, 0, 0, 240, 320, bmp ); } (...) It takes some second to write every color into an array. I hope it will be useful for elf developers. This idea is my own idea, maybe it's stupid. But it can surely be improved (I think it won't be a problem to set 0xFF000000 as alpha-channel). I tested this on some bitmaps, saved in 24bit :) [ Редактировано mc_kibel в 25.5.10 20:51 ] [ Редактировано mc_kibel в 26.5.10 17:39 ] |
KrasH: |
25.05.10, 22:11 |
We can draw images by gettin' ImageManager object and using its methods. Just CoCreateInstance func is needed |
mc_kibel: |
25.05.10, 23:40 |
KrasH пишет: We can draw images by gettin' ImageManager object and using its methods. Just CoCreateInstance func is needed Can you explain a little bit more ? |
URL этой темы: https://mobilefree.justdanpo.ru/newbb_plus/viewtopic.php?topic_id=4831 © 2005-2018 supertrubka.org |