[kandinsky] KDPointZero and KDRectZero

This commit is contained in:
Romain Goyet
2015-09-22 16:11:00 +02:00
parent a047af1d8d
commit 801b244e7a
5 changed files with 10 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
SFLAGS += -Ikandinsky/include
objs += $(addprefix kandinsky/src/, font.o line.o pixel.o rect.o text.o)
objs += $(addprefix kandinsky/src/, font.o line.o pixel.o rect.o text.o types.o)
tests += $(addprefix kandinsky/test/, set_pixel.c)
FREETYPE_PATH := /usr/local/Cellar/freetype/2.5.5

View File

@@ -21,6 +21,8 @@ typedef struct {
};
} KDRect;
extern KDRect KDRectZero;
void KDFillRect(KDRect rect, KDColor color);
#endif

View File

@@ -10,6 +10,8 @@ typedef struct {
KDCoordinate y;
} KDPoint;
extern KDPoint KDPointZero;
#define KDPOINT(xc,yc) ((KDPoint){.x=(KDCoordinate)(xc),.y=(KDCoordinate)(yc)})
static inline KDPoint KDPointTranslate(KDPoint p1, KDPoint p2) {
return (KDPoint){.x = (KDCoordinate)(p1.x + p2.x), .y = (KDCoordinate)(p1.y + p2.y)};

View File

@@ -2,6 +2,8 @@
#include <kandinsky/pixel.h>
#include <string.h>
KDRect KDRectZero = {.x = 0, .y = 0, .width = 0, .height = 0};
void KDFillRect(KDRect rect, KDColor color) {
//for (KDCoordinate y = rect.y ; y < (rect.y + rect.height); y++) {
//memset(KDPixelAddress((KDPoint){.x=rect.x, .y=y}), color, rect.width);

3
kandinsky/src/types.c Normal file
View File

@@ -0,0 +1,3 @@
#include <kandinsky/types.h>
KDPoint KDPointZero = {.x = 0, .y = 0};