diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-17 03:39:01 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-17 03:39:01 +0200 |
commit | abfc56b8c4fc768593c7afdd1961aab35c0468c4 (patch) | |
tree | 1d39b8312b4ae0abdf63c3a1708be67f3c873811 /chuck | |
parent | d7eb9b29c8bcfd9ca97e0604b5b1868b3967164e (diff) | |
download | osc-graphics-abfc56b8c4fc768593c7afdd1961aab35c0468c4.tar.gz |
all layer constructor methods support an alpha argument
Diffstat (limited to 'chuck')
-rw-r--r-- | chuck/OSCGraphics.ck | 37 | ||||
-rw-r--r-- | chuck/OSCGraphicsLayer.ck | 5 |
2 files changed, 27 insertions, 15 deletions
diff --git a/chuck/OSCGraphics.ck b/chuck/OSCGraphics.ck index 6c8dd9f..2c3c25e 100644 --- a/chuck/OSCGraphics.ck +++ b/chuck/OSCGraphics.ck @@ -17,30 +17,36 @@ public class OSCGraphics { return img; } fun static OSCGraphicsImage @ - newImage(int pos, int geo[], string file) + newImage(int pos, int geo[], float opacity, string file) { OSCGraphicsImage img; - img.init(osc_send, "image", "s", pos, "__image_"+free_id, geo); + img.init(osc_send, "image", "s", + pos, "__image_"+free_id, geo, opacity); file => osc_send.addString; free_id++; return img; } fun static OSCGraphicsImage @ + newImage(int pos, int geo[], float opacity) + { + return newImage(pos, geo, opacity, ""); + } + fun static OSCGraphicsImage @ newImage(int pos, int geo[]) { - return newImage(pos, geo, ""); + return newImage(pos, geo, 1., ""); } fun static OSCGraphicsImage @ newImage(int pos) { - return newImage(pos, null, ""); + return newImage(pos, null, 1., ""); } fun static OSCGraphicsImage @ newImage() { - return newImage(-1, null, ""); + return newImage(-1, null, 1., ""); } fun static OSCGraphicsVideo @ @@ -52,30 +58,36 @@ public class OSCGraphics { return video; } fun static OSCGraphicsVideo @ - newVideo(int pos, int geo[], string file) + newVideo(int pos, int geo[], float opacity, string file) { OSCGraphicsVideo video; - video.init(osc_send, "video", "s", pos, "__video_"+free_id, geo); + video.init(osc_send, "video", "s", + pos, "__video_"+free_id, geo, opacity); file => osc_send.addString; free_id++; return video; } fun static OSCGraphicsVideo @ + newVideo(int pos, int geo[], float opacity) + { + return newVideo(pos, geo, 1., ""); + } + fun static OSCGraphicsVideo @ newVideo(int pos, int geo[]) { - return newVideo(pos, geo, ""); + return newVideo(pos, geo, 1., ""); } fun static OSCGraphicsVideo @ newVideo(int pos) { - return newVideo(pos, null, ""); + return newVideo(pos, null, 1., ""); } fun static OSCGraphicsVideo @ newVideo() { - return newVideo(-1, null, ""); + return newVideo(-1, null, 1., ""); } fun static OSCGraphicsBox @ @@ -91,8 +103,8 @@ public class OSCGraphics { { OSCGraphicsBox box; - box.init(osc_send, "box", "fiii", pos, "__box_"+free_id, geo); - opacity => osc_send.addFloat; + box.init(osc_send, "box", "iii", + pos, "__box_"+free_id, geo, opacity); for (0 => int i; i < 3; i++) color[i] => osc_send.addInt; @@ -114,7 +126,6 @@ public class OSCGraphics { { return newBox(-1, null, 1., color); } - } /* static initialization */ new OscSend @=> OSCGraphics.osc_send; diff --git a/chuck/OSCGraphicsLayer.ck b/chuck/OSCGraphicsLayer.ck index 9aed84e..77afd98 100644 --- a/chuck/OSCGraphicsLayer.ck +++ b/chuck/OSCGraphicsLayer.ck @@ -4,7 +4,7 @@ public class OSCGraphicsLayer { fun void init(OscSend @osc_send, string type, string osc_types, - int pos, string name, int geo[]) /* pseudo-constructor */ + int pos, string name, int geo[], float opacity) /* pseudo-constructor */ { if (geo == null) [0, 0, 0, 0] @=> geo; @@ -12,11 +12,12 @@ public class OSCGraphicsLayer { osc_send @=> this.osc_send; name => this.name; - osc_send.startMsg("/layer/new/"+type, "isiiii"+osc_types); + osc_send.startMsg("/layer/new/"+type, "isiiiif"+osc_types); pos => osc_send.addInt; name => osc_send.addString; for (0 => int i; i < 4; i++) geo[i] => osc_send.addInt; + opacity => osc_send.addFloat; } class GeoPort extends OSCGraphicsPort { |