Chameleon

Chameleon Svn Source Tree

Root/tags/2.1/i386/boot2/graphic_utils.h

Source at commit 2381 created 10 years 21 days ago.
By ifabio, Apply patch: (Credits to Thomas Jansen aka tja) - Reading options from all devices during boot. The options for the boot menu are only read from the devices rd(0,0) or bt(0,0). Consequently, boot menu options (e.g. "Quiet Boot", "Timeout", etc.) in plists on other devices (like most users have) are ignored. This patch extends the list of paths to search for the options plist on all devices that can be found.
1 /* Graphic utility functions and data types
2 * Prashant Vaibhav (C) 12/12/2008
3 * Chameleon
4 */
5
6// Everything here is 32 bits per pixel non-premultiplied ARGB format
7//
8
9#ifndef GRAPHIC_UTILS_H
10#define GRAPHIC_UTILS_H
11
12#include "boot.h"
13
14
15typedef union {
16 struct {
17 uint8_t b;
18 uint8_t g;
19 uint8_t r;
20 uint8_t a;
21 } ch;
22 uint8_t channel[4];
23 uint32_t value;
24} pixel_t;
25
26typedef struct {
27 uint16_theight;
28 uint16_twidth;
29 pixel_t*pixels;
30} pixmap_t;
31
32typedef struct {
33 uint32_t x;
34 uint32_t y;
35} position_t;
36
37// Blends the given pixmap into the given background at the given position
38// Uses the alpha channels to blend, and preserves the final alpha (so the
39// resultant pixmap can be blended again with another background).
40// ported from www.stereopsis.com/doubleblend.html
41void blend( const pixmap_t *blendThis, // Source image
42 pixmap_t *blendInto, // Dest image
43 const position_t position); // Where to place the source image
44// Returns the topleft co-ordinate where if you put the 'toCenter' pixmap,
45// it is centered in the background.
46position_t centeredIn( const pixmap_t *background, const pixmap_t *toCenter );
47
48// Returns the topleft co-ordinate where if you put the given pixmap, its
49// center will coincide with the th given center.
50position_t centeredAt( const pixmap_t *pixmap, const position_t center );
51
52// Utility function returns a position_t struct given the x and y coords as uint16
53position_t pos(const uint16_t x, const uint16_t y);
54
55// Flips the R and B components of all pixels in the given pixmap
56void flipRB(pixmap_t *p);
57
58// Utility function to get pixel at (x,y) in a pixmap
59#define pixel(p,x,y) ((p)->pixels[(x) + (y) * (p)->width])
60
61#endif//GRAPHIC_UTILS_H
62

Archive Download this file

Revision: 2381