Root/
Source at commit 2605 created 9 years 4 months ago. By ifabio, Temp disabled feature introduced in commit 2562 (Added ability to auto-select last booted partition as the boot volume), cause AllocateKernelMemory error. | |
---|---|
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 | ␊ |
15 | typedef 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 | ␊ |
26 | typedef struct {␊ |
27 | uint16_t␉height;␊ |
28 | uint16_t␉width;␊ |
29 | pixel_t*␉pixels;␊ |
30 | } pixmap_t;␊ |
31 | ␊ |
32 | typedef 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␊ |
41 | void 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.␊ |
46 | position_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.␊ |
50 | position_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␊ |
53 | position_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␊ |
56 | void 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 |