Changeset 15
- Timestamp:
- Nov 10, 2005, 8:04:02 PM (17 years ago)
- Location:
- abuse/trunk/src/imlib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/imlib/include/palette.hpp
r2 r15 28 28 void set(int x, unsigned char red, unsigned char green, unsigned char blue); 29 29 void get(int x, unsigned char &red, unsigned char &green, unsigned char &blue); 30 longgetquad(int x);30 uint32_t getquad(int x); 31 31 unsigned int red(int x) { return pal[x].red; } 32 32 unsigned int green(int x) { return pal[x].green; } -
abuse/trunk/src/imlib/palette.cpp
r4 r15 89 89 } 90 90 91 longpalette::getquad(int x)91 uint32_t palette::getquad(int x) 92 92 { char entry[4]; 93 93 entry[3]=0; … … 95 95 entry[1]=pal[x].green; 96 96 entry[0]=pal[x].blue; 97 return *(( long*)entry);97 return *((uint32_t *)entry); 98 98 } 99 99 … … 523 523 void palette::fade_to(int total_fades, int fade_on, int dest_r, int dest_g, int dest_b) 524 524 { 525 unsigned char *sl=(unsigned char *)addr(); 526 int i; 525 uint8_t *sl=(uint8_t *)addr(); 526 uint8_t x; 527 int i; 527 528 for (i=0;i<ncolors;i++) 528 529 { 529 *(sl++)=(( dest_r-(int)*sl)*fade_on/total_fades+*sl); 530 *(sl++)=(( dest_g-(int)*sl)*fade_on/total_fades+*sl); 531 *(sl++)=(( dest_b-(int)*sl)*fade_on/total_fades+*sl); 530 x=(( dest_r-(int)*sl)*fade_on/total_fades+*sl); 531 *(sl++)=x; 532 x=(( dest_g-(int)*sl)*fade_on/total_fades+*sl); 533 *(sl++)=x; 534 x=(( dest_b-(int)*sl)*fade_on/total_fades+*sl); 535 *(sl++)=x; 532 536 } 533 537 }
Note: See TracChangeset
for help on using the changeset viewer.