diff options
-rw-r--r-- | draw.c | 7 | ||||
-rw-r--r-- | draw.h | 5 | ||||
-rw-r--r-- | xenon.h | 4 | ||||
-rw-r--r-- | xlib_api.c | 11 |
4 files changed, 27 insertions, 0 deletions
@@ -5,6 +5,13 @@ unsigned char* pixels; xenon_rect screen_rect; +void draw_point(GC gc, int x, int y) +{ + pixelrgba(x, y) = 0xffffffff; + xenon_rect r = { x, y, 1, 1 }; + damage_add(&r); +} + void draw_rectangle(GC gc, xenon_rect* r) { for(int i = r->x ; i < r->x + r->w ; i++) @@ -1,6 +1,8 @@ #ifndef _draw_h_ #define _draw_h_ +#include "xenon.h" + #define pixelr(x,y) pixels[(screen_rect.w * (y) + (x))*4 + 0] #define pixelg(x,y) pixels[(screen_rect.w * (y) + (x))*4 + 1] #define pixelb(x,y) pixels[(screen_rect.w * (y) + (x))*4 + 2] @@ -17,5 +19,8 @@ xenon_rect; extern unsigned char* pixels; extern xenon_rect screen_rect; +extern void draw_point(GC gc, int x, int y); +extern void draw_rectangle(GC gc, xenon_rect* r); + #endif @@ -1,3 +1,6 @@ +#ifndef _xenon_h_ +#define _xenon_h_ + #define XLIB_ILLEGAL_ACCESS #include <X11/Xlib.h> #include <string.h> @@ -7,3 +10,4 @@ #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) +#endif @@ -89,6 +89,17 @@ int XDrawLine( { } +int XDrawPoint( + Display* display, + Drawable d, + GC gc, + int x, + int y +) +{ + draw_point(gc, x, y); +} + int XDrawRectangle( Display* display, Drawable d, |