Все для Sony Ericsson, патчи, эльфы, моддинг, прошивка
Логин: Пароль: Запомнить: Привет гость! Зарегистрируйся или авторизируйся для получения доп. возможностей!
Разделы
PDA версия сайта
Новости
Статьи
Файлы
Патчи
Патчи A2
Патчи db2020
Эльфы
Исходники эльфов
Wiki
Форум
Обратная связь
Развернуть/Свернуть
 
Развернуть/Свернуть

No putchar ? No problem :D [DB3210] : Эльфостроение : Эльфы : Форум : Для Sony Ericsson патчи эльфы моддинг прошивка
/  Список форумов
   /  Эльфы
      /  Эльфостроение
   /  No putchar ? No problem :D [DB3210]
На печать 
Правила 


mc_kibel


Patcher/Elfmaker


Регистрация: 19.6.08
Сообщений: 210
Репутация: 1819
Откуда: Poland




 
  #1 [25.05.10, 21:49] No putchar ? No problem :D [DB3210]   

 
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 ]


Спасибо сказали: Alex_E

KrasH


VIP Developer


Регистрация: 12.10.07
Сообщений: 993
Репутация: 3014
Откуда: Шахты




 
  #2 [25.05.10, 22:11] Re: No putchar ? No problem :D [DB3210] !!   

 
We can draw images by gettin' ImageManager object and using its methods.
Just CoCreateInstance func is needed =)




Samsung GT-I9000 Galaxy S
SE C510 R1FA035
+ M2 1Gb + HPM-82
WMR: 248608836491
WMZ: 305377005044
Спасибо mazhor(1500wmr),polza(600wmr), & to other(~1100wmr)

mc_kibel


Patcher/Elfmaker


Регистрация: 19.6.08
Сообщений: 210
Репутация: 1819
Откуда: Poland




 
  #3 [25.05.10, 23:40] Re: No putchar ? No problem :D [DB3210] !!   

 
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 ?




Похожие темы
 ТемаОтветыАвторПросмотрыОбновление
  W580 Fitness problem0crisbeto469307.07.11, 23:01
  problem with k8502ghollomreza665828.02.11, 17:32
  K550/W610 Key problem0Салават429417.12.09, 23:29
  problem with s500@w58000bazzz385318.04.09, 20:08

  • Поиск
  • Права
Вы не можете начинать темы.
Вы не можете редактировать свои сообщения.
Вы не можете создавать опросы.
Вы не можете вкладывать файлы в сообщения.
Вы не можете отвечать на сообщения.
Вы не можете удалять свои сообщения.
Вы не можете голосовать.

Главная Новости Статьи Файлы Патчи Форум Опросы PDA
- Генерация страницы: 0.05 секунд | 9 Запросов | HTML: 29.62 КБ -