EE445M RTOS
Taken at the University of Texas Spring 2015
shape.h
Go to the documentation of this file.
1 /* -*- mode: c; c-basic-offset: 4; -*- */
2 #ifndef __SHAPE__
3 #define __SHAPE__
4 
5 #include <stdlib.h>
6 #include "libstd/defines.h"
7 
13 typedef struct point {
14 
15  unsigned short x;
16  unsigned short y;
17  /* 4-bit colors */
19 } point;
20 
26 typedef struct shape {
27 
28  unsigned short num_points;
30 } shape;
31 
37 typedef struct circle {
38 
39  /* A circle consists of a center and a radius */
42 } circle;
43 
48 inline void shape_destroy_point(point* p) {
49 
50  free(p);
51 }
52 
57 inline void shape_destroy_circle(circle* cir) {
58 
59  free(cir);
60 }
61 
70 
78 
79  return shape_create_point(p->x, p->y, p->shade);
80 }
81 
90 
97 
104 
113 
122 
131 
132 #endif /* __SHAPE__ */
unsigned short num_points
Definition: shape.h:28
unsigned short y
Definition: shape.h:16
struct shape shape
ushort radius
Definition: shape.h:41
Representation of a circle.
Definition: shape.h:37
shape * shape_create(ushort,...)
Definition: shape.c:31
#define SHADE_SIZE
Definition: defines.h:93
Representation of a shape.
Definition: shape.h:26
shade_t shade
Definition: shape.h:18
shape * shape_create_quad(point *, uchar, uchar)
Definition: shape.c:19
point * center
Definition: shape.h:40
struct point point
shape * shape_create_triangle(point *, point *, point *)
Definition: shape.c:14
struct circle circle
unsigned short ushort
Definition: defines.h:35
point ** points
Definition: shape.h:29
point * shape_duplicate_point(point *p)
Definition: shape.h:77
void shape_destroy_circle(circle *cir)
Definition: shape.h:57
unsigned char uchar
Definition: defines.h:34
point * shape_create_point(ushort, ushort, shade_t)
Definition: shape.c:6
shape * shape_duplicate_shape(shape *)
Definition: shape.c:66
Representation of an ordered pair with a shade.
Definition: shape.h:13
void shape_destroy_shape(shape *)
Definition: shape.c:49
#define shade_t
Definition: defines.h:41
circle * shape_create_circle(ushort, point *)
Definition: shape.c:58
unsigned short x
Definition: shape.h:15
void shape_destroy_point(point *p)
Definition: shape.h:48