ruby-libgd 0.1.6 → 0.1.7
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/gd.so +0 -0
- data/ext/gd/image.c +47 -0
- 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: c64d601c6dd325529759e9a824a0e31f330a05c064a9d4eadcd654383472f930
|
|
4
|
+
data.tar.gz: 455e8c56d684fb2f550b9cf53d3ba7a265dff161e7029846f73fbf993194054f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c9a6d49310f7d6938db5a63d1c6978dfc74f71823c6c393dc499afe4da11b18ed4f054a24cf53db677ecb4ffd7d34ad5d838b9dba8534b20f4e55c1ddace004
|
|
7
|
+
data.tar.gz: bc79aa8e7a294e9553cdb726b85e8d965bfa05fd2aae9226e821e1368492a9f9f0b23c946806c678e7b6be4fec668734426cfc42776eb81cf7bd28deb5ccbd6e
|
data/ext/gd/gd.so
CHANGED
|
Binary file
|
data/ext/gd/image.c
CHANGED
|
@@ -219,6 +219,52 @@ static VALUE gd_image_copy (
|
|
|
219
219
|
return Qnil;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
+
static VALUE gd_image_copy_resize(int argc, VALUE *argv, VALUE self) {
|
|
223
|
+
VALUE src_img;
|
|
224
|
+
VALUE dst_x, dst_y, src_x, src_y, src_w, src_h, dst_w, dst_h, resample;
|
|
225
|
+
|
|
226
|
+
rb_scan_args(argc, argv, "91",
|
|
227
|
+
&src_img, &dst_x, &dst_y, &src_x, &src_y,
|
|
228
|
+
&src_w, &src_h, &dst_w, &dst_h,
|
|
229
|
+
&resample
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
gd_image_wrapper *dst, *src;
|
|
233
|
+
TypedData_Get_Struct(self, gd_image_wrapper, &gd_image_type, dst);
|
|
234
|
+
TypedData_Get_Struct(src_img, gd_image_wrapper, &gd_image_type, src);
|
|
235
|
+
|
|
236
|
+
int dx = NUM2INT(dst_x);
|
|
237
|
+
int dy = NUM2INT(dst_y);
|
|
238
|
+
int sx = NUM2INT(src_x);
|
|
239
|
+
int sy = NUM2INT(src_y);
|
|
240
|
+
int sw = NUM2INT(src_w);
|
|
241
|
+
int sh = NUM2INT(src_h);
|
|
242
|
+
int dw = NUM2INT(dst_w);
|
|
243
|
+
int dh = NUM2INT(dst_h);
|
|
244
|
+
|
|
245
|
+
int do_resample = RTEST(resample);
|
|
246
|
+
|
|
247
|
+
if (do_resample) {
|
|
248
|
+
gdImageCopyResampled(
|
|
249
|
+
dst->img, src->img,
|
|
250
|
+
dx, dy,
|
|
251
|
+
sx, sy,
|
|
252
|
+
dw, dh,
|
|
253
|
+
sw, sh
|
|
254
|
+
);
|
|
255
|
+
} else {
|
|
256
|
+
gdImageCopyResized(
|
|
257
|
+
dst->img, src->img,
|
|
258
|
+
dx, dy,
|
|
259
|
+
sx, sy,
|
|
260
|
+
dw, dh,
|
|
261
|
+
sw, sh
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return self;
|
|
266
|
+
}
|
|
267
|
+
|
|
222
268
|
void gd_define_image(VALUE mGD) {
|
|
223
269
|
VALUE cGDImage = rb_define_class_under(mGD, "Image", rb_cObject);
|
|
224
270
|
|
|
@@ -227,6 +273,7 @@ void gd_define_image(VALUE mGD) {
|
|
|
227
273
|
rb_define_method(cGDImage, "width", gd_image_width, 0);
|
|
228
274
|
rb_define_method(cGDImage, "height", gd_image_height, 0);
|
|
229
275
|
rb_define_method(cGDImage, "initialize", gd_image_initialize, -1);
|
|
276
|
+
rb_define_method(cGDImage, "copy_resize", gd_image_copy_resize, -1);
|
|
230
277
|
rb_define_method(cGDImage, "copy", gd_image_copy, 7);
|
|
231
278
|
rb_define_method(cGDImage, "clone", gd_image_clone, 0);
|
|
232
279
|
rb_define_singleton_method(cGDImage, "open", gd_image_open, 1);
|
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.7
|
|
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-07 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.
|