rmagick 1.14.1 → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rmagick might be problematic. Click here for more details.

Files changed (66) hide show
  1. data/ChangeLog +22 -0
  2. data/README.html +11 -63
  3. data/README.txt +8 -56
  4. data/configure +214 -787
  5. data/configure.ac +22 -24
  6. data/doc/comtasks.html +2 -2
  7. data/doc/constants.html +5 -6
  8. data/doc/draw.html +33 -14
  9. data/doc/ex/clip_path.rb +3 -0
  10. data/doc/ex/path.rb +1 -1
  11. data/doc/ex/polaroid.rb +23 -0
  12. data/doc/ex/tspan01.rb +2 -2
  13. data/doc/ex/tspan02.rb +2 -2
  14. data/doc/ex/tspan03.rb +3 -3
  15. data/doc/ex/wet_floor.rb +54 -0
  16. data/doc/ilist.html +83 -4
  17. data/doc/image1.html +4 -5
  18. data/doc/image2.html +395 -266
  19. data/doc/image3.html +104 -8
  20. data/doc/imageattrs.html +2 -2
  21. data/doc/imusage.html +2 -2
  22. data/doc/index.html +22 -18
  23. data/doc/info.html +28 -6
  24. data/doc/magick.html +125 -4
  25. data/doc/optequiv.html +196 -21
  26. data/doc/rvg.html +2 -2
  27. data/doc/rvgclip.html +2 -2
  28. data/doc/rvggroup.html +2 -2
  29. data/doc/rvgimage.html +2 -2
  30. data/doc/rvgpattern.html +2 -2
  31. data/doc/rvgshape.html +2 -2
  32. data/doc/rvgstyle.html +2 -2
  33. data/doc/rvgtext.html +2 -2
  34. data/doc/rvgtspan.html +2 -2
  35. data/doc/rvgtut.html +3 -3
  36. data/doc/rvguse.html +2 -2
  37. data/doc/rvgxform.html +2 -2
  38. data/doc/struct.html +2 -2
  39. data/doc/usage.html +26 -5
  40. data/ext/RMagick/MANIFEST +3 -1
  41. data/ext/RMagick/rmagick.h +46 -12
  42. data/ext/RMagick/rmagick_config.h.in +12 -2
  43. data/ext/RMagick/rmdraw.c +202 -62
  44. data/ext/RMagick/rmfill.c +36 -36
  45. data/ext/RMagick/rmilist.c +75 -31
  46. data/ext/RMagick/rmimage.c +640 -323
  47. data/ext/RMagick/rminfo.c +76 -15
  48. data/ext/RMagick/rmmain.c +107 -30
  49. data/ext/RMagick/rmutil.c +97 -68
  50. data/lib/RMagick.rb +11 -11
  51. data/lib/rvg/clippath.rb +38 -36
  52. data/lib/rvg/container.rb +120 -118
  53. data/lib/rvg/deep_equal.rb +44 -42
  54. data/lib/rvg/describable.rb +49 -47
  55. data/lib/rvg/embellishable.rb +399 -397
  56. data/lib/rvg/misc.rb +613 -603
  57. data/lib/rvg/paint.rb +38 -36
  58. data/lib/rvg/pathdata.rb +124 -122
  59. data/lib/rvg/rvg.rb +202 -198
  60. data/lib/rvg/stretchable.rb +132 -130
  61. data/lib/rvg/stylable.rb +101 -99
  62. data/lib/rvg/text.rb +173 -171
  63. data/lib/rvg/transformable.rb +120 -118
  64. data/lib/rvg/units.rb +60 -58
  65. data/rmagick.gemspec +1 -1
  66. metadata +5 -3
@@ -39,8 +39,6 @@
39
39
  #undef HAVE_CONTRASTSTRETCHIMAGECHANNEL
40
40
  /* Introduced in IM 6.0.1 */
41
41
  #undef HAVE_CONVOLVEIMAGECHANNEL
42
- /* Introduced in IM 5.5.7, GM 1.1 */
43
- #undef HAVE_COPYCYANCOMPOSITEOP
44
42
  /* Introduced in IM 6.0.0 */
45
43
  #undef HAVE_DSTCOMPOSITEOP
46
44
  /* Introduced in IM 6.0.1 */
@@ -55,6 +53,8 @@
55
53
  #undef HAVE_EXTENDEDUNSIGNEDINTEGRALTYPE
56
54
  /* Introduced in IM 5.5.5 - Not defined in GraphicsMagick */
57
55
  #undef HAVE_FUZZYCOLORCOMPARE
56
+ /* Introduced in IM 6.2.0 */
57
+ #undef HAVE_FXIMAGECHANNEL
58
58
  /* Introduced in IM 6.0.0, GM 1.1 */
59
59
  #undef HAVE_GAMMAIMAGECHANNEL
60
60
  /* Introduced in IM 6.0.1 */
@@ -147,6 +147,8 @@
147
147
  #undef HAVE_JPEG2000COMPRESSION
148
148
  /* Introduced in GM 1.2 */
149
149
  #undef HAVE_LABCOLORSPACE
150
+ /* Introduced in IM 6.3.1 */
151
+ #undef HAVE_LINEARSTRETCHIMAGE
150
152
  /* Introduced in IM 6.2.3 */
151
153
  #undef HAVE_LOGCOLORSPACE
152
154
  /* Introduced in IM 6.0.2 */
@@ -169,8 +171,14 @@
169
171
  #undef HAVE_NEW_COLORINFO
170
172
  /* Introduced in IM 6.1.0 */
171
173
  #undef HAVE_NORMALIZEIMAGECHANNEL
174
+ /* Introduced in IM 6.3.0 */
175
+ #undef HAVE_ORDEREDPOSTERIZEIMAGECHANNEL
176
+ /* Introduced in IM 6.2.9 */
177
+ #undef HAVE_PALETTEBILEVELMATTETYPE
172
178
  /* Introduced in IM 5.5.4 - Not available in GM */
173
179
  #undef HAVE_PARSESIZEGEOMETRY
180
+ /* Introduced in IM 6.3.1-6 */
181
+ #undef HAVE_POLAROIDIMAGE
174
182
  /* Introduced in IM 6.0.0 */
175
183
  #undef HAVE_POSTERIZEIMAGE
176
184
  /* Introduced in IM 5.5.1? Not available in GM */
@@ -189,6 +197,8 @@
189
197
  #undef HAVE_REC601YCBCRCOLORSPACE
190
198
  #undef HAVE_REC709LUMACOLORSPACE
191
199
  #undef HAVE_REC709YCBCRCOLORSPACE
200
+ /* Introduced in IM 6.3.1-3 */
201
+ #undef HAVE_RECOLORIMAGE
192
202
  /* Introduced in IM 6.2.1 */
193
203
  #undef HAVE_NEW_REMOVEIMAGEPROFILE
194
204
  #undef HAVE_REPLACECOMPOSITEOP
@@ -1,6 +1,6 @@
1
- /* $Id: rmdraw.c,v 1.34 2006/09/01 19:19:20 rmagick Exp $ */
1
+ /* $Id: rmdraw.c,v 1.43 2007/01/20 17:40:41 rmagick Exp $ */
2
2
  /*============================================================================\
3
- | Copyright (C) 2006 by Timothy P. Hunter
3
+ | Copyright (C) 2007 by Timothy P. Hunter
4
4
  | Name: rmdraw.c
5
5
  | Author: Tim Hunter
6
6
  | Purpose: Contains Draw class methods.
@@ -13,9 +13,10 @@
13
13
  static void mark_Draw(void *);
14
14
  static void destroy_Draw(void *);
15
15
  static void destroy_Montage(void *);
16
+ static VALUE new_DrawOptions(void);
16
17
 
17
18
  typedef MagickBooleanType (get_type_metrics_func_t)(Image *, const DrawInfo *, TypeMetric *);
18
- static VALUE get_type_metrics(int, VALUE *, VALUE, get_type_metrics_func_t *);
19
+ static VALUE get_type_metrics(int, VALUE *, VALUE, get_type_metrics_func_t);
19
20
 
20
21
 
21
22
  /*
@@ -48,21 +49,6 @@ Draw_align_eq(VALUE self, VALUE align)
48
49
  return self;
49
50
  }
50
51
 
51
- /*
52
- Method: Draw#border_color=
53
- Purpose: border_color attribute writer
54
- */
55
- VALUE
56
- Draw_border_color_eq(VALUE self, VALUE border_color)
57
- {
58
- Draw *draw;
59
-
60
- rm_check_frozen(self);
61
- Data_Get_Struct(self, Draw, draw);
62
- Color_to_PixelPacket(&draw->info->border_color, border_color);
63
- return self;
64
- }
65
-
66
52
  /*
67
53
  Method: Draw#decorate=
68
54
  Purpose: decorate attribute writer
@@ -369,7 +355,7 @@ Draw_text_antialias_eq(VALUE self, VALUE text_antialias)
369
355
 
370
356
  rm_check_frozen(self);
371
357
  Data_Get_Struct(self, Draw, draw);
372
- draw->info->text_antialias = RTEST(text_antialias);
358
+ draw->info->text_antialias = (MagickBooleanType) RTEST(text_antialias);
373
359
  return self;
374
360
  }
375
361
 
@@ -388,7 +374,7 @@ Draw_tile_eq(VALUE self, VALUE image)
388
374
 
389
375
  if (draw->info->fill_pattern)
390
376
  {
391
- DestroyImage(draw->info->fill_pattern);
377
+ (void) DestroyImage(draw->info->fill_pattern);
392
378
  draw->info->fill_pattern = NULL;
393
379
  }
394
380
 
@@ -753,46 +739,23 @@ VALUE Draw_init_copy(VALUE self, VALUE orig)
753
739
  return self;
754
740
  }
755
741
 
742
+
756
743
  /*
757
744
  Method: Draw#initialize <{ info initializers }>
758
745
  Purpose: Initialize Draw object
759
- Notes: Here are the DrawInfo fields that are copied from Info.
760
- These are the only Info fields that can be usefully
761
- set in the initializer block.
762
-
763
- DrawInfo Info
764
- -------- ---------
765
- stroke_antialias antialias
766
- font font
767
- density density
768
- text_antialias antialias
769
- pointsize pointsize
770
- border_color border_color
771
- server_name server_name
772
- debug debug
773
746
  */
774
747
  VALUE
775
748
  Draw_initialize(VALUE self)
776
749
  {
777
- Draw *draw;
778
- Info *info;
779
- volatile VALUE info_obj;
750
+ Draw *draw, *draw_options;
751
+ volatile VALUE options;
780
752
 
781
753
  Data_Get_Struct(self, Draw, draw);
782
754
 
783
- // Create a new Info object, running the info parms block in the process
784
- info_obj = rm_info_new();
785
-
786
- // Use the Info structure to create the DrawInfo structure
787
- Data_Get_Struct(info_obj, Info, info);
788
- draw->info = CloneDrawInfo(info, NULL);
789
- if (!draw->info)
790
- {
791
- rb_raise(rb_eNoMemError, "not enough memory to continue");
792
- }
793
-
794
- draw->primitives = (VALUE)0;
795
- draw->tmpfile_ary = NULL;
755
+ options = new_DrawOptions();
756
+ Data_Get_Struct(options, Draw, draw_options);
757
+ draw->info = draw_options->info;
758
+ draw_options->info = NULL;
796
759
 
797
760
  return self;
798
761
  }
@@ -815,11 +778,11 @@ Draw_inspect(VALUE self)
815
778
  Purpose: Create a new Draw object
816
779
  Raises: ImageMagickError if no memory
817
780
  */
818
- VALUE
781
+
819
782
  #if defined(HAVE_RB_DEFINE_ALLOC_FUNC)
820
- Draw_alloc(VALUE class)
783
+ VALUE Draw_alloc(VALUE class)
821
784
  #else
822
- Draw_new(VALUE class)
785
+ VALUE Draw_new(VALUE class)
823
786
  #endif
824
787
  {
825
788
  Draw *draw;
@@ -887,7 +850,10 @@ destroy_Draw(void *drawptr)
887
850
  Draw *draw = (Draw *)drawptr;
888
851
  struct TmpFile_Name *tmpfile;
889
852
 
890
- DestroyDrawInfo(draw->info);
853
+ if (draw->info)
854
+ {
855
+ (void) DestroyDrawInfo(draw->info);
856
+ }
891
857
 
892
858
  // Erase any temporary image files.
893
859
  while (draw->tmpfile_ary)
@@ -901,6 +867,76 @@ destroy_Draw(void *drawptr)
901
867
  xfree(drawptr);
902
868
  }
903
869
 
870
+
871
+ /*
872
+ Static: new_DrawOptions
873
+ Purpose: Allocate & initialize a DrawOptions object.
874
+ */
875
+ static VALUE new_DrawOptions(void)
876
+ {
877
+ #if defined(HAVE_RB_DEFINE_ALLOC_FUNC)
878
+ return DrawOptions_initialize(Draw_alloc(Class_DrawOptions));
879
+ #else
880
+ return DrawOptions_new(Class_DrawOptions);
881
+ #endif
882
+ }
883
+
884
+
885
+ /*
886
+ Method: DrawOptions#allocate
887
+ DarwOptions#new
888
+ Purpose: Create a DrawOptions object
889
+ Notes: The DrawOptions class is the same as the Draw class except
890
+ is has only the attribute writer functions.
891
+ */
892
+ #if defined(HAVE_RB_DEFINE_ALLOC_FUNC)
893
+ VALUE DrawOptions_alloc(VALUE class)
894
+ #else
895
+ VALUE DrawOptions_new(VALUE class)
896
+ #endif
897
+ {
898
+ Draw *draw_options;
899
+ volatile VALUE draw_options_obj;
900
+
901
+ draw_options = ALLOC(Draw);
902
+ memset(draw_options, 0, sizeof(Draw));
903
+ draw_options_obj = Data_Wrap_Struct(class, mark_Draw, destroy_Draw, draw_options);
904
+
905
+ #if !defined(HAVE_RB_DEFINE_ALLOC_FUNC)
906
+ rb_obj_call_init(draw_options_obj, 0, NULL);
907
+ #endif
908
+
909
+ return draw_options_obj;
910
+ }
911
+
912
+
913
+ /*
914
+ Method: DrawOptions#initialize
915
+ Purpose: Initialize a DrawOptions object
916
+ */
917
+ VALUE DrawOptions_initialize(VALUE self)
918
+ {
919
+ Draw *draw_options;
920
+
921
+ Data_Get_Struct(self, Draw, draw_options);
922
+ draw_options->info = magick_malloc(sizeof(DrawInfo));
923
+ if (!draw_options->info)
924
+ {
925
+ rb_raise(rb_eNoMemError, "not enough memory to continue");
926
+ }
927
+
928
+ GetDrawInfo(NULL, draw_options->info);
929
+
930
+ if (rb_block_given_p())
931
+ {
932
+ // Run the block in self's context
933
+ (void) rb_obj_instance_eval(0, NULL, self);
934
+ }
935
+
936
+ return self;
937
+ }
938
+
939
+
904
940
  /*
905
941
  Method: Magick::Montage#background_color(color-name)
906
942
  Purpose: set background_color value
@@ -1100,7 +1136,7 @@ Montage_new(VALUE class)
1100
1136
  }
1101
1137
 
1102
1138
  montage_info = CloneMontageInfo(image_info, NULL);
1103
- DestroyImageInfo(image_info);
1139
+ (void) (void) DestroyImageInfo(image_info);
1104
1140
 
1105
1141
  if (!montage_info)
1106
1142
  {
@@ -1113,7 +1149,7 @@ Montage_new(VALUE class)
1113
1149
  montage_obj = Data_Wrap_Struct(class, NULL, destroy_Montage, montage);
1114
1150
 
1115
1151
  #if !defined(HAVE_RB_DEFINE_ALLOC_FUNC)
1116
- rb_obj_call_init(montage_obj, 0, NULL);
1152
+ (void) rb_obj_call_init(montage_obj, 0, NULL);
1117
1153
  #endif
1118
1154
 
1119
1155
  return montage_obj;
@@ -1145,11 +1181,14 @@ destroy_Montage(void *obj)
1145
1181
  Montage *montage = obj;
1146
1182
 
1147
1183
  // If we saved a temporary texture image, delete it now.
1148
- if (montage->info->texture != NULL)
1184
+ if (montage->info && montage->info->texture != NULL)
1149
1185
  {
1150
1186
  rm_delete_temp_image(montage->info->texture);
1151
1187
  }
1152
- DestroyMontageInfo(montage->info);
1188
+ if (montage->info)
1189
+ {
1190
+ (void) DestroyMontageInfo(montage->info);
1191
+ }
1153
1192
  xfree(montage);
1154
1193
  }
1155
1194
 
@@ -1177,7 +1216,7 @@ Montage_shadow_eq(VALUE self, VALUE shadow)
1177
1216
  Montage *montage;
1178
1217
 
1179
1218
  Data_Get_Struct(self, Montage, montage);
1180
- montage->info->shadow = RTEST(shadow);
1219
+ montage->info->shadow = (MagickBooleanType) RTEST(shadow);
1181
1220
  return self;
1182
1221
  }
1183
1222
 
@@ -1257,6 +1296,107 @@ Montage_title_eq(VALUE self, VALUE title)
1257
1296
  }
1258
1297
 
1259
1298
 
1299
+ /*
1300
+ Extern: PolaroidOptions_alloc()
1301
+ Purpose: Allocate a new Magick::PolaroidOptions object
1302
+ Notes: Internally a PolaroidOptions object is the same as a Draw
1303
+ object. The methods are implemented by Draw methods in
1304
+ rmdraw.c.
1305
+ */
1306
+ VALUE
1307
+ PolaroidOptions_alloc(VALUE class)
1308
+ {
1309
+ volatile VALUE polaroid_obj;
1310
+ ImageInfo *image_info;
1311
+ Draw *draw;
1312
+
1313
+ image_info = CloneImageInfo(NULL);
1314
+
1315
+ draw = ALLOC(Draw);
1316
+ memset(draw, 0, sizeof(*draw));
1317
+
1318
+ draw->info=CloneDrawInfo(image_info,(DrawInfo *) NULL);
1319
+ (void)(void) DestroyImageInfo(image_info);
1320
+
1321
+ polaroid_obj = Data_Wrap_Struct(class, NULL, destroy_Draw, draw);
1322
+
1323
+ return polaroid_obj;
1324
+ }
1325
+
1326
+
1327
+ /*
1328
+ Method: PolaroidOptions.new
1329
+ Purpose: Ruby 1.6 singleton function to allocate and init a PolaroidOptions
1330
+ object
1331
+ */
1332
+ #if !defined(HAVE_RB_DEFINE_ALLOC_FUNC)
1333
+ VALUE PolaroidOptions_new(VALUE class)
1334
+ {
1335
+ volatile VALUE polaroid_obj;
1336
+
1337
+ polaroid_obj = PolaroidOptions_alloc(class);
1338
+ rb_obj_call_init(polaroid_obj, 0, NULL);
1339
+
1340
+ return polaroid_obj;
1341
+ }
1342
+ #endif
1343
+
1344
+
1345
+ /*
1346
+ Method: Magick::PolaroidOptions#initialize
1347
+ Purpose: Yield to an optional block
1348
+ */
1349
+ VALUE
1350
+ PolaroidOptions_initialize(VALUE self)
1351
+ {
1352
+ Draw *draw;
1353
+ ExceptionInfo exception;
1354
+
1355
+ // Default shadow color
1356
+ Data_Get_Struct(self, Draw, draw);
1357
+
1358
+ GetExceptionInfo(&exception);
1359
+ (void) QueryColorDatabase("gray75", &draw->shadow_color, &exception);
1360
+ CHECK_EXCEPTION()
1361
+
1362
+ if (rb_block_given_p())
1363
+ {
1364
+ // Run the block in self's context
1365
+ (void) rb_obj_instance_eval(0, NULL, self);
1366
+ }
1367
+ return self;
1368
+ }
1369
+
1370
+
1371
+ /*
1372
+ Extern: rm_polaroid_new
1373
+ Purpose: allocate a PolaroidOptions instance
1374
+ Notes: Internal use
1375
+ */
1376
+ VALUE rm_polaroid_new(void)
1377
+ {
1378
+ #if defined(HAVE_RB_DEFINE_ALLOC_FUNC)
1379
+ return PolaroidOptions_initialize(PolaroidOptions_alloc(Class_PolaroidOptions));
1380
+ #else
1381
+ return PolaroidOptions_new(Class_PolaroidOptions);
1382
+ #endif
1383
+ }
1384
+
1385
+
1386
+ /*
1387
+ Method: PolaroidOptions#shadow_color=
1388
+ Purpose: Set the shadow color attribute
1389
+ */
1390
+ VALUE PolaroidOptions_shadow_color_eq(VALUE self, VALUE shadow)
1391
+ {
1392
+ Draw *draw;
1393
+
1394
+ Data_Get_Struct(self, Draw, draw);
1395
+ Color_to_PixelPacket(&draw->shadow_color, shadow);
1396
+ return self;
1397
+ }
1398
+
1399
+
1260
1400
  static VALUE get_dummy_tm_img(VALUE klass)
1261
1401
  {
1262
1402
  volatile VALUE dummy_img = 0;
@@ -1276,7 +1416,7 @@ static VALUE get_dummy_tm_img(VALUE klass)
1276
1416
  {
1277
1417
  rb_raise(rb_eNoMemError, "not enough memory to continue");
1278
1418
  }
1279
- DestroyImageInfo(info);
1419
+ (void) DestroyImageInfo(info);
1280
1420
  dummy_img = rm_image_new(image);
1281
1421
 
1282
1422
  RUBY18(rb_cvar_set(klass, ID__dummy_img_, dummy_img, 0));
@@ -1298,10 +1438,10 @@ get_type_metrics(
1298
1438
  int argc,
1299
1439
  VALUE *argv,
1300
1440
  VALUE self,
1301
- get_type_metrics_func_t *getter)
1441
+ get_type_metrics_func_t getter)
1302
1442
  {
1303
1443
  static char attrs[] = "OPbcdefghiklmnopqrstuwxyz[@#%";
1304
- #define ATTRS_L (sizeof(attrs)-1)
1444
+ #define ATTRS_L ((int)(sizeof(attrs)-1))
1305
1445
  Image *image;
1306
1446
  Draw *draw;
1307
1447
  TypeMetric metrics;
@@ -1,6 +1,6 @@
1
- /* $Id: rmfill.c,v 1.15 2006/06/28 23:06:15 rmagick Exp $ */
1
+ /* $Id: rmfill.c,v 1.17 2007/01/12 00:11:16 rmagick Exp $ */
2
2
  /*============================================================================\
3
- | Copyright (C) 2006 by Timothy P. Hunter
3
+ | Copyright (C) 2007 by Timothy P. Hunter
4
4
  | Name: rmfill.c
5
5
  | Author: Tim Hunter
6
6
  | Purpose: GradientFill, TextureFill class definitions for RMagick
@@ -116,7 +116,7 @@ point_fill(
116
116
  PixelPacket *stop_color)
117
117
  {
118
118
  double steps, distance;
119
- long x, y;
119
+ unsigned long x, y;
120
120
  double red_step, green_step, blue_step;
121
121
 
122
122
  steps = sqrt((double)((image->columns-x0)*(image->columns-x0)
@@ -129,16 +129,16 @@ point_fill(
129
129
  {
130
130
  PixelPacket *row_pixels;
131
131
 
132
- if (!(row_pixels = SetImagePixels(image, 0, y, image->columns, 1)))
132
+ if (!(row_pixels = SetImagePixels(image, 0, (long int)y, image->columns, 1)))
133
133
  {
134
134
  rm_check_image_exception(image, RetainOnError);
135
135
  }
136
136
  for (x = 0; x < image->columns; x++)
137
137
  {
138
138
  distance = sqrt((double)((x-x0)*(x-x0)+(y-y0)*(y-y0)));
139
- row_pixels[x].red = start_color->red + (distance * red_step);
140
- row_pixels[x].green = start_color->green + (distance * green_step);
141
- row_pixels[x].blue = start_color->blue + (distance * blue_step);
139
+ row_pixels[x].red = RoundToQuantum(start_color->red + (distance * red_step));
140
+ row_pixels[x].green = RoundToQuantum(start_color->green + (distance * green_step));
141
+ row_pixels[x].blue = RoundToQuantum(start_color->blue + (distance * blue_step));
142
142
  row_pixels[x].opacity = OpaqueOpacity;
143
143
  }
144
144
  if (!SyncImagePixels(image))
@@ -161,7 +161,7 @@ vertical_fill(
161
161
  PixelPacket *stop_color)
162
162
  {
163
163
  double steps;
164
- long x, y;
164
+ unsigned long x, y;
165
165
  volatile PixelPacket *master;
166
166
  double red_step, green_step, blue_step;
167
167
 
@@ -196,9 +196,9 @@ vertical_fill(
196
196
  for (x = 0; x < image->columns; x++)
197
197
  {
198
198
  double distance = fabs(x1 - x);
199
- master[x].red = start_color->red + (red_step * distance);
200
- master[x].green = start_color->green + (green_step * distance);
201
- master[x].blue = start_color->blue + (blue_step * distance);
199
+ master[x].red = RoundToQuantum(start_color->red + (red_step * distance));
200
+ master[x].green = RoundToQuantum(start_color->green + (green_step * distance));
201
+ master[x].blue = RoundToQuantum(start_color->blue + (blue_step * distance));
202
202
  master[x].opacity = OpaqueOpacity;
203
203
  }
204
204
 
@@ -207,7 +207,7 @@ vertical_fill(
207
207
  {
208
208
  PixelPacket *row_pixels;
209
209
 
210
- if (!(row_pixels = SetImagePixels(image, 0, y, image->columns, 1)))
210
+ if (!(row_pixels = SetImagePixels(image, 0, (long int)y, image->columns, 1)))
211
211
  {
212
212
  rm_check_image_exception(image, RetainOnError);
213
213
  }
@@ -234,7 +234,7 @@ horizontal_fill(
234
234
  PixelPacket *stop_color)
235
235
  {
236
236
  double steps;
237
- long x, y;
237
+ unsigned long x, y;
238
238
  volatile PixelPacket *master;
239
239
  double red_step, green_step, blue_step;
240
240
 
@@ -267,9 +267,9 @@ horizontal_fill(
267
267
  for (y = 0; y < image->rows; y++)
268
268
  {
269
269
  double distance = fabs(y1 - y);
270
- master[y].red = start_color->red + (distance * red_step);
271
- master[y].green = start_color->green + (distance * green_step);
272
- master[y].blue = start_color->blue + (distance * blue_step);
270
+ master[y].red = RoundToQuantum(start_color->red + (distance * red_step));
271
+ master[y].green = RoundToQuantum(start_color->green + (distance * green_step));
272
+ master[y].blue = RoundToQuantum(start_color->blue + (distance * blue_step));
273
273
  master[y].opacity = OpaqueOpacity;
274
274
  }
275
275
 
@@ -277,7 +277,7 @@ horizontal_fill(
277
277
  {
278
278
  PixelPacket *col_pixels;
279
279
 
280
- if (!(col_pixels = SetImagePixels(image, x, 0, 1, image->rows)))
280
+ if (!(col_pixels = SetImagePixels(image, (long int)x, 0, 1, image->rows)))
281
281
  {
282
282
  rm_check_image_exception(image, RetainOnError);
283
283
  }
@@ -306,7 +306,7 @@ v_diagonal_fill(
306
306
  PixelPacket *start_color,
307
307
  PixelPacket *stop_color)
308
308
  {
309
- long x, y;
309
+ unsigned long x, y;
310
310
  double red_step, green_step, blue_step;
311
311
  double m, b, steps = 0.0;
312
312
  double d1, d2;
@@ -325,7 +325,7 @@ v_diagonal_fill(
325
325
  {
326
326
  steps += FMAX(fabs(d1),fabs(d2));
327
327
  }
328
- else if (d1 > image->rows && d2 > image->rows)
328
+ else if (d1 > (double)image->rows && d2 > (double)image->rows)
329
329
  {
330
330
  steps += FMAX(d1-image->rows, d2-image->rows);
331
331
  }
@@ -351,16 +351,16 @@ v_diagonal_fill(
351
351
  {
352
352
  PixelPacket *row_pixels;
353
353
 
354
- if (!(row_pixels = SetImagePixels(image, 0, y, image->columns, 1)))
354
+ if (!(row_pixels = SetImagePixels(image, 0, (long int)y, image->columns, 1)))
355
355
  {
356
356
  rm_check_image_exception(image, RetainOnError);
357
357
  }
358
358
  for (x = 0; x < image->columns; x++)
359
359
  {
360
- double distance = fabs(y-(m * x + b));
361
- row_pixels[x].red = start_color->red + (distance * red_step);
362
- row_pixels[x].green = start_color->green + (distance * green_step);
363
- row_pixels[x].blue = start_color->blue + (distance * blue_step);
360
+ double distance = (double) abs((int)(y-(m * x + b)));
361
+ row_pixels[x].red = RoundToQuantum(start_color->red + (distance * red_step));
362
+ row_pixels[x].green = RoundToQuantum(start_color->green + (distance * green_step));
363
+ row_pixels[x].blue = RoundToQuantum(start_color->blue + (distance * blue_step));
364
364
  row_pixels[x].opacity = OpaqueOpacity;
365
365
  }
366
366
  if (!SyncImagePixels(image))
@@ -385,7 +385,7 @@ h_diagonal_fill(
385
385
  PixelPacket *start_color,
386
386
  PixelPacket *stop_color)
387
387
  {
388
- long x, y;
388
+ unsigned long x, y;
389
389
  double m, b, steps = 0.0;
390
390
  double red_step, green_step, blue_step;
391
391
  double d1, d2;
@@ -398,7 +398,7 @@ h_diagonal_fill(
398
398
  // the left or right side of the image between y=0 and y=image->rows.
399
399
  // When y=0, x=-b/m. When y=image->rows, x = (image->rows-b)/m.
400
400
  d1 = -b/m;
401
- d2 = (image->rows-b)/m;
401
+ d2 = (double) ((image->rows-b) / m);
402
402
 
403
403
  // If the line is entirely to the right or left of the image, increase
404
404
  // the number of steps.
@@ -406,9 +406,9 @@ h_diagonal_fill(
406
406
  {
407
407
  steps += FMAX(fabs(d1),fabs(d2));
408
408
  }
409
- else if (d1 > image->columns && d2 > image->columns)
409
+ else if (d1 > (double)image->columns && d2 > (double)image->columns)
410
410
  {
411
- steps += FMAX(fabs(image->columns-d1),fabs(image->columns-d2));
411
+ steps += FMAX(abs((int)(image->columns-d1)),abs((int)(image->columns-d2)));
412
412
  }
413
413
 
414
414
  d1 = FMAX(d1, image->columns-d1);
@@ -432,16 +432,16 @@ h_diagonal_fill(
432
432
  {
433
433
  PixelPacket *row_pixels;
434
434
 
435
- if (!(row_pixels = SetImagePixels(image, 0, y, image->columns, 1)))
435
+ if (!(row_pixels = SetImagePixels(image, 0, (long int)y, image->columns, 1)))
436
436
  {
437
437
  rm_check_image_exception(image, RetainOnError);
438
438
  }
439
439
  for (x = 0; x < image->columns; x++)
440
440
  {
441
- double distance = fabs(x-((y-b)/m));
442
- row_pixels[x].red = start_color->red + (distance * red_step);
443
- row_pixels[x].green = start_color->green + (distance * green_step);
444
- row_pixels[x].blue = start_color->blue + (distance * blue_step);
441
+ double distance = (double) abs((int)(x-((y-b)/m)));
442
+ row_pixels[x].red = RoundToQuantum(start_color->red + (distance * red_step));
443
+ row_pixels[x].green = RoundToQuantum(start_color->green + (distance * green_step));
444
+ row_pixels[x].blue = RoundToQuantum(start_color->blue + (distance * blue_step));
445
445
  row_pixels[x].opacity = OpaqueOpacity;
446
446
  }
447
447
  if (!SyncImagePixels(image))
@@ -529,7 +529,7 @@ free_TextureFill(void *fill_obj)
529
529
  {
530
530
  rm_TextureFill *fill = (rm_TextureFill *)fill_obj;
531
531
 
532
- DestroyImage(fill->texture);
532
+ (void) DestroyImage(fill->texture);
533
533
  xfree(fill);
534
534
  }
535
535
 
@@ -585,7 +585,7 @@ TextureFill_initialize(VALUE self, VALUE texture_arg)
585
585
 
586
586
  // Bump the reference count on the texture image.
587
587
  Data_Get_Struct(texture_image, Image, texture);
588
- ReferenceImage(texture);
588
+ (void) ReferenceImage(texture);
589
589
 
590
590
  fill->texture = texture;
591
591
  return self;
@@ -604,7 +604,7 @@ TextureFill_fill(VALUE self, VALUE image_obj)
604
604
  Data_Get_Struct(image_obj, Image, image);
605
605
  Data_Get_Struct(self, rm_TextureFill, fill);
606
606
 
607
- TextureImage(image, fill->texture);
607
+ (void) TextureImage(image, fill->texture);
608
608
  rm_check_image_exception(image, RetainOnError);
609
609
 
610
610
  return self;