script_lib_image_data_t *data = user_data;
ply_pixel_buffer_t *image;
ply_label_t *label;
+ script_obj_t *alpha_obj;
int width, height;
char *text = script_obj_hash_get_string (state->local, "text");
float red = CLAMP(script_obj_hash_get_number (state->local, "red"), 0, 1);
float green = CLAMP(script_obj_hash_get_number (state->local, "green"), 0, 1);
float blue = CLAMP(script_obj_hash_get_number (state->local, "blue"), 0, 1);
-
+ float alpha = 1;
+
+ alpha_obj = script_obj_hash_peek_element (state->local, "alpha");
+
+ if (alpha_obj)
+ {
+ alpha = CLAMP(script_obj_as_number (alpha_obj), 0, 1);
+ script_obj_unref(alpha_obj);
+ }
+
if (!text) return script_return_obj_null ();
-
+
label = ply_label_new ();
ply_label_set_text (label, text);
- ply_label_set_color (label, red, green, blue, 1.0);
+ ply_label_set_color (label, red, green, blue, alpha);
ply_label_show (label, NULL, 0, 0);
width = ply_label_get_width (label);
"red",
"green",
"blue",
+ "alpha",
NULL);
script_obj_unref (image_hash);
return Image.Adopt (this._Scale(width, height));
};
-Image.Text = fun (text, red, green, blue)
+Image.Text = fun (text, red, green, blue, alpha)
{
- return Image.Adopt (Image._Text (text, red, green, blue));
+ return Image.Adopt (Image._Text (text, red, green, blue, alpha));
};
Image |= fun (filename)