Revision 160
implemented sprite rotation
graphics.c | ||
---|---|---|
198 | 198 |
return SUCCESS; |
199 | 199 |
} |
200 | 200 |
|
201 |
|
|
202 | 201 |
int (set_pixel)(uint16_t x, uint16_t y, uint32_t color) { |
203 | 202 |
if (x >= vbe_mem_info.XResolution || y >= vbe_mem_info.YResolution) { |
204 | 203 |
printf("%s: invalid pixel.\n", __func__); |
... | ... | |
208 | 207 |
memcpy((void*)((unsigned int)video_mem + pos), &color, get_bytes_pixel()); |
209 | 208 |
return SUCCESS; |
210 | 209 |
} |
210 |
int (set_pixel_alpha)(uint16_t x, uint16_t y, uint32_t color, uint8_t alpha){ |
|
211 |
unsigned int pos = (x + y * vbe_mem_info.XResolution) * get_bytes_pixel(); |
|
212 |
uint32_t color_; |
|
213 |
memcpy(&color_, (void*)((unsigned int)video_mem + pos), get_bytes_pixel()); |
|
214 |
float a = 1.0-(alpha&0xFF)/(float)0xFF; |
|
215 |
uint8_t r = GET_RED(color)*a + GET_RED(color_)*(1.0-a); |
|
216 |
uint8_t g = GET_GRE(color)*a + GET_GRE(color_)*(1.0-a); |
|
217 |
uint8_t b = GET_BLU(color)*a + GET_BLU(color_)*(1.0-a); |
|
218 |
return set_pixel(x,y,SET_RGB(r,g,b)); |
|
219 |
//return set_pixel(x,y,color); |
|
220 |
} |
|
211 | 221 |
|
212 | 222 |
int (draw_hline)(uint16_t x, uint16_t y, uint16_t len, uint32_t color){ |
213 | 223 |
int r; |
Also available in: Unified diff