ruby-libgd 0.1.7 → 0.1.8
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.
- checksums.yaml +4 -4
- data/ext/gd/color.c +14 -2
- data/ext/gd/color.o +0 -0
- data/ext/gd/draw_line.c +2 -2
- data/ext/gd/draw_line.o +0 -0
- data/ext/gd/gd.so +0 -0
- data/ext/gd/image.c +2 -1
- data/ext/gd/image.o +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6bebe9c1a521b1a7e5fc50f31a6abc29d0b075de0fa6761d8673ccfb9870b958
|
|
4
|
+
data.tar.gz: 452861ff154b42c8618d891bf43cdaee7ac2c75f8376760a3225d432d0956914
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a9ce11ae3c04fed19b4a5d8d44f4069acecf46df5f7bf3797bc2cb032d382a638eff535a932bb0d3f6ff4be26ba636cf55166ff0471674573951a2cc4825b40
|
|
7
|
+
data.tar.gz: 5e0cbcdda5264574fb65b76273dbee942f55f03299cef0b3a091c5bff9528d5a773e58027e165f88933cfb5c122460dc4cb8b5bbe8bb8848e25e2f9a6d653b5e
|
data/ext/gd/color.c
CHANGED
|
@@ -12,12 +12,24 @@ int color_to_gd(gdImagePtr im, VALUE color) {
|
|
|
12
12
|
if (gdImageTrueColor(im)) {
|
|
13
13
|
if (RARRAY_LEN(color) >= 4) {
|
|
14
14
|
int a = NUM2INT(rb_ary_entry(color, 3));
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
if (a < 0) a = 0;
|
|
17
|
+
if (a > 255) a = 255;
|
|
18
|
+
|
|
19
|
+
int gd_a = (a * 127) / 255;
|
|
20
|
+
|
|
21
|
+
return gdTrueColorAlpha(r, g, b, gd_a);
|
|
16
22
|
}
|
|
17
23
|
return gdTrueColor(r,g,b);
|
|
18
24
|
}
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
if (RARRAY_LEN(color) >= 4) {
|
|
27
|
+
int a = NUM2INT(rb_ary_entry(color, 3));
|
|
28
|
+
int gd_a = (a * 127) / 255;
|
|
29
|
+
return gdImageColorAllocateAlpha(im, r, g, b, gd_a);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return gdImageColorAllocate(im, r, g, b);
|
|
21
33
|
}
|
|
22
34
|
|
|
23
35
|
static VALUE gd_color_rgb(VALUE self, VALUE r, VALUE g, VALUE b) {
|
data/ext/gd/color.o
CHANGED
|
Binary file
|
data/ext/gd/draw_line.c
CHANGED
|
@@ -44,8 +44,8 @@ static VALUE gd_image_line(int argc, VALUE *argv, VALUE self) {
|
|
|
44
44
|
rb_warn("Line coordinates clipped to image bounds");
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
if (TYPE(color) != T_ARRAY || RARRAY_LEN(color)
|
|
48
|
-
rb_raise(rb_eArgError, "color must be [r,g,b]");
|
|
47
|
+
if (TYPE(color) != T_ARRAY || RARRAY_LEN(color) < 3 || RARRAY_LEN(color) > 4) {
|
|
48
|
+
rb_raise(rb_eArgError, "color must be [r,g,b] or [r,g,b,a]");
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
int c = color_to_gd(wrap->img, color);
|
data/ext/gd/draw_line.o
CHANGED
|
Binary file
|
data/ext/gd/gd.so
CHANGED
|
Binary file
|
data/ext/gd/image.c
CHANGED
|
@@ -19,8 +19,9 @@ static VALUE gd_image_initialize(int argc, VALUE *argv, VALUE self) {
|
|
|
19
19
|
rb_raise(rb_eArgError, "width and height must be positive");
|
|
20
20
|
|
|
21
21
|
wrap->img = gdImageCreateTrueColor(w, h);
|
|
22
|
+
|
|
23
|
+
gdImageAlphaBlending(wrap->img, 1);
|
|
22
24
|
gdImageSaveAlpha(wrap->img, 1);
|
|
23
|
-
gdImageAlphaBlending(wrap->img, 0);
|
|
24
25
|
|
|
25
26
|
int t = gdTrueColorAlpha(0,0,0,127);
|
|
26
27
|
gdImageFilledRectangle(wrap->img, 0, 0, w-1, h-1, t);
|
data/ext/gd/image.o
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-libgd
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Germán Alberto Giménez Silva
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-01-
|
|
11
|
+
date: 2026-01-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: High-performance native Ruby bindings to libgd for image generation,
|
|
14
14
|
drawing, filters, alpha blending, and transformations.
|