png2swf 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/oily_png2swf/oily_png2swf_ext.c +5 -3
- data/lib/png2swf/version.rb +1 -1
- metadata +3 -3
@@ -21,6 +21,7 @@ VALUE bitmap_data(VALUE vself, VALUE vpixels) {
|
|
21
21
|
int pixel_size = RARRAY(vpixels)->len;
|
22
22
|
unsigned long color;
|
23
23
|
int a; // alpha for swf bitmap data
|
24
|
+
float a_dash;
|
24
25
|
unsigned char r, g, b; // red, green, blue for swf bitmap data
|
25
26
|
unsigned char data[pixel_size * 4]; // argb for swf bitmap data
|
26
27
|
int i;
|
@@ -28,9 +29,10 @@ VALUE bitmap_data(VALUE vself, VALUE vpixels) {
|
|
28
29
|
for (i=0; i<pixel_size; i++) {
|
29
30
|
color = NUM2ULONG((RARRAY(vpixels)->ptr[i]));
|
30
31
|
a = alpha(color);
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
a_dash = a / 255.0;
|
33
|
+
r = (unsigned char)(red(color) * a);
|
34
|
+
g = (unsigned char)(green(color) * a);
|
35
|
+
b = (unsigned char)(blue(color) * a);
|
34
36
|
data[data_index] = a;
|
35
37
|
data[data_index+1] = r;
|
36
38
|
data[data_index+2] = g;
|
data/lib/png2swf/version.rb
CHANGED
metadata
CHANGED