Example #1
0
int draw_screen_from_pixel_map_16(alt_up_pixel_buffer_dma_dev *pixel_buffer, Pixel* pixel_map_16, int x0, int y0) {
    unsigned int i, j = 0, x, y;
    uint16_t color;
    for (i = 0; i < PS; i++) {
        x = i % 16;
        // Go down one line, except if it's the first line
        if (i % 16 == 0 && i != 0){
            j++;
        }
        y = j;

        color = pixel_map_16[i].red << 11 | pixel_map_16[i].green << 5 | pixel_map_16[i].blue;
        if (color != 0x7C0) {
            //alt_up_pixel_buffer_dma_draw_box(pixel_buffer, x + x0, y + y0, x + x0, y + y0, color, 1);
            draw_pixel_fast(pixel_buffer, color, x + x0, y + y0);
        }
    }
    return 1;
}
/*
 * Draws pixel to Video Buffer. Abstracts messy HAL naming.
 */
void Video_drawPixel(VideoBuffer *video_buffer, unsigned int color,  unsigned int x, unsigned int y)
{
	draw_pixel_fast(video_buffer -> pixel_buffer, color, x, y, BACKGROUND);
}