rmagick-windows 2.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +14 -0
- data/.gitignore +23 -0
- data/.hound.yml +2 -0
- data/.rspec +1 -0
- data/.rubocop.yml +340 -0
- data/.simplecov +27 -0
- data/.travis.yml +60 -0
- data/CHANGELOG.md +915 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/CONTRIBUTING.md +50 -0
- data/Doxyfile +1514 -0
- data/Gemfile +10 -0
- data/LICENSE +20 -0
- data/README.textile +257 -0
- data/Rakefile +188 -0
- data/before_install_linux.sh +32 -0
- data/before_install_osx.sh +2 -0
- data/deprecated/RMagick.rb +6 -0
- data/doc/.cvsignore +1 -0
- data/doc/comtasks.html +287 -0
- data/doc/constants.html +1581 -0
- data/doc/css/doc.css +299 -0
- data/doc/css/popup.css +34 -0
- data/doc/css/ref.css +67 -0
- data/doc/draw.html +3272 -0
- data/doc/ex/InitialCoords.rb +22 -0
- data/doc/ex/NewCoordSys.rb +30 -0
- data/doc/ex/OrigCoordSys.rb +16 -0
- data/doc/ex/PreserveAspectRatio.rb +204 -0
- data/doc/ex/RotateScale.rb +36 -0
- data/doc/ex/Skew.rb +38 -0
- data/doc/ex/Use01.rb +15 -0
- data/doc/ex/Use02.rb +20 -0
- data/doc/ex/Use03.rb +16 -0
- data/doc/ex/ViewBox.rb +31 -0
- data/doc/ex/adaptive_threshold.rb +9 -0
- data/doc/ex/add_noise.rb +16 -0
- data/doc/ex/affine.rb +48 -0
- data/doc/ex/affine_transform.rb +20 -0
- data/doc/ex/arc.rb +49 -0
- data/doc/ex/arcpath.rb +32 -0
- data/doc/ex/arcs01.rb +28 -0
- data/doc/ex/arcs02.rb +59 -0
- data/doc/ex/average.rb +15 -0
- data/doc/ex/axes.rb +64 -0
- data/doc/ex/baseline_shift01.rb +17 -0
- data/doc/ex/bilevel_channel.rb +8 -0
- data/doc/ex/blur_image.rb +12 -0
- data/doc/ex/border.rb +10 -0
- data/doc/ex/bounding_box.rb +42 -0
- data/doc/ex/cbezier1.rb +41 -0
- data/doc/ex/cbezier2.rb +41 -0
- data/doc/ex/cbezier3.rb +41 -0
- data/doc/ex/cbezier4.rb +42 -0
- data/doc/ex/cbezier5.rb +42 -0
- data/doc/ex/cbezier6.rb +53 -0
- data/doc/ex/channel.rb +25 -0
- data/doc/ex/charcoal.rb +12 -0
- data/doc/ex/chop.rb +29 -0
- data/doc/ex/circle.rb +33 -0
- data/doc/ex/circle01.rb +16 -0
- data/doc/ex/clip_path.rb +60 -0
- data/doc/ex/coalesce.rb +57 -0
- data/doc/ex/color_fill_to_border.rb +29 -0
- data/doc/ex/color_floodfill.rb +28 -0
- data/doc/ex/color_histogram.rb +47 -0
- data/doc/ex/color_reset.rb +11 -0
- data/doc/ex/colorize.rb +16 -0
- data/doc/ex/colors.rb +64 -0
- data/doc/ex/compose_mask.rb +22 -0
- data/doc/ex/composite.rb +133 -0
- data/doc/ex/composite_layers.rb +53 -0
- data/doc/ex/composite_tiled.rb +21 -0
- data/doc/ex/contrast.rb +36 -0
- data/doc/ex/crop.rb +31 -0
- data/doc/ex/crop_with_gravity.rb +42 -0
- data/doc/ex/cubic01.rb +43 -0
- data/doc/ex/cubic02.rb +91 -0
- data/doc/ex/cycle_colormap.rb +21 -0
- data/doc/ex/dissolve.rb +12 -0
- data/doc/ex/drawcomp.rb +42 -0
- data/doc/ex/drop_shadow.rb +60 -0
- data/doc/ex/edge.rb +11 -0
- data/doc/ex/ellipse.rb +45 -0
- data/doc/ex/ellipse01.rb +21 -0
- data/doc/ex/emboss.rb +11 -0
- data/doc/ex/enhance.rb +28 -0
- data/doc/ex/equalize.rb +11 -0
- data/doc/ex/evenodd.rb +42 -0
- data/doc/ex/fill_pattern.rb +23 -0
- data/doc/ex/flatten_images.rb +36 -0
- data/doc/ex/flip.rb +11 -0
- data/doc/ex/flop.rb +11 -0
- data/doc/ex/font_styles.rb +32 -0
- data/doc/ex/fonts.rb +20 -0
- data/doc/ex/frame.rb +12 -0
- data/doc/ex/gaussian_blur.rb +11 -0
- data/doc/ex/get_multiline_type_metrics.rb +41 -0
- data/doc/ex/get_pixels.rb +47 -0
- data/doc/ex/get_type_metrics.rb +141 -0
- data/doc/ex/gradientfill.rb +27 -0
- data/doc/ex/grav.rb +45 -0
- data/doc/ex/gravity.rb +80 -0
- data/doc/ex/group.rb +26 -0
- data/doc/ex/hatchfill.rb +27 -0
- data/doc/ex/image.rb +44 -0
- data/doc/ex/images/Apple.miff +0 -0
- data/doc/ex/images/Ballerina.jpg +0 -0
- data/doc/ex/images/Ballerina3.jpg +0 -0
- data/doc/ex/images/Button_0.gif +0 -0
- data/doc/ex/images/Button_1.gif +0 -0
- data/doc/ex/images/Button_2.gif +0 -0
- data/doc/ex/images/Button_3.gif +0 -0
- data/doc/ex/images/Button_4.gif +0 -0
- data/doc/ex/images/Button_5.gif +0 -0
- data/doc/ex/images/Button_6.gif +0 -0
- data/doc/ex/images/Button_7.gif +0 -0
- data/doc/ex/images/Button_8.gif +0 -0
- data/doc/ex/images/Button_9.gif +0 -0
- data/doc/ex/images/Button_A.gif +0 -0
- data/doc/ex/images/Button_B.gif +0 -0
- data/doc/ex/images/Button_C.gif +0 -0
- data/doc/ex/images/Button_D.gif +0 -0
- data/doc/ex/images/Button_E.gif +0 -0
- data/doc/ex/images/Button_F.gif +0 -0
- data/doc/ex/images/Button_G.gif +0 -0
- data/doc/ex/images/Button_H.gif +0 -0
- data/doc/ex/images/Button_I.gif +0 -0
- data/doc/ex/images/Button_J.gif +0 -0
- data/doc/ex/images/Button_K.gif +0 -0
- data/doc/ex/images/Button_L.gif +0 -0
- data/doc/ex/images/Button_M.gif +0 -0
- data/doc/ex/images/Button_N.gif +0 -0
- data/doc/ex/images/Button_O.gif +0 -0
- data/doc/ex/images/Button_P.gif +0 -0
- data/doc/ex/images/Button_Q.gif +0 -0
- data/doc/ex/images/Button_R.gif +0 -0
- data/doc/ex/images/Button_S.gif +0 -0
- data/doc/ex/images/Button_T.gif +0 -0
- data/doc/ex/images/Button_U.gif +0 -0
- data/doc/ex/images/Button_V.gif +0 -0
- data/doc/ex/images/Button_W.gif +0 -0
- data/doc/ex/images/Button_X.gif +0 -0
- data/doc/ex/images/Button_Y.gif +0 -0
- data/doc/ex/images/Button_Z.gif +0 -0
- data/doc/ex/images/Cheetah.jpg +0 -0
- data/doc/ex/images/Coffee.wmf +0 -0
- data/doc/ex/images/Flower_Hat.jpg +0 -0
- data/doc/ex/images/Gold_Statue.jpg +0 -0
- data/doc/ex/images/Hot_Air_Balloons.jpg +0 -0
- data/doc/ex/images/Hot_Air_Balloons_H.jpg +0 -0
- data/doc/ex/images/Leaf.miff +0 -0
- data/doc/ex/images/No.wmf +0 -0
- data/doc/ex/images/Polynesia.jpg +0 -0
- data/doc/ex/images/Red_Rocks.jpg +0 -0
- data/doc/ex/images/Rocks_On_Beach.miff +0 -0
- data/doc/ex/images/Shorts.jpg +0 -0
- data/doc/ex/images/Snake.wmf +0 -0
- data/doc/ex/images/Violin.jpg +0 -0
- data/doc/ex/images/Yellow_Rose.miff +0 -0
- data/doc/ex/images/big-duck.gif +0 -0
- data/doc/ex/images/duck.gif +0 -0
- data/doc/ex/images/duck0.gif +0 -0
- data/doc/ex/images/duck1.gif +0 -0
- data/doc/ex/images/duck10.gif +0 -0
- data/doc/ex/images/duck11.gif +0 -0
- data/doc/ex/images/duck12.gif +0 -0
- data/doc/ex/images/duck13.gif +0 -0
- data/doc/ex/images/duck14.gif +0 -0
- data/doc/ex/images/duck15.gif +0 -0
- data/doc/ex/images/duck2.gif +0 -0
- data/doc/ex/images/duck3.gif +0 -0
- data/doc/ex/images/duck4.gif +0 -0
- data/doc/ex/images/duck5.gif +0 -0
- data/doc/ex/images/duck6.gif +0 -0
- data/doc/ex/images/duck7.gif +0 -0
- data/doc/ex/images/duck8.gif +0 -0
- data/doc/ex/images/duck9.gif +0 -0
- data/doc/ex/images/graydient230x6.gif +0 -0
- data/doc/ex/images/image_with_profile.jpg +0 -0
- data/doc/ex/images/logo400x83.gif +0 -0
- data/doc/ex/images/model.miff +0 -0
- data/doc/ex/images/notimplemented.gif +0 -0
- data/doc/ex/images/smile.miff +0 -0
- data/doc/ex/images/spin.gif +0 -0
- data/doc/ex/implode.rb +34 -0
- data/doc/ex/level.rb +11 -0
- data/doc/ex/level_colors.rb +11 -0
- data/doc/ex/line.rb +41 -0
- data/doc/ex/line01.rb +21 -0
- data/doc/ex/mask.rb +35 -0
- data/doc/ex/matte_fill_to_border.rb +39 -0
- data/doc/ex/matte_floodfill.rb +32 -0
- data/doc/ex/matte_replace.rb +39 -0
- data/doc/ex/median_filter.rb +28 -0
- data/doc/ex/modulate.rb +11 -0
- data/doc/ex/mono.rb +23 -0
- data/doc/ex/morph.rb +25 -0
- data/doc/ex/mosaic.rb +35 -0
- data/doc/ex/motion_blur.rb +11 -0
- data/doc/ex/negate.rb +11 -0
- data/doc/ex/negate_channel.rb +9 -0
- data/doc/ex/nested_rvg.rb +21 -0
- data/doc/ex/nonzero.rb +42 -0
- data/doc/ex/normalize.rb +11 -0
- data/doc/ex/oil_paint.rb +11 -0
- data/doc/ex/opacity.rb +37 -0
- data/doc/ex/ordered_dither.rb +11 -0
- data/doc/ex/path.rb +63 -0
- data/doc/ex/pattern1.rb +25 -0
- data/doc/ex/pattern2.rb +26 -0
- data/doc/ex/polaroid.rb +27 -0
- data/doc/ex/polygon.rb +23 -0
- data/doc/ex/polygon01.rb +21 -0
- data/doc/ex/polyline.rb +22 -0
- data/doc/ex/polyline01.rb +21 -0
- data/doc/ex/posterize.rb +8 -0
- data/doc/ex/preview.rb +8 -0
- data/doc/ex/qbezierpath.rb +52 -0
- data/doc/ex/quad01.rb +34 -0
- data/doc/ex/quantize-m.rb +25 -0
- data/doc/ex/radial_blur.rb +9 -0
- data/doc/ex/raise.rb +8 -0
- data/doc/ex/random_threshold_channel.rb +13 -0
- data/doc/ex/rect01.rb +14 -0
- data/doc/ex/rect02.rb +20 -0
- data/doc/ex/rectangle.rb +34 -0
- data/doc/ex/reduce_noise.rb +28 -0
- data/doc/ex/remap.rb +11 -0
- data/doc/ex/remap_images.rb +19 -0
- data/doc/ex/resize_to_fill.rb +8 -0
- data/doc/ex/resize_to_fit.rb +8 -0
- data/doc/ex/roll.rb +9 -0
- data/doc/ex/rotate.rb +44 -0
- data/doc/ex/rotate_f.rb +14 -0
- data/doc/ex/roundrect.rb +33 -0
- data/doc/ex/rubyname.rb +30 -0
- data/doc/ex/rvg_clippath.rb +12 -0
- data/doc/ex/rvg_linecap.rb +42 -0
- data/doc/ex/rvg_linejoin.rb +40 -0
- data/doc/ex/rvg_opacity.rb +18 -0
- data/doc/ex/rvg_pattern.rb +26 -0
- data/doc/ex/rvg_stroke_dasharray.rb +11 -0
- data/doc/ex/segment.rb +11 -0
- data/doc/ex/sepiatone.rb +7 -0
- data/doc/ex/shade.rb +11 -0
- data/doc/ex/shadow.rb +30 -0
- data/doc/ex/shave.rb +15 -0
- data/doc/ex/shear.rb +10 -0
- data/doc/ex/sketch.rb +17 -0
- data/doc/ex/skewx.rb +51 -0
- data/doc/ex/skewy.rb +47 -0
- data/doc/ex/smile.rb +125 -0
- data/doc/ex/solarize.rb +11 -0
- data/doc/ex/sparse_color.rb +54 -0
- data/doc/ex/splice.rb +8 -0
- data/doc/ex/spread.rb +11 -0
- data/doc/ex/stegano.rb +55 -0
- data/doc/ex/stroke_dasharray.rb +42 -0
- data/doc/ex/stroke_fill.rb +10 -0
- data/doc/ex/stroke_linecap.rb +44 -0
- data/doc/ex/stroke_linejoin.rb +48 -0
- data/doc/ex/stroke_width.rb +49 -0
- data/doc/ex/swirl.rb +17 -0
- data/doc/ex/text.rb +37 -0
- data/doc/ex/text01.rb +16 -0
- data/doc/ex/text_align.rb +36 -0
- data/doc/ex/text_antialias.rb +37 -0
- data/doc/ex/text_styles.rb +19 -0
- data/doc/ex/text_undercolor.rb +28 -0
- data/doc/ex/texture_fill_to_border.rb +34 -0
- data/doc/ex/texture_floodfill.rb +32 -0
- data/doc/ex/texturefill.rb +24 -0
- data/doc/ex/threshold.rb +13 -0
- data/doc/ex/to_blob.rb +13 -0
- data/doc/ex/translate.rb +39 -0
- data/doc/ex/transparent.rb +38 -0
- data/doc/ex/transpose.rb +9 -0
- data/doc/ex/transverse.rb +9 -0
- data/doc/ex/tref01.rb +24 -0
- data/doc/ex/triangle01.rb +15 -0
- data/doc/ex/trim.rb +23 -0
- data/doc/ex/tspan01.rb +17 -0
- data/doc/ex/tspan02.rb +17 -0
- data/doc/ex/tspan03.rb +19 -0
- data/doc/ex/unsharp_mask.rb +28 -0
- data/doc/ex/viewex.rb +33 -0
- data/doc/ex/vignette.rb +12 -0
- data/doc/ex/watermark.rb +27 -0
- data/doc/ex/wave.rb +9 -0
- data/doc/ex/wet_floor.rb +58 -0
- data/doc/ex/writing_mode01.rb +26 -0
- data/doc/ex/writing_mode02.rb +26 -0
- data/doc/ilist.html +2056 -0
- data/doc/image1.html +4680 -0
- data/doc/image2.html +3665 -0
- data/doc/image3.html +4522 -0
- data/doc/imageattrs.html +1638 -0
- data/doc/imusage.html +514 -0
- data/doc/index.html +416 -0
- data/doc/info.html +1499 -0
- data/doc/magick.html +565 -0
- data/doc/optequiv.html +2435 -0
- data/doc/rvg.html +975 -0
- data/doc/rvgclip.html +248 -0
- data/doc/rvggroup.html +305 -0
- data/doc/rvgimage.html +289 -0
- data/doc/rvgpattern.html +475 -0
- data/doc/rvgshape.html +406 -0
- data/doc/rvgstyle.html +270 -0
- data/doc/rvgtext.html +465 -0
- data/doc/rvgtspan.html +238 -0
- data/doc/rvgtut.html +530 -0
- data/doc/rvguse.html +145 -0
- data/doc/rvgxform.html +294 -0
- data/doc/scripts/doc.js +22 -0
- data/doc/scripts/stripeTables.js +23 -0
- data/doc/struct.html +1339 -0
- data/doc/usage.html +1621 -0
- data/examples/constitute.rb +7 -0
- data/examples/crop_with_gravity.rb +42 -0
- data/examples/demo.rb +324 -0
- data/examples/describe.rb +43 -0
- data/examples/find_similar_region.rb +34 -0
- data/examples/histogram.rb +321 -0
- data/examples/identify.rb +185 -0
- data/examples/image_opacity.rb +29 -0
- data/examples/import_export.rb +31 -0
- data/examples/pattern_fill.rb +38 -0
- data/examples/rotating_text.rb +44 -0
- data/examples/spinner.rb +49 -0
- data/examples/thumbnail.rb +64 -0
- data/examples/vignette.rb +78 -0
- data/ext/RMagick/extconf.rb +548 -0
- data/ext/RMagick/rmagick.c +401 -0
- data/ext/RMagick/rmagick.h +1287 -0
- data/ext/RMagick/rmdraw.c +2022 -0
- data/ext/RMagick/rmenum.c +1235 -0
- data/ext/RMagick/rmfill.c +720 -0
- data/ext/RMagick/rmilist.c +1270 -0
- data/ext/RMagick/rmimage.c +15427 -0
- data/ext/RMagick/rminfo.c +2590 -0
- data/ext/RMagick/rmmain.c +1741 -0
- data/ext/RMagick/rmmontage.c +519 -0
- data/ext/RMagick/rmpixel.c +1114 -0
- data/ext/RMagick/rmstruct.c +1124 -0
- data/ext/RMagick/rmutil.c +1754 -0
- data/lib/rmagick.rb +1 -0
- data/lib/rmagick/version.rb +6 -0
- data/lib/rmagick_internal.rb +1947 -0
- data/lib/rvg/clippath.rb +45 -0
- data/lib/rvg/container.rb +122 -0
- data/lib/rvg/deep_equal.rb +52 -0
- data/lib/rvg/describable.rb +47 -0
- data/lib/rvg/embellishable.rb +391 -0
- data/lib/rvg/misc.rb +723 -0
- data/lib/rvg/paint.rb +50 -0
- data/lib/rvg/pathdata.rb +126 -0
- data/lib/rvg/rvg.rb +283 -0
- data/lib/rvg/stretchable.rb +165 -0
- data/lib/rvg/stylable.rb +116 -0
- data/lib/rvg/text.rb +172 -0
- data/lib/rvg/transformable.rb +126 -0
- data/lib/rvg/units.rb +63 -0
- data/rmagick.gemspec +46 -0
- data/spec/rmagick/ImageList1_spec.rb +24 -0
- data/spec/rmagick/draw_spec.rb +156 -0
- data/spec/rmagick/image/blue_shift_spec.rb +16 -0
- data/spec/rmagick/image/composite_spec.rb +140 -0
- data/spec/rmagick/image/constitute_spec.rb +15 -0
- data/spec/rmagick/image/dispatch_spec.rb +18 -0
- data/spec/rmagick/image/from_blob_spec.rb +14 -0
- data/spec/rmagick/image/ping_spec.rb +14 -0
- data/spec/rmagick/image/properties_spec.rb +29 -0
- data/spec/spec_helper.rb +4 -0
- data/test/Image1.rb +565 -0
- data/test/Image2.rb +1304 -0
- data/test/Image3.rb +1030 -0
- data/test/ImageList1.rb +806 -0
- data/test/ImageList2.rb +385 -0
- data/test/Image_attributes.rb +697 -0
- data/test/Import_Export.rb +121 -0
- data/test/Info.rb +345 -0
- data/test/Magick.rb +321 -0
- data/test/Pixel.rb +116 -0
- data/test/Preview.rb +57 -0
- data/test/cmyk.icm +0 -0
- data/test/srgb.icm +0 -0
- data/test/test_all_basic.rb +38 -0
- data/test/tmpnam_test.rb +50 -0
- data/wercker.yml +10 -0
- metadata +509 -0
@@ -0,0 +1,1124 @@
|
|
1
|
+
/**************************************************************************//**
|
2
|
+
* Contains various Struct class methods.
|
3
|
+
*
|
4
|
+
* Copyright © 2002 - 2009 by Timothy P. Hunter
|
5
|
+
*
|
6
|
+
* Changes since Nov. 2009 copyright © by Benjamin Thomas and Omer Bar-or
|
7
|
+
*
|
8
|
+
* @file rmstruct.c
|
9
|
+
* @version $Id: rmstruct.c,v 1.5 2009/12/20 02:33:34 baror Exp $
|
10
|
+
* @author Tim Hunter
|
11
|
+
******************************************************************************/
|
12
|
+
|
13
|
+
#include "rmagick.h"
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
static const char *ComplianceType_name(ComplianceType *);
|
19
|
+
static VALUE ComplianceType_new(ComplianceType);
|
20
|
+
static const char *StretchType_name(StretchType);
|
21
|
+
static VALUE StretchType_new(StretchType);
|
22
|
+
static const char *StyleType_name(StyleType);
|
23
|
+
static VALUE StyleType_new(StyleType);
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Given a C AffineMatrix, create the equivalent AffineMatrix object.
|
30
|
+
*
|
31
|
+
* No Ruby usage (internal function)
|
32
|
+
*
|
33
|
+
* Notes:
|
34
|
+
* - am = Magick::AffineMatrix.new(sx, rx, ry, sy, tx, ty)
|
35
|
+
*
|
36
|
+
* @param affine the C AffineMatrix
|
37
|
+
* @return a Ruby AffineMatrix object
|
38
|
+
*/
|
39
|
+
VALUE
|
40
|
+
Import_AffineMatrix(AffineMatrix *affine)
|
41
|
+
{
|
42
|
+
VALUE argv[6];
|
43
|
+
|
44
|
+
argv[0] = rb_float_new(affine->sx);
|
45
|
+
argv[1] = rb_float_new(affine->rx);
|
46
|
+
argv[2] = rb_float_new(affine->ry);
|
47
|
+
argv[3] = rb_float_new(affine->sy);
|
48
|
+
argv[4] = rb_float_new(affine->tx);
|
49
|
+
argv[5] = rb_float_new(affine->ty);
|
50
|
+
return rb_class_new_instance(6, argv, Class_AffineMatrix);
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Convert a Magick::AffineMatrix object to a AffineMatrix structure.
|
56
|
+
*
|
57
|
+
* No Ruby usage (internal function)
|
58
|
+
*
|
59
|
+
* Notes:
|
60
|
+
* - If not initialized, the defaults are [sx,rx,ry,sy,tx,ty] = [1,0,0,1,0,0]
|
61
|
+
*
|
62
|
+
* @param am The C AffineMatrix to modify
|
63
|
+
* @param st the Ruby AffineMatrix object
|
64
|
+
*/
|
65
|
+
void
|
66
|
+
Export_AffineMatrix(AffineMatrix *am, VALUE st)
|
67
|
+
{
|
68
|
+
VALUE values, v;
|
69
|
+
|
70
|
+
if (CLASS_OF(st) != Class_AffineMatrix)
|
71
|
+
{
|
72
|
+
rb_raise(rb_eTypeError, "type mismatch: %s given",
|
73
|
+
rb_class2name(CLASS_OF(st)));
|
74
|
+
}
|
75
|
+
values = rb_funcall(st, rm_ID_values, 0);
|
76
|
+
v = rb_ary_entry(values, 0);
|
77
|
+
am->sx = v == Qnil ? 1.0 : NUM2DBL(v);
|
78
|
+
v = rb_ary_entry(values, 1);
|
79
|
+
am->rx = v == Qnil ? 0.0 : NUM2DBL(v);
|
80
|
+
v = rb_ary_entry(values, 2);
|
81
|
+
am->ry = v == Qnil ? 0.0 : NUM2DBL(v);
|
82
|
+
v = rb_ary_entry(values, 3);
|
83
|
+
am->sy = v == Qnil ? 1.0 : NUM2DBL(v);
|
84
|
+
v = rb_ary_entry(values, 4);
|
85
|
+
am->tx = v == Qnil ? 0.0 : NUM2DBL(v);
|
86
|
+
v = rb_ary_entry(values, 5);
|
87
|
+
am->ty = v == Qnil ? 0.0 : NUM2DBL(v);
|
88
|
+
|
89
|
+
RB_GC_GUARD(values);
|
90
|
+
RB_GC_GUARD(v);
|
91
|
+
}
|
92
|
+
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Create a Magick::ChromaticityInfo object from a ChromaticityInfo structure.
|
96
|
+
*
|
97
|
+
* No Ruby usage (internal function)
|
98
|
+
*
|
99
|
+
* @param ci the C ChromaticityInfo
|
100
|
+
* @return a Ruby Magick::ChromaticityInfo object
|
101
|
+
*/
|
102
|
+
VALUE
|
103
|
+
ChromaticityInfo_new(ChromaticityInfo *ci)
|
104
|
+
{
|
105
|
+
VALUE red_primary;
|
106
|
+
VALUE green_primary;
|
107
|
+
VALUE blue_primary;
|
108
|
+
VALUE white_point;
|
109
|
+
|
110
|
+
red_primary = Import_PrimaryInfo(&ci->red_primary);
|
111
|
+
green_primary = Import_PrimaryInfo(&ci->green_primary);
|
112
|
+
blue_primary = Import_PrimaryInfo(&ci->blue_primary);
|
113
|
+
white_point = Import_PrimaryInfo(&ci->white_point);
|
114
|
+
|
115
|
+
RB_GC_GUARD(red_primary);
|
116
|
+
RB_GC_GUARD(green_primary);
|
117
|
+
RB_GC_GUARD(blue_primary);
|
118
|
+
RB_GC_GUARD(white_point);
|
119
|
+
|
120
|
+
return rb_funcall(Class_Chromaticity, rm_ID_new, 4
|
121
|
+
, red_primary, green_primary, blue_primary, white_point);
|
122
|
+
}
|
123
|
+
|
124
|
+
|
125
|
+
/**
|
126
|
+
* Extract the elements from a Magick::ChromaticityInfo and store in a
|
127
|
+
* ChromaticityInfo structure.
|
128
|
+
*
|
129
|
+
* No Ruby usage (internal function)
|
130
|
+
*
|
131
|
+
* @param ci the C ChromaticityInfo structure to modify
|
132
|
+
* @param chrom the Ruby Magick::ChromaticityInfo object
|
133
|
+
*/
|
134
|
+
void
|
135
|
+
Export_ChromaticityInfo(ChromaticityInfo *ci, VALUE chrom)
|
136
|
+
{
|
137
|
+
VALUE chrom_members;
|
138
|
+
VALUE red_primary, green_primary, blue_primary, white_point;
|
139
|
+
VALUE entry_members, x, y;
|
140
|
+
ID values_id;
|
141
|
+
|
142
|
+
if (CLASS_OF(chrom) != Class_Chromaticity)
|
143
|
+
{
|
144
|
+
rb_raise(rb_eTypeError, "type mismatch: %s given",
|
145
|
+
rb_class2name(CLASS_OF(chrom)));
|
146
|
+
}
|
147
|
+
values_id = rm_ID_values;
|
148
|
+
|
149
|
+
// Get the struct members in an array
|
150
|
+
chrom_members = rb_funcall(chrom, values_id, 0);
|
151
|
+
red_primary = rb_ary_entry(chrom_members, 0);
|
152
|
+
green_primary = rb_ary_entry(chrom_members, 1);
|
153
|
+
blue_primary = rb_ary_entry(chrom_members, 2);
|
154
|
+
white_point = rb_ary_entry(chrom_members, 3);
|
155
|
+
|
156
|
+
// Get the red_primary PrimaryInfo members in an array
|
157
|
+
entry_members = rb_funcall(red_primary, values_id, 0);
|
158
|
+
x = rb_ary_entry(entry_members, 0); // red_primary.x
|
159
|
+
ci->red_primary.x = x == Qnil ? 0.0 : NUM2DBL(x);
|
160
|
+
y = rb_ary_entry(entry_members, 1); // red_primary.y
|
161
|
+
ci->red_primary.y = y == Qnil ? 0.0 : NUM2DBL(y);
|
162
|
+
ci->red_primary.z = 0.0;
|
163
|
+
|
164
|
+
// Get the green_primary PrimaryInfo members in an array
|
165
|
+
entry_members = rb_funcall(green_primary, values_id, 0);
|
166
|
+
x = rb_ary_entry(entry_members, 0); // green_primary.x
|
167
|
+
ci->green_primary.x = x == Qnil ? 0.0 : NUM2DBL(x);
|
168
|
+
y = rb_ary_entry(entry_members, 1); // green_primary.y
|
169
|
+
ci->green_primary.y = y == Qnil ? 0.0 : NUM2DBL(y);
|
170
|
+
ci->green_primary.z = 0.0;
|
171
|
+
|
172
|
+
// Get the blue_primary PrimaryInfo members in an array
|
173
|
+
entry_members = rb_funcall(blue_primary, values_id, 0);
|
174
|
+
x = rb_ary_entry(entry_members, 0); // blue_primary.x
|
175
|
+
ci->blue_primary.x = x == Qnil ? 0.0 : NUM2DBL(x);
|
176
|
+
y = rb_ary_entry(entry_members, 1); // blue_primary.y
|
177
|
+
ci->blue_primary.y = y == Qnil ? 0.0 : NUM2DBL(y);
|
178
|
+
ci->blue_primary.z = 0.0;
|
179
|
+
|
180
|
+
// Get the white_point PrimaryInfo members in an array
|
181
|
+
entry_members = rb_funcall(white_point, values_id, 0);
|
182
|
+
x = rb_ary_entry(entry_members, 0); // white_point.x
|
183
|
+
ci->white_point.x = x == Qnil ? 0.0 : NUM2DBL(x);
|
184
|
+
y = rb_ary_entry(entry_members, 1); // white_point.y
|
185
|
+
ci->white_point.y = y == Qnil ? 0.0 : NUM2DBL(y);
|
186
|
+
ci->white_point.z = 0.0;
|
187
|
+
|
188
|
+
RB_GC_GUARD(chrom_members);
|
189
|
+
RB_GC_GUARD(red_primary);
|
190
|
+
RB_GC_GUARD(green_primary);
|
191
|
+
RB_GC_GUARD(blue_primary);
|
192
|
+
RB_GC_GUARD(white_point);
|
193
|
+
RB_GC_GUARD(entry_members);
|
194
|
+
RB_GC_GUARD(x);
|
195
|
+
RB_GC_GUARD(y);
|
196
|
+
}
|
197
|
+
|
198
|
+
|
199
|
+
/**
|
200
|
+
* Create a string representation of a Magick::Chromaticity.
|
201
|
+
*
|
202
|
+
* Ruby usage:
|
203
|
+
* - @verbatim Magick::Chromaticity#to_s @endverbatim
|
204
|
+
*
|
205
|
+
* @param self this object
|
206
|
+
* @return the string
|
207
|
+
*/
|
208
|
+
VALUE
|
209
|
+
ChromaticityInfo_to_s(VALUE self)
|
210
|
+
{
|
211
|
+
ChromaticityInfo ci;
|
212
|
+
char buff[200];
|
213
|
+
|
214
|
+
Export_ChromaticityInfo(&ci, self);
|
215
|
+
sprintf(buff, "red_primary=(x=%g,y=%g) "
|
216
|
+
"green_primary=(x=%g,y=%g) "
|
217
|
+
"blue_primary=(x=%g,y=%g) "
|
218
|
+
"white_point=(x=%g,y=%g) ",
|
219
|
+
ci.red_primary.x, ci.red_primary.y,
|
220
|
+
ci.green_primary.x, ci.green_primary.y,
|
221
|
+
ci.blue_primary.x, ci.blue_primary.y,
|
222
|
+
ci.white_point.x, ci.white_point.y);
|
223
|
+
return rb_str_new2(buff);
|
224
|
+
}
|
225
|
+
|
226
|
+
|
227
|
+
/**
|
228
|
+
* Convert a ColorInfo structure to a Magick::Color.
|
229
|
+
*
|
230
|
+
* No Ruby usage (internal function)
|
231
|
+
*
|
232
|
+
* @param ci the C ColorInfo structure
|
233
|
+
* @return a Ruby Magick::Color object
|
234
|
+
*/
|
235
|
+
VALUE
|
236
|
+
Import_ColorInfo(const ColorInfo *ci)
|
237
|
+
{
|
238
|
+
ComplianceType compliance_type;
|
239
|
+
VALUE name;
|
240
|
+
VALUE compliance;
|
241
|
+
VALUE color;
|
242
|
+
|
243
|
+
name = rb_str_new2(ci->name);
|
244
|
+
|
245
|
+
compliance_type = ci->compliance;
|
246
|
+
compliance = ComplianceType_new(compliance_type);
|
247
|
+
color = Pixel_from_MagickPixelPacket(&(ci->color));
|
248
|
+
|
249
|
+
RB_GC_GUARD(name);
|
250
|
+
RB_GC_GUARD(compliance);
|
251
|
+
RB_GC_GUARD(color);
|
252
|
+
|
253
|
+
return rb_funcall(Class_Color, rm_ID_new, 3
|
254
|
+
, name, compliance, color);
|
255
|
+
}
|
256
|
+
|
257
|
+
|
258
|
+
/**
|
259
|
+
* Convert a Magick::Color to a ColorInfo structure.
|
260
|
+
*
|
261
|
+
* No Ruby usage (internal function)
|
262
|
+
*
|
263
|
+
* @param ci the C ColorInfo structure to modify
|
264
|
+
* @param st the Ruby Magick::Color object
|
265
|
+
*/
|
266
|
+
void
|
267
|
+
Export_ColorInfo(ColorInfo *ci, VALUE st)
|
268
|
+
{
|
269
|
+
Pixel *pixel;
|
270
|
+
VALUE members, m;
|
271
|
+
|
272
|
+
if (CLASS_OF(st) != Class_Color)
|
273
|
+
{
|
274
|
+
rb_raise(rb_eTypeError, "type mismatch: %s given",
|
275
|
+
rb_class2name(CLASS_OF(st)));
|
276
|
+
}
|
277
|
+
|
278
|
+
memset(ci, '\0', sizeof(ColorInfo));
|
279
|
+
|
280
|
+
members = rb_funcall(st, rm_ID_values, 0);
|
281
|
+
|
282
|
+
m = rb_ary_entry(members, 0);
|
283
|
+
if (m != Qnil)
|
284
|
+
{
|
285
|
+
(void) CloneString((char **)&(ci->name), StringValuePtr(m));
|
286
|
+
}
|
287
|
+
m = rb_ary_entry(members, 1);
|
288
|
+
if (m != Qnil)
|
289
|
+
{
|
290
|
+
VALUE_TO_ENUM(m, ci->compliance, ComplianceType);
|
291
|
+
}
|
292
|
+
m = rb_ary_entry(members, 2);
|
293
|
+
if (m != Qnil)
|
294
|
+
{
|
295
|
+
Data_Get_Struct(m, Pixel, pixel);
|
296
|
+
// For >= 6.3.0, ColorInfo.color is a MagickPixelPacket so we have to
|
297
|
+
// convert the PixelPacket.
|
298
|
+
GetMagickPixelPacket(NULL, &ci->color);
|
299
|
+
ci->color.red = (MagickRealType) pixel->red;
|
300
|
+
ci->color.green = (MagickRealType) pixel->green;
|
301
|
+
ci->color.blue = (MagickRealType) pixel->blue;
|
302
|
+
ci->color.opacity = (MagickRealType) OpaqueOpacity;
|
303
|
+
ci->color.index = (MagickRealType) 0;
|
304
|
+
}
|
305
|
+
|
306
|
+
RB_GC_GUARD(members);
|
307
|
+
RB_GC_GUARD(m);
|
308
|
+
}
|
309
|
+
|
310
|
+
|
311
|
+
/**
|
312
|
+
* Convert either a String color name or a Magick::Pixel to a MagickPixelPacket.
|
313
|
+
*
|
314
|
+
* No Ruby usage (internal function)
|
315
|
+
*
|
316
|
+
* Notes:
|
317
|
+
* - The channel values in a MagickPixelPacket are doubles.
|
318
|
+
*
|
319
|
+
* @param image the Image
|
320
|
+
* @param mpp The MagickPixelPacket to modify
|
321
|
+
* @param color the name of the color
|
322
|
+
*/
|
323
|
+
void
|
324
|
+
Color_to_MagickPixelPacket(Image *image, MagickPixelPacket *mpp, VALUE color)
|
325
|
+
{
|
326
|
+
PixelPacket pp;
|
327
|
+
|
328
|
+
// image can be NULL
|
329
|
+
GetMagickPixelPacket(image, mpp);
|
330
|
+
|
331
|
+
memset(&pp, '\0', sizeof(pp));
|
332
|
+
Color_to_PixelPacket(&pp, color);
|
333
|
+
mpp->red = (MagickRealType) pp.red;
|
334
|
+
mpp->green = (MagickRealType) pp.green;
|
335
|
+
mpp->blue = (MagickRealType) pp.blue;
|
336
|
+
mpp->opacity = (MagickRealType) pp.opacity;
|
337
|
+
}
|
338
|
+
|
339
|
+
|
340
|
+
/**
|
341
|
+
* Free the storage allocated by Export_ColorInfo.
|
342
|
+
*
|
343
|
+
* No Ruby usage (internal function)
|
344
|
+
*
|
345
|
+
* @param ci the ColorInfo object
|
346
|
+
* @see Export_ColorInfo
|
347
|
+
*/
|
348
|
+
static void
|
349
|
+
destroy_ColorInfo(ColorInfo *ci)
|
350
|
+
{
|
351
|
+
magick_free((void*)ci->name);
|
352
|
+
ci->name = NULL;
|
353
|
+
}
|
354
|
+
|
355
|
+
|
356
|
+
/**
|
357
|
+
* Return a string representation of a Magick::Color object.
|
358
|
+
*
|
359
|
+
* Ruby usage:
|
360
|
+
* - @verbatim Color#to_s @endverbatim
|
361
|
+
*
|
362
|
+
* @param self this object
|
363
|
+
* @return the string
|
364
|
+
*/
|
365
|
+
VALUE
|
366
|
+
Color_to_s(VALUE self)
|
367
|
+
{
|
368
|
+
ColorInfo ci;
|
369
|
+
char buff[1024];
|
370
|
+
|
371
|
+
Export_ColorInfo(&ci, self);
|
372
|
+
|
373
|
+
sprintf(buff, "name=%s, compliance=%s, "
|
374
|
+
#if (MAGICKCORE_QUANTUM_DEPTH == 32 || MAGICKCORE_QUANTUM_DEPTH == 64) && defined(HAVE_TYPE_LONG_DOUBLE)
|
375
|
+
"color.red=%Lg, color.green=%Lg, color.blue=%Lg, color.opacity=%Lg ",
|
376
|
+
#else
|
377
|
+
"color.red=%g, color.green=%g, color.blue=%g, color.opacity=%g ",
|
378
|
+
#endif
|
379
|
+
ci.name,
|
380
|
+
ComplianceType_name(&ci.compliance),
|
381
|
+
ci.color.red, ci.color.green, ci.color.blue, ci.color.opacity);
|
382
|
+
|
383
|
+
destroy_ColorInfo(&ci);
|
384
|
+
return rb_str_new2(buff);
|
385
|
+
}
|
386
|
+
|
387
|
+
|
388
|
+
/**
|
389
|
+
* Return the string representation of a ComplianceType value.
|
390
|
+
*
|
391
|
+
* No Ruby usage (internal function)
|
392
|
+
*
|
393
|
+
* Notes:
|
394
|
+
* - xMagick will OR multiple compliance types so we have to arbitrarily pick
|
395
|
+
* one name.
|
396
|
+
* - Set the compliance argument to the selected value.
|
397
|
+
*
|
398
|
+
* @param c the ComplianceType value
|
399
|
+
* @return the string
|
400
|
+
*/
|
401
|
+
static const char *
|
402
|
+
ComplianceType_name(ComplianceType *c)
|
403
|
+
{
|
404
|
+
if ((*c & (SVGCompliance|X11Compliance|XPMCompliance))
|
405
|
+
== (SVGCompliance|X11Compliance|XPMCompliance))
|
406
|
+
{
|
407
|
+
return "AllCompliance";
|
408
|
+
}
|
409
|
+
else if (*c & SVGCompliance)
|
410
|
+
{
|
411
|
+
*c = SVGCompliance;
|
412
|
+
return "SVGCompliance";
|
413
|
+
}
|
414
|
+
else if (*c & X11Compliance)
|
415
|
+
{
|
416
|
+
*c = X11Compliance;
|
417
|
+
return "X11Compliance";
|
418
|
+
}
|
419
|
+
else if (*c & XPMCompliance)
|
420
|
+
{
|
421
|
+
*c = XPMCompliance;
|
422
|
+
return "XPMCompliance";
|
423
|
+
}
|
424
|
+
else if (*c == NoCompliance)
|
425
|
+
{
|
426
|
+
*c = NoCompliance;
|
427
|
+
return "NoCompliance";
|
428
|
+
}
|
429
|
+
else
|
430
|
+
{
|
431
|
+
*c = UndefinedCompliance;
|
432
|
+
return "UndefinedCompliance";
|
433
|
+
}
|
434
|
+
}
|
435
|
+
|
436
|
+
|
437
|
+
/**
|
438
|
+
* Construct a ComplianceType enum object for the specified value.
|
439
|
+
*
|
440
|
+
* No Ruby usage (internal function)
|
441
|
+
*
|
442
|
+
* @param compliance the C ComplianceType value
|
443
|
+
* @return the Ruby ComplianceType enum object
|
444
|
+
*/
|
445
|
+
static VALUE
|
446
|
+
ComplianceType_new(ComplianceType compliance)
|
447
|
+
{
|
448
|
+
const char *name;
|
449
|
+
|
450
|
+
// Turn off undefined bits
|
451
|
+
compliance &= (SVGCompliance|X11Compliance|XPMCompliance);
|
452
|
+
name = ComplianceType_name(&compliance);
|
453
|
+
return rm_enum_new(Class_ComplianceType, ID2SYM(rb_intern(name)), INT2FIX(compliance));
|
454
|
+
}
|
455
|
+
|
456
|
+
|
457
|
+
/**
|
458
|
+
* Convert a TypeInfo structure to a Magick::Font.
|
459
|
+
*
|
460
|
+
* No Ruby usage (internal function)
|
461
|
+
*
|
462
|
+
* @param ti the C TypeInfo structure
|
463
|
+
* @return a Ruby Magick::Font object
|
464
|
+
*/
|
465
|
+
VALUE
|
466
|
+
Import_TypeInfo(const TypeInfo *ti)
|
467
|
+
{
|
468
|
+
VALUE name, description, family;
|
469
|
+
VALUE style, stretch, weight;
|
470
|
+
VALUE encoding, foundry, format;
|
471
|
+
|
472
|
+
name = rb_str_new2(ti->name);
|
473
|
+
family = rb_str_new2(ti->family);
|
474
|
+
style = StyleType_new(ti->style);
|
475
|
+
stretch = StretchType_new(ti->stretch);
|
476
|
+
weight = ULONG2NUM(ti->weight);
|
477
|
+
description = ti->description ? rb_str_new2(ti->description) : Qnil;
|
478
|
+
encoding = ti->encoding ? rb_str_new2(ti->encoding) : Qnil;
|
479
|
+
foundry = ti->foundry ? rb_str_new2(ti->foundry) : Qnil;
|
480
|
+
format = ti->format ? rb_str_new2(ti->format) : Qnil;
|
481
|
+
|
482
|
+
RB_GC_GUARD(name);
|
483
|
+
RB_GC_GUARD(description);
|
484
|
+
RB_GC_GUARD(family);
|
485
|
+
RB_GC_GUARD(style);
|
486
|
+
RB_GC_GUARD(stretch);
|
487
|
+
RB_GC_GUARD(weight);
|
488
|
+
RB_GC_GUARD(encoding);
|
489
|
+
RB_GC_GUARD(foundry);
|
490
|
+
RB_GC_GUARD(format);
|
491
|
+
|
492
|
+
return rb_funcall(Class_Font, rm_ID_new, 9
|
493
|
+
, name, description, family, style
|
494
|
+
, stretch, weight, encoding, foundry, format);
|
495
|
+
}
|
496
|
+
|
497
|
+
|
498
|
+
/**
|
499
|
+
* Convert a Magick::Font to a TypeInfo structure.
|
500
|
+
*
|
501
|
+
* No Ruby usage (internal function)
|
502
|
+
*
|
503
|
+
* @param ti the C TypeInfo structure to modify
|
504
|
+
* @param st the Ruby Magick::Font object
|
505
|
+
*/
|
506
|
+
void
|
507
|
+
Export_TypeInfo(TypeInfo *ti, VALUE st)
|
508
|
+
{
|
509
|
+
VALUE members, m;
|
510
|
+
|
511
|
+
if (CLASS_OF(st) != Class_Font)
|
512
|
+
{
|
513
|
+
rb_raise(rb_eTypeError, "type mismatch: %s given",
|
514
|
+
rb_class2name(CLASS_OF(st)));
|
515
|
+
}
|
516
|
+
|
517
|
+
memset(ti, '\0', sizeof(TypeInfo));
|
518
|
+
|
519
|
+
members = rb_funcall(st, rm_ID_values, 0);
|
520
|
+
m = rb_ary_entry(members, 0);
|
521
|
+
if (m != Qnil)
|
522
|
+
{
|
523
|
+
(void) CloneString((char **)&(ti->name), StringValuePtr(m));
|
524
|
+
}
|
525
|
+
m = rb_ary_entry(members, 1);
|
526
|
+
if (m != Qnil)
|
527
|
+
{
|
528
|
+
(void) CloneString((char **)&(ti->description), StringValuePtr(m));
|
529
|
+
}
|
530
|
+
m = rb_ary_entry(members, 2);
|
531
|
+
if (m != Qnil)
|
532
|
+
{
|
533
|
+
(void) CloneString((char **)&(ti->family), StringValuePtr(m));
|
534
|
+
}
|
535
|
+
m = rb_ary_entry(members, 3); ti->style = m == Qnil ? 0 : FIX2INT(m);
|
536
|
+
m = rb_ary_entry(members, 4); ti->stretch = m == Qnil ? 0 : FIX2INT(m);
|
537
|
+
m = rb_ary_entry(members, 5); ti->weight = m == Qnil ? 0 : FIX2INT(m);
|
538
|
+
|
539
|
+
m = rb_ary_entry(members, 6);
|
540
|
+
if (m != Qnil)
|
541
|
+
(void) CloneString((char **)&(ti->encoding), StringValuePtr(m));
|
542
|
+
m = rb_ary_entry(members, 7);
|
543
|
+
if (m != Qnil)
|
544
|
+
(void) CloneString((char **)&(ti->foundry), StringValuePtr(m));
|
545
|
+
m = rb_ary_entry(members, 8);
|
546
|
+
if (m != Qnil)
|
547
|
+
(void) CloneString((char **)&(ti->format), StringValuePtr(m));
|
548
|
+
|
549
|
+
RB_GC_GUARD(members);
|
550
|
+
RB_GC_GUARD(m);
|
551
|
+
}
|
552
|
+
|
553
|
+
|
554
|
+
/**
|
555
|
+
* Free the storage allocated by Export_TypeInfo.
|
556
|
+
*
|
557
|
+
* No Ruby usage (internal function)
|
558
|
+
*
|
559
|
+
* @param ti the TypeInfo object
|
560
|
+
* @see Export_TypeInfo
|
561
|
+
*/
|
562
|
+
static void
|
563
|
+
destroy_TypeInfo(TypeInfo *ti)
|
564
|
+
{
|
565
|
+
magick_free((void*)ti->name);
|
566
|
+
ti->name = NULL;
|
567
|
+
magick_free((void*)ti->description);
|
568
|
+
ti->description = NULL;
|
569
|
+
magick_free((void*)ti->family);
|
570
|
+
ti->family = NULL;
|
571
|
+
magick_free((void*)ti->encoding);
|
572
|
+
ti->encoding = NULL;
|
573
|
+
magick_free((void*)ti->foundry);
|
574
|
+
ti->foundry = NULL;
|
575
|
+
magick_free((void*)ti->format);
|
576
|
+
ti->format = NULL;
|
577
|
+
}
|
578
|
+
|
579
|
+
|
580
|
+
/**
|
581
|
+
* Implement the Font#to_s method.
|
582
|
+
*
|
583
|
+
* No Ruby usage (internal function)
|
584
|
+
*
|
585
|
+
* @param self this object
|
586
|
+
* @return the string
|
587
|
+
*/
|
588
|
+
VALUE
|
589
|
+
Font_to_s(VALUE self)
|
590
|
+
{
|
591
|
+
TypeInfo ti;
|
592
|
+
char weight[20];
|
593
|
+
char buff[1024];
|
594
|
+
|
595
|
+
Export_TypeInfo(&ti, self);
|
596
|
+
|
597
|
+
switch (ti.weight)
|
598
|
+
{
|
599
|
+
case 400:
|
600
|
+
strcpy(weight, "NormalWeight");
|
601
|
+
break;
|
602
|
+
case 700:
|
603
|
+
strcpy(weight, "BoldWeight");
|
604
|
+
break;
|
605
|
+
default:
|
606
|
+
sprintf(weight, "%lu", ti.weight);
|
607
|
+
break;
|
608
|
+
}
|
609
|
+
|
610
|
+
sprintf(buff, "name=%s, description=%s, "
|
611
|
+
"family=%s, style=%s, stretch=%s, weight=%s, "
|
612
|
+
"encoding=%s, foundry=%s, format=%s",
|
613
|
+
ti.name,
|
614
|
+
ti.description,
|
615
|
+
ti.family,
|
616
|
+
StyleType_name(ti.style),
|
617
|
+
StretchType_name(ti.stretch),
|
618
|
+
weight,
|
619
|
+
ti.encoding ? ti.encoding : "",
|
620
|
+
ti.foundry ? ti.foundry : "",
|
621
|
+
ti.format ? ti.format : "");
|
622
|
+
|
623
|
+
destroy_TypeInfo(&ti);
|
624
|
+
return rb_str_new2(buff);
|
625
|
+
|
626
|
+
}
|
627
|
+
|
628
|
+
|
629
|
+
/**
|
630
|
+
* Create a Magick::Point object from a PointInfo structure.
|
631
|
+
*
|
632
|
+
* No Ruby usage (internal function)
|
633
|
+
*
|
634
|
+
* @param p the C PointInfo structure
|
635
|
+
* @return a Ruby Magick::Point object
|
636
|
+
*/
|
637
|
+
VALUE
|
638
|
+
Import_PointInfo(PointInfo *p)
|
639
|
+
{
|
640
|
+
return rb_funcall(Class_Point, rm_ID_new, 2
|
641
|
+
, INT2FIX(p->x), INT2FIX(p->y));
|
642
|
+
}
|
643
|
+
|
644
|
+
|
645
|
+
/**
|
646
|
+
* Convert a Magick::Point object to a PointInfo structure.
|
647
|
+
*
|
648
|
+
* No Ruby usage (internal function)
|
649
|
+
*
|
650
|
+
* @param pi the C PointInfo structure to modify
|
651
|
+
* @param sp the Ruby Magick::Point object
|
652
|
+
*/
|
653
|
+
void
|
654
|
+
Export_PointInfo(PointInfo *pi, VALUE sp)
|
655
|
+
{
|
656
|
+
VALUE members, m;
|
657
|
+
|
658
|
+
if (CLASS_OF(sp) != Class_Point)
|
659
|
+
{
|
660
|
+
rb_raise(rb_eTypeError, "type mismatch: %s given",
|
661
|
+
rb_class2name(CLASS_OF(sp)));
|
662
|
+
}
|
663
|
+
members = rb_funcall(sp, rm_ID_values, 0);
|
664
|
+
m = rb_ary_entry(members, 0);
|
665
|
+
pi->x = m == Qnil ? 0.0 : NUM2DBL(m);
|
666
|
+
m = rb_ary_entry(members, 1);
|
667
|
+
pi->y = m == Qnil ? 0.0 : NUM2DBL(m);
|
668
|
+
|
669
|
+
RB_GC_GUARD(members);
|
670
|
+
RB_GC_GUARD(m);
|
671
|
+
}
|
672
|
+
|
673
|
+
|
674
|
+
/**
|
675
|
+
* Create a Magick::PrimaryInfo object from a PrimaryInfo structure.
|
676
|
+
*
|
677
|
+
* No Ruby usage (internal function)
|
678
|
+
*
|
679
|
+
* @param p the C PrimaryInfo structure
|
680
|
+
* @return a Ruby Magick::PrimaryInfo object
|
681
|
+
*/
|
682
|
+
VALUE
|
683
|
+
Import_PrimaryInfo(PrimaryInfo *p)
|
684
|
+
{
|
685
|
+
return rb_funcall(Class_Primary, rm_ID_new, 3
|
686
|
+
, INT2FIX(p->x), INT2FIX(p->y), INT2FIX(p->z));
|
687
|
+
}
|
688
|
+
|
689
|
+
|
690
|
+
/**
|
691
|
+
* Convert a Magick::PrimaryInfo object to a PrimaryInfo structure.
|
692
|
+
*
|
693
|
+
* No Ruby usage (internal function)
|
694
|
+
*
|
695
|
+
* @param pi the C PrimaryInfo structure to modify
|
696
|
+
* @param sp the Ruby Magick::PrimaryInfo object
|
697
|
+
*/
|
698
|
+
void
|
699
|
+
Export_PrimaryInfo(PrimaryInfo *pi, VALUE sp)
|
700
|
+
{
|
701
|
+
VALUE members, m;
|
702
|
+
|
703
|
+
if (CLASS_OF(sp) != Class_Primary)
|
704
|
+
{
|
705
|
+
rb_raise(rb_eTypeError, "type mismatch: %s given",
|
706
|
+
rb_class2name(CLASS_OF(sp)));
|
707
|
+
}
|
708
|
+
members = rb_funcall(sp, rm_ID_values, 0);
|
709
|
+
m = rb_ary_entry(members, 0);
|
710
|
+
pi->x = m == Qnil ? 0.0 : NUM2DBL(m);
|
711
|
+
m = rb_ary_entry(members, 1);
|
712
|
+
pi->y = m == Qnil ? 0.0 : NUM2DBL(m);
|
713
|
+
m = rb_ary_entry(members, 2);
|
714
|
+
pi->z = m == Qnil ? 0.0 : NUM2DBL(m);
|
715
|
+
|
716
|
+
RB_GC_GUARD(members);
|
717
|
+
RB_GC_GUARD(m);
|
718
|
+
}
|
719
|
+
|
720
|
+
|
721
|
+
/**
|
722
|
+
* Create a string representation of a Magick::PrimaryInfo.
|
723
|
+
*
|
724
|
+
* Ruby usage:
|
725
|
+
* - @verbatim Magick::PrimaryInfo#to_s @endverbatim
|
726
|
+
*
|
727
|
+
* @param self this object
|
728
|
+
* @return the string
|
729
|
+
*/
|
730
|
+
VALUE
|
731
|
+
PrimaryInfo_to_s(VALUE self)
|
732
|
+
{
|
733
|
+
PrimaryInfo pi;
|
734
|
+
char buff[100];
|
735
|
+
|
736
|
+
Export_PrimaryInfo(&pi, self);
|
737
|
+
sprintf(buff, "x=%g, y=%g, z=%g", pi.x, pi.y, pi.z);
|
738
|
+
return rb_str_new2(buff);
|
739
|
+
}
|
740
|
+
|
741
|
+
|
742
|
+
/**
|
743
|
+
* Convert a RectangleInfo structure to a Magick::Rectangle.
|
744
|
+
*
|
745
|
+
* No Ruby usage (internal function)
|
746
|
+
*
|
747
|
+
* @param rect the C RectangleInfo structure
|
748
|
+
* @return a Ruby Magick::Rectangle object
|
749
|
+
*/
|
750
|
+
VALUE
|
751
|
+
Import_RectangleInfo(RectangleInfo *rect)
|
752
|
+
{
|
753
|
+
VALUE width;
|
754
|
+
VALUE height;
|
755
|
+
VALUE x, y;
|
756
|
+
|
757
|
+
width = UINT2NUM(rect->width);
|
758
|
+
height = UINT2NUM(rect->height);
|
759
|
+
x = INT2NUM(rect->x);
|
760
|
+
y = INT2NUM(rect->y);
|
761
|
+
|
762
|
+
RB_GC_GUARD(width);
|
763
|
+
RB_GC_GUARD(height);
|
764
|
+
RB_GC_GUARD(x);
|
765
|
+
RB_GC_GUARD(y);
|
766
|
+
|
767
|
+
return rb_funcall(Class_Rectangle, rm_ID_new, 4
|
768
|
+
, width, height, x, y);
|
769
|
+
}
|
770
|
+
|
771
|
+
|
772
|
+
/**
|
773
|
+
* Convert a Magick::Rectangle to a RectangleInfo structure.
|
774
|
+
*
|
775
|
+
* No Ruby usage (internal function)
|
776
|
+
*
|
777
|
+
* @param rect the C RectangleInfo structure to modify
|
778
|
+
* @param sr the Ruby Magick::Rectangle object
|
779
|
+
*/
|
780
|
+
void
|
781
|
+
Export_RectangleInfo(RectangleInfo *rect, VALUE sr)
|
782
|
+
{
|
783
|
+
VALUE members, m;
|
784
|
+
|
785
|
+
if (CLASS_OF(sr) != Class_Rectangle)
|
786
|
+
{
|
787
|
+
rb_raise(rb_eTypeError, "type mismatch: %s given",
|
788
|
+
rb_class2name(CLASS_OF(sr)));
|
789
|
+
}
|
790
|
+
members = rb_funcall(sr, rm_ID_values, 0);
|
791
|
+
m = rb_ary_entry(members, 0);
|
792
|
+
rect->width = m == Qnil ? 0 : NUM2ULONG(m);
|
793
|
+
m = rb_ary_entry(members, 1);
|
794
|
+
rect->height = m == Qnil ? 0 : NUM2ULONG(m);
|
795
|
+
m = rb_ary_entry(members, 2);
|
796
|
+
rect->x = m == Qnil ? 0 : NUM2LONG (m);
|
797
|
+
m = rb_ary_entry(members, 3);
|
798
|
+
rect->y = m == Qnil ? 0 : NUM2LONG (m);
|
799
|
+
|
800
|
+
RB_GC_GUARD(members);
|
801
|
+
RB_GC_GUARD(m);
|
802
|
+
}
|
803
|
+
|
804
|
+
|
805
|
+
/**
|
806
|
+
* Create a string representation of a Magick::Rectangle.
|
807
|
+
*
|
808
|
+
* Ruby usage:
|
809
|
+
* - @verbatim Magick::Rectangle#to_s @endverbatim
|
810
|
+
*
|
811
|
+
* @param self this object
|
812
|
+
* @return the string
|
813
|
+
*/
|
814
|
+
VALUE
|
815
|
+
RectangleInfo_to_s(VALUE self)
|
816
|
+
{
|
817
|
+
RectangleInfo rect;
|
818
|
+
char buff[100];
|
819
|
+
|
820
|
+
Export_RectangleInfo(&rect, self);
|
821
|
+
sprintf(buff, "width=%lu, height=%lu, x=%ld, y=%ld"
|
822
|
+
, rect.width, rect.height, rect.x, rect.y);
|
823
|
+
return rb_str_new2(buff);
|
824
|
+
}
|
825
|
+
|
826
|
+
|
827
|
+
/**
|
828
|
+
* Convert a SegmentInfo structure to a Magick::Segment.
|
829
|
+
*
|
830
|
+
* No Ruby usage (internal function)
|
831
|
+
*
|
832
|
+
* @param segment the C SegmentInfo structure
|
833
|
+
* @return a Ruby Magick::Segment object
|
834
|
+
*/
|
835
|
+
VALUE
|
836
|
+
Import_SegmentInfo(SegmentInfo *segment)
|
837
|
+
{
|
838
|
+
VALUE x1, y1, x2, y2;
|
839
|
+
|
840
|
+
x1 = rb_float_new(segment->x1);
|
841
|
+
y1 = rb_float_new(segment->y1);
|
842
|
+
x2 = rb_float_new(segment->x2);
|
843
|
+
y2 = rb_float_new(segment->y2);
|
844
|
+
|
845
|
+
RB_GC_GUARD(x1);
|
846
|
+
RB_GC_GUARD(y1);
|
847
|
+
RB_GC_GUARD(x2);
|
848
|
+
RB_GC_GUARD(y2);
|
849
|
+
|
850
|
+
return rb_funcall(Class_Segment, rm_ID_new, 4, x1, y1, x2, y2);
|
851
|
+
}
|
852
|
+
|
853
|
+
|
854
|
+
/**
|
855
|
+
* Convert a Magick::Segment to a SegmentInfo structure.
|
856
|
+
*
|
857
|
+
* No Ruby usage (internal function)
|
858
|
+
*
|
859
|
+
* @param segment the C SegmentInfo structure to modify
|
860
|
+
* @param s the Ruby Magick::Segment object
|
861
|
+
*/
|
862
|
+
void
|
863
|
+
Export_SegmentInfo(SegmentInfo *segment, VALUE s)
|
864
|
+
{
|
865
|
+
VALUE members, m;
|
866
|
+
|
867
|
+
if (CLASS_OF(s) != Class_Segment)
|
868
|
+
{
|
869
|
+
rb_raise(rb_eTypeError, "type mismatch: %s given",
|
870
|
+
rb_class2name(CLASS_OF(s)));
|
871
|
+
}
|
872
|
+
|
873
|
+
members = rb_funcall(s, rm_ID_values, 0);
|
874
|
+
m = rb_ary_entry(members, 0);
|
875
|
+
segment->x1 = m == Qnil ? 0.0 : NUM2DBL(m);
|
876
|
+
m = rb_ary_entry(members, 1);
|
877
|
+
segment->y1 = m == Qnil ? 0.0 : NUM2DBL(m);
|
878
|
+
m = rb_ary_entry(members, 2);
|
879
|
+
segment->x2 = m == Qnil ? 0.0 : NUM2DBL(m);
|
880
|
+
m = rb_ary_entry(members, 3);
|
881
|
+
segment->y2 = m == Qnil ? 0.0 : NUM2DBL(m);
|
882
|
+
|
883
|
+
RB_GC_GUARD(members);
|
884
|
+
RB_GC_GUARD(m);
|
885
|
+
}
|
886
|
+
|
887
|
+
|
888
|
+
/**
|
889
|
+
* Create a string representation of a Magick::Segment.
|
890
|
+
*
|
891
|
+
* Ruby usage:
|
892
|
+
* - @verbatim Magick::SegmentInfo#to_s @endverbatim
|
893
|
+
*
|
894
|
+
* @param self this object
|
895
|
+
* @return the string
|
896
|
+
*/
|
897
|
+
VALUE
|
898
|
+
SegmentInfo_to_s(VALUE self)
|
899
|
+
{
|
900
|
+
SegmentInfo segment;
|
901
|
+
char buff[100];
|
902
|
+
|
903
|
+
Export_SegmentInfo(&segment, self);
|
904
|
+
sprintf(buff, "x1=%g, y1=%g, x2=%g, y2=%g"
|
905
|
+
, segment.x1, segment.y1, segment.x2, segment.y2);
|
906
|
+
return rb_str_new2(buff);
|
907
|
+
}
|
908
|
+
|
909
|
+
|
910
|
+
/**
|
911
|
+
* Return the string representation of a StretchType value.
|
912
|
+
*
|
913
|
+
* No Ruby usage (internal function)
|
914
|
+
*
|
915
|
+
* @param stretch the StretchType value
|
916
|
+
* @return the string
|
917
|
+
*/
|
918
|
+
static const char *
|
919
|
+
StretchType_name(StretchType stretch)
|
920
|
+
{
|
921
|
+
switch (stretch)
|
922
|
+
{
|
923
|
+
ENUM_TO_NAME(UndefinedStretch)
|
924
|
+
ENUM_TO_NAME(NormalStretch)
|
925
|
+
ENUM_TO_NAME(UltraCondensedStretch)
|
926
|
+
ENUM_TO_NAME(ExtraCondensedStretch)
|
927
|
+
ENUM_TO_NAME(CondensedStretch)
|
928
|
+
ENUM_TO_NAME(SemiCondensedStretch)
|
929
|
+
ENUM_TO_NAME(SemiExpandedStretch)
|
930
|
+
ENUM_TO_NAME(ExpandedStretch)
|
931
|
+
ENUM_TO_NAME(ExtraExpandedStretch)
|
932
|
+
ENUM_TO_NAME(UltraExpandedStretch)
|
933
|
+
ENUM_TO_NAME(AnyStretch)
|
934
|
+
}
|
935
|
+
|
936
|
+
return "UndefinedStretch";
|
937
|
+
}
|
938
|
+
|
939
|
+
|
940
|
+
/**
|
941
|
+
* Construct a StretchType enum for a specified StretchType value.
|
942
|
+
*
|
943
|
+
* No Ruby usage (internal function)
|
944
|
+
*
|
945
|
+
* @param stretch the C StretchType value
|
946
|
+
* @return a Ruby StretchType enum
|
947
|
+
*/
|
948
|
+
static VALUE
|
949
|
+
StretchType_new(StretchType stretch)
|
950
|
+
{
|
951
|
+
const char *name = StretchType_name(stretch);
|
952
|
+
return rm_enum_new(Class_StretchType, ID2SYM(rb_intern(name)), INT2FIX(stretch));
|
953
|
+
}
|
954
|
+
|
955
|
+
|
956
|
+
/**
|
957
|
+
* Return the string representation of a StyleType value.
|
958
|
+
*
|
959
|
+
* No Ruby usage (internal function)
|
960
|
+
*
|
961
|
+
* @param style the StyleType value
|
962
|
+
* @return the string
|
963
|
+
*/
|
964
|
+
static const char *
|
965
|
+
StyleType_name(StyleType style)
|
966
|
+
{
|
967
|
+
switch (style)
|
968
|
+
{
|
969
|
+
ENUM_TO_NAME(UndefinedStyle)
|
970
|
+
ENUM_TO_NAME(NormalStyle)
|
971
|
+
ENUM_TO_NAME(ItalicStyle)
|
972
|
+
ENUM_TO_NAME(ObliqueStyle)
|
973
|
+
ENUM_TO_NAME(AnyStyle)
|
974
|
+
}
|
975
|
+
|
976
|
+
return "UndefinedStyle";
|
977
|
+
}
|
978
|
+
|
979
|
+
|
980
|
+
/**
|
981
|
+
* Construct a StyleType enum for a specified StyleType value.
|
982
|
+
*
|
983
|
+
* No Ruby usage (internal function)
|
984
|
+
*
|
985
|
+
* @param style the C StyleType value
|
986
|
+
* @return a Ruby StyleType enum
|
987
|
+
*/
|
988
|
+
static VALUE
|
989
|
+
StyleType_new(StyleType style)
|
990
|
+
{
|
991
|
+
const char *name = StyleType_name(style);
|
992
|
+
return rm_enum_new(Class_StyleType, ID2SYM(rb_intern(name)), INT2FIX(style));
|
993
|
+
}
|
994
|
+
|
995
|
+
|
996
|
+
/**
|
997
|
+
* Convert a TypeMetric structure to a Magick::TypeMetric.
|
998
|
+
*
|
999
|
+
* No Ruby usage (internal function)
|
1000
|
+
*
|
1001
|
+
* @param tm the C TypeMetric structure
|
1002
|
+
* @return a Ruby Magick::TypeMetric object
|
1003
|
+
*/
|
1004
|
+
VALUE
|
1005
|
+
Import_TypeMetric(TypeMetric *tm)
|
1006
|
+
{
|
1007
|
+
VALUE pixels_per_em;
|
1008
|
+
VALUE ascent, descent;
|
1009
|
+
VALUE width, height, max_advance;
|
1010
|
+
VALUE bounds, underline_position, underline_thickness;
|
1011
|
+
|
1012
|
+
pixels_per_em = Import_PointInfo(&tm->pixels_per_em);
|
1013
|
+
ascent = rb_float_new(tm->ascent);
|
1014
|
+
descent = rb_float_new(tm->descent);
|
1015
|
+
width = rb_float_new(tm->width);
|
1016
|
+
height = rb_float_new(tm->height);
|
1017
|
+
max_advance = rb_float_new(tm->max_advance);
|
1018
|
+
bounds = Import_SegmentInfo(&tm->bounds);
|
1019
|
+
underline_position = rb_float_new(tm->underline_position);
|
1020
|
+
underline_thickness = rb_float_new(tm->underline_position);
|
1021
|
+
|
1022
|
+
RB_GC_GUARD(pixels_per_em);
|
1023
|
+
RB_GC_GUARD(ascent);
|
1024
|
+
RB_GC_GUARD(descent);
|
1025
|
+
RB_GC_GUARD(width);
|
1026
|
+
RB_GC_GUARD(height);
|
1027
|
+
RB_GC_GUARD(max_advance);
|
1028
|
+
RB_GC_GUARD(bounds);
|
1029
|
+
RB_GC_GUARD(underline_position);
|
1030
|
+
RB_GC_GUARD(underline_thickness);
|
1031
|
+
|
1032
|
+
return rb_funcall(Class_TypeMetric, rm_ID_new, 9
|
1033
|
+
, pixels_per_em, ascent, descent, width
|
1034
|
+
, height, max_advance, bounds
|
1035
|
+
, underline_position, underline_thickness);
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
|
1039
|
+
/**
|
1040
|
+
* Convert a Magick::TypeMetric to a TypeMetric structure.
|
1041
|
+
*
|
1042
|
+
* No Ruby usage (internal function)
|
1043
|
+
*
|
1044
|
+
* @param tm the C TypeMetric structure to modify
|
1045
|
+
* @param st the Ruby Magick::TypeMetric object
|
1046
|
+
*/
|
1047
|
+
void
|
1048
|
+
Export_TypeMetric(TypeMetric *tm, VALUE st)
|
1049
|
+
{
|
1050
|
+
VALUE members, m;
|
1051
|
+
VALUE pixels_per_em;
|
1052
|
+
|
1053
|
+
if (CLASS_OF(st) != Class_TypeMetric)
|
1054
|
+
{
|
1055
|
+
rb_raise(rb_eTypeError, "type mismatch: %s given",
|
1056
|
+
rb_class2name(CLASS_OF(st)));
|
1057
|
+
}
|
1058
|
+
members = rb_funcall(st, rm_ID_values, 0);
|
1059
|
+
|
1060
|
+
pixels_per_em = rb_ary_entry(members, 0);
|
1061
|
+
Export_PointInfo(&tm->pixels_per_em, pixels_per_em);
|
1062
|
+
|
1063
|
+
m = rb_ary_entry(members, 1);
|
1064
|
+
tm->ascent = m == Qnil ? 0.0 : NUM2DBL(m);
|
1065
|
+
m = rb_ary_entry(members, 2);
|
1066
|
+
tm->descent = m == Qnil ? 0.0 : NUM2DBL(m);
|
1067
|
+
m = rb_ary_entry(members, 3);
|
1068
|
+
tm->width = m == Qnil ? 0.0 : NUM2DBL(m);
|
1069
|
+
m = rb_ary_entry(members, 4);
|
1070
|
+
tm->height = m == Qnil ? 0.0 : NUM2DBL(m);
|
1071
|
+
m = rb_ary_entry(members, 5);
|
1072
|
+
tm->max_advance = m == Qnil ? 0.0 : NUM2DBL(m);
|
1073
|
+
|
1074
|
+
m = rb_ary_entry(members, 6);
|
1075
|
+
Export_SegmentInfo(&tm->bounds, m);
|
1076
|
+
|
1077
|
+
m = rb_ary_entry(members, 7);
|
1078
|
+
tm->underline_position = m == Qnil ? 0.0 : NUM2DBL(m);
|
1079
|
+
m = rb_ary_entry(members, 8);
|
1080
|
+
tm->underline_thickness = m == Qnil ? 0.0 : NUM2DBL(m);
|
1081
|
+
|
1082
|
+
RB_GC_GUARD(members);
|
1083
|
+
RB_GC_GUARD(m);
|
1084
|
+
RB_GC_GUARD(pixels_per_em);
|
1085
|
+
}
|
1086
|
+
|
1087
|
+
|
1088
|
+
/**
|
1089
|
+
* Create a string representation of a Magick::TypeMetric.
|
1090
|
+
*
|
1091
|
+
* Ruby usage:
|
1092
|
+
* - @verbatim Magick::TypeMetric#to_s @endverbatim
|
1093
|
+
*
|
1094
|
+
* @param self this object
|
1095
|
+
* @return the string
|
1096
|
+
*/
|
1097
|
+
VALUE
|
1098
|
+
TypeMetric_to_s(VALUE self)
|
1099
|
+
{
|
1100
|
+
VALUE str;
|
1101
|
+
TypeMetric tm;
|
1102
|
+
char temp[200];
|
1103
|
+
int len;
|
1104
|
+
|
1105
|
+
Export_TypeMetric(&tm, self);
|
1106
|
+
|
1107
|
+
len = sprintf(temp, "pixels_per_em=(x=%g,y=%g) ", tm.pixels_per_em.x, tm.pixels_per_em.y);
|
1108
|
+
str = rb_str_new(temp, len);
|
1109
|
+
len = sprintf(temp, "ascent=%g descent=%g ",tm.ascent, tm.descent);
|
1110
|
+
rb_str_cat(str, temp, len);
|
1111
|
+
len = sprintf(temp, "width=%g height=%g max_advance=%g ", tm.width, tm.height, tm.max_advance);
|
1112
|
+
rb_str_cat(str, temp, len);
|
1113
|
+
len = sprintf(temp, "bounds.x1=%g bounds.y1=%g ", tm.bounds.x1, tm.bounds.y1);
|
1114
|
+
rb_str_cat(str, temp, len);
|
1115
|
+
len = sprintf(temp, "bounds.x2=%g bounds.y2=%g ", tm.bounds.x2, tm.bounds.y2);
|
1116
|
+
rb_str_cat(str, temp, len);
|
1117
|
+
len = sprintf(temp, "underline_position=%g underline_thickness=%g", tm.underline_position, tm.underline_thickness);
|
1118
|
+
rb_str_cat(str, temp, len);
|
1119
|
+
|
1120
|
+
RB_GC_GUARD(str);
|
1121
|
+
|
1122
|
+
return str;
|
1123
|
+
}
|
1124
|
+
|