Added canvas_fill(rgba) and a 50% black fill bound to the 'c' key.
This commit is contained in:
parent
0090f518e9
commit
c651046e3f
3 changed files with 11 additions and 0 deletions
|
|
@ -376,6 +376,14 @@ void canvas_set_px(unsigned int x, unsigned int y, uint32_t rgba) {
|
||||||
ptr[2] = b;
|
ptr[2] = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void canvas_fill(uint32_t rgba) {
|
||||||
|
CanvasLayer * layer = canvas_base;
|
||||||
|
for(int x=0; x<layer->size; x++)
|
||||||
|
for(int y=0; y<layer->size; y++)
|
||||||
|
canvas_set_px(x, y, rgba);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void canvas_get_px(unsigned int x, unsigned int y, uint32_t *rgba) {
|
void canvas_get_px(unsigned int x, unsigned int y, uint32_t *rgba) {
|
||||||
CanvasLayer * layer = canvas_base;
|
CanvasLayer * layer = canvas_base;
|
||||||
GLubyte* ptr = canvas_offset(layer, x, y);
|
GLubyte* ptr = canvas_offset(layer, x, y);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ void canvas_close();
|
||||||
void canvas_fullscreen(int display);
|
void canvas_fullscreen(int display);
|
||||||
int canvas_get_display();
|
int canvas_get_display();
|
||||||
|
|
||||||
|
void canvas_fill(uint32_t rgba);
|
||||||
void canvas_set_px(unsigned int x, unsigned int y, uint32_t rgba);
|
void canvas_set_px(unsigned int x, unsigned int y, uint32_t rgba);
|
||||||
void canvas_get_px(unsigned int x, unsigned int y, uint32_t *rgba);
|
void canvas_get_px(unsigned int x, unsigned int y, uint32_t *rgba);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,8 @@ void px_on_key(int key, int scancode, int mods) {
|
||||||
canvas_fullscreen(-1);
|
canvas_fullscreen(-1);
|
||||||
} else if (key == 301) { // F12
|
} else if (key == 301) { // F12
|
||||||
canvas_fullscreen(canvas_get_display() + 1);
|
canvas_fullscreen(canvas_get_display() + 1);
|
||||||
|
} else if (key == 67) { // c
|
||||||
|
canvas_fill(0x00000088);
|
||||||
} else if (key == 81 || key == 256) { // q or ESC
|
} else if (key == 81 || key == 256) { // q or ESC
|
||||||
canvas_close();
|
canvas_close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue