aboutsummaryrefslogtreecommitdiff
path: root/src/layer_box.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-09-28 15:26:29 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-09-28 15:26:29 +0200
commite7da86053b3df2882816b0df8089e1a51b61939f (patch)
tree8f7430f7d1e82ddb8449548886f57a3a7c646c05 /src/layer_box.h
parent9b134ea457f91ba8ea6ae558c9192f58c09f62bc (diff)
downloadosc-graphics-e7da86053b3df2882816b0df8089e1a51b61939f.tar.gz
autotools based build system
Diffstat (limited to 'src/layer_box.h')
-rw-r--r--src/layer_box.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/layer_box.h b/src/layer_box.h
new file mode 100644
index 0000000..1e4e5e3
--- /dev/null
+++ b/src/layer_box.h
@@ -0,0 +1,56 @@
+#ifndef __LAYER_BOX_H
+#define __LAYER_BOX_H
+
+#include <SDL.h>
+
+#include "osc_graphics.h"
+#include "osc_server.h"
+#include "layer.h"
+
+#define COLOR_TYPES "iii" /* r, g, b */
+
+class LayerBox : public Layer {
+ Sint16 x1, y1, x2, y2;
+ Uint8 r, g, b, a;
+
+public:
+ LayerBox(const char *name, SDL_Rect geo, float opacity,
+ SDL_Color color);
+
+ static CtorInfo ctor_info;
+ static Layer *
+ ctor_osc(const char *name, SDL_Rect geo, float opacity, lo_arg **argv)
+ {
+ SDL_Color color = {
+ (Uint8)argv[0]->i, (Uint8)argv[1]->i, (Uint8)argv[2]->i
+ };
+ return new LayerBox(name, geo, opacity, color);
+ }
+
+ ~LayerBox();
+
+ void frame(SDL_Surface *target);
+
+private:
+ void geo(SDL_Rect geo);
+ void alpha(float opacity);
+
+ inline void
+ color(SDL_Color color)
+ {
+ r = color.r;
+ g = color.g;
+ b = color.b;
+ }
+ OSCServer::MethodHandlerId *color_osc_id;
+ static void
+ color_osc(LayerBox *obj, lo_arg **argv)
+ {
+ SDL_Color color = {
+ (Uint8)argv[0]->i, (Uint8)argv[1]->i, (Uint8)argv[2]->i
+ };
+ obj->color(color);
+ }
+};
+
+#endif \ No newline at end of file