Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
23 May, 2013, 18:41:12 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 ... 3 4 [5]   Go Down
  Print  
Author Topic: Prizm Useful Routines -- post here! -  (Read 3985 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Eiyeron
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552


Total Post Ratings: +18

View Profile WWW
« Reply #60 on: 23 December, 2011, 22:53:45 »
0

I think you put your answer inside the quote Eiyeron Huh?
I think I should miswrite somewhere: I request the help from someone to make this function...

Anyway, my function for my project

Two pixels are concatened like this:
0bAAAABBBB
or
0xAB


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void CopySprite_Palette_Alpha_Nibbles(unsigned char* data, unsigned short* palette, int x, int y, int width, int height) {
   unsigned short* VRAM = (unsigned short*)0xA8000000;
   unsigned short* ptr = VRAM + y*LCD_WIDTH_PX + x;
   int i,j;
   unsigned char nibble;  //Get the color's index to use.
   for(j=0; j<height; j++) {
                for(i = 0; i < width; i+=2)
                {
                nibble = (*data)>>4; We get the first pixel
                        if(nibble)  //First index is alpha.
                                *ptr = palette[nibble];  //COpy from the palette
                nibble = (*data) %16; We get the second pixel
                        if(nibble)  //On the road again
                                *(ptr+1) = palette[nibble];
/*                      else
                                *(ptr+1) = palette[0];*/ // FOr tests
                        ptr+=2; //We go furtherer on the VRAM
                        data++; //Idem
                }
                ptr += LCD_WIDTH_PX-width; // Go one line lower.
   }
}

Max 16 colours, enough for Pokémons, in example... :-°
First index is alpha
(Could you please too adapt this function to add a zoom factor, please? I would be erternally grateful)
« Last Edit: 29 December, 2011, 19:53:58 by Eiyeron » Logged




Pages: 1 ... 3 4 [5]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.172 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.