Skip to content

Commit

Permalink
New names for C struct<-to->Magick-object conversion functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rmagick committed Dec 27, 2008
1 parent c301002 commit 2f1dd5c
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 91 deletions.
10 changes: 5 additions & 5 deletions ext/RMagick/rmagick.c
@@ -1,4 +1,4 @@
/* $Id: rmagick.c,v 1.1 2008/12/27 00:46:59 rmagick Exp $ */
/* $Id: rmagick.c,v 1.2 2008/12/27 17:16:03 rmagick Exp $ */
/*============================================================================\
| Copyright (C) 2008 by Timothy P. Hunter
| Name: rmagick.c
Expand Down Expand Up @@ -38,7 +38,7 @@ Magick_colors(VALUE class)
{
for (x = 0; x < number_colors; x++)
{
(void) rb_yield(Color_from_ColorInfo(color_info_list[x]));
(void) rb_yield(Import_ColorInfo(color_info_list[x]));
}
magick_free((void *)color_info_list);
return class;
Expand All @@ -48,7 +48,7 @@ Magick_colors(VALUE class)
ary = rb_ary_new2((long) number_colors);
for (x = 0; x < number_colors; x++)
{
(void) rb_ary_push(ary, Color_from_ColorInfo(color_info_list[x]));
(void) rb_ary_push(ary, Import_ColorInfo(color_info_list[x]));
}

magick_free((void *)color_info_list);
Expand Down Expand Up @@ -79,7 +79,7 @@ Magick_fonts(VALUE class)
{
for (x = 0; x < number_types; x++)
{
(void) rb_yield(Font_from_TypeInfo((const TypeInfo *)type_info[x]));
(void) rb_yield(Import_TypeInfo((const TypeInfo *)type_info[x]));
}
magick_free((void *)type_info);
return class;
Expand All @@ -89,7 +89,7 @@ Magick_fonts(VALUE class)
ary = rb_ary_new2((long)number_types);
for (x = 0; x < number_types; x++)
{
(void) rb_ary_push(ary, Font_from_TypeInfo((const TypeInfo *)type_info[x]));
(void) rb_ary_push(ary, Import_TypeInfo((const TypeInfo *)type_info[x]));
}
magick_free((void *)type_info);
return ary;
Expand Down
34 changes: 17 additions & 17 deletions ext/RMagick/rmagick.h
@@ -1,4 +1,4 @@
/* $Id: rmagick.h,v 1.264 2008/12/27 00:46:59 rmagick Exp $ */
/* $Id: rmagick.h,v 1.265 2008/12/27 17:16:03 rmagick Exp $ */
/*=============================================================================
| Copyright (C) 2008 by Timothy P. Hunter
| Name: rmagick.h
Expand Down Expand Up @@ -1093,7 +1093,7 @@ extern VALUE ChromaticityInfo_new(ChromaticityInfo *);
extern void Color_to_PixelPacket(PixelPacket *, VALUE);
extern void Color_to_MagickPixelPacket(Image *, MagickPixelPacket *, VALUE);
extern VALUE Color_to_s(VALUE);
extern VALUE Color_from_ColorInfo(const ColorInfo *);
extern VALUE Import_ColorInfo(const ColorInfo *);
extern VALUE ClassType_new(ClassType);
extern VALUE ColorspaceType_new(ColorspaceType);
extern VALUE CompositeOperator_new(CompositeOperator);
Expand All @@ -1111,30 +1111,30 @@ extern VALUE PixelPacket_to_Color_Name(Image *, PixelPacket *);
extern VALUE PixelPacket_to_Color_Name_Info(Info *, PixelPacket *);
extern VALUE Pixel_from_MagickPixelPacket(const MagickPixelPacket *);
extern VALUE Pixel_from_PixelPacket(const PixelPacket *);
extern void Point_to_PointInfo(PointInfo *, VALUE);
extern VALUE PointInfo_to_Point(PointInfo *);
extern void Export_PointInfo(PointInfo *, VALUE);
extern VALUE Import_PointInfo(PointInfo *);
extern VALUE PrimaryInfo_to_s(VALUE);
extern VALUE PrimaryInfo_from_PrimaryInfo(PrimaryInfo *);
extern VALUE Import_PrimaryInfo(PrimaryInfo *);
extern VALUE RectangleInfo_to_s(VALUE);
extern VALUE Rectangle_from_RectangleInfo(RectangleInfo *);
extern VALUE Import_RectangleInfo(RectangleInfo *);
extern VALUE RenderingIntent_new(RenderingIntent);
extern VALUE ResolutionType_new(ResolutionType);
extern VALUE SegmentInfo_to_s(VALUE);
extern VALUE Segment_from_SegmentInfo(SegmentInfo *);
extern void AffineMatrix_to_AffineMatrix(AffineMatrix *, VALUE);
extern VALUE AffineMatrix_from_AffineMatrix(AffineMatrix *);
extern void ChromaticityInfo_to_ChromaticityInfo(ChromaticityInfo *, VALUE);
extern void Color_to_ColorInfo(ColorInfo *, VALUE);
extern VALUE Import_SegmentInfo(SegmentInfo *);
extern void Export_AffineMatrix(AffineMatrix *, VALUE);
extern VALUE Import_AffineMatrix(AffineMatrix *);
extern void Export_ChromaticityInfo(ChromaticityInfo *, VALUE);
extern void Export_ColorInfo(ColorInfo *, VALUE);
extern VALUE InterpolatePixelMethod_new(InterpolatePixelMethod);
extern VALUE OrientationType_new(OrientationType);
extern void PrimaryInfo_to_PrimaryInfo(PrimaryInfo *, VALUE);
extern void Rectangle_to_RectangleInfo(RectangleInfo *, VALUE);
extern void Segment_to_SegmentInfo(SegmentInfo *, VALUE);
extern void Export_PrimaryInfo(PrimaryInfo *, VALUE);
extern void Export_RectangleInfo(RectangleInfo *, VALUE);
extern void Export_SegmentInfo(SegmentInfo *, VALUE);
extern void Font_to_TypeInfo(TypeInfo *, VALUE);
extern void TypeMetric_to_TypeMetric(TypeMetric *, VALUE);
extern VALUE Font_from_TypeInfo(const TypeInfo *);
extern void Export_TypeMetric(TypeMetric *, VALUE);
extern VALUE Import_TypeInfo(const TypeInfo *);
extern VALUE TypeMetric_to_s(VALUE);
extern VALUE TypeMetric_from_TypeMetric(TypeMetric *);
extern VALUE Import_TypeMetric(TypeMetric *);
extern const char *StorageType_name(StorageType);
extern VALUE VirtualPixelMethod_new(VirtualPixelMethod);
extern VALUE LAYERMETHODTYPE_NEW(LAYERMETHODTYPE);
Expand Down
16 changes: 8 additions & 8 deletions ext/RMagick/rmdraw.c
@@ -1,4 +1,4 @@
/* $Id: rmdraw.c,v 1.73 2008/12/27 00:46:13 rmagick Exp $ */
/* $Id: rmdraw.c,v 1.74 2008/12/27 17:16:03 rmagick Exp $ */
/*============================================================================\
| Copyright (C) 2008 by Timothy P. Hunter
| Name: rmdraw.c
Expand Down Expand Up @@ -28,7 +28,7 @@ Draw_affine_eq(VALUE self, VALUE matrix)

rb_check_frozen(self);
Data_Get_Struct(self, Draw, draw);
AffineMatrix_to_AffineMatrix(&draw->info->affine, matrix);
Export_AffineMatrix(&draw->info->affine, matrix);
return self;
}

Expand Down Expand Up @@ -434,8 +434,8 @@ Draw_marshal_dump(VALUE self)

// rb_hash_aset(ddraw, CSTR2SYM("primitive"), MAGICK_STRING_TO_OBJ(draw->info->primitive)); internal
// rb_hash_aset(ddraw, CSTR2SYM("geometry"), MAGICK_STRING_TO_OBJ(draw->info->geometry)); set by "text" primitive
// rb_hash_aset(ddraw, CSTR2SYM("viewbox"), Rectangle_from_RectangleInfo(&draw->info->viewbox)); internal
rb_hash_aset(ddraw, CSTR2SYM("affine"), AffineMatrix_from_AffineMatrix(&draw->info->affine));
// rb_hash_aset(ddraw, CSTR2SYM("viewbox"), Import_RectangleInfo(&draw->info->viewbox)); internal
rb_hash_aset(ddraw, CSTR2SYM("affine"), Import_AffineMatrix(&draw->info->affine));
rb_hash_aset(ddraw, CSTR2SYM("gravity"), INT2FIX(draw->info->gravity));
rb_hash_aset(ddraw, CSTR2SYM("fill"), Pixel_from_PixelPacket(&draw->info->fill));
rb_hash_aset(ddraw, CSTR2SYM("stroke"), Pixel_from_PixelPacket(&draw->info->stroke));
Expand Down Expand Up @@ -470,7 +470,7 @@ Draw_marshal_dump(VALUE self)
// rb_hash_aset(ddraw, CSTR2SYM("server_name"), MAGICK_STRING_TO_OBJ(draw->info->server_name));
// rb_hash_aset(ddraw, CSTR2SYM("dash_pattern"), dash_pattern_to_array(draw->info->dash_pattern)); internal
// rb_hash_aset(ddraw, CSTR2SYM("clip_mask"), MAGICK_STRING_TO_OBJ(draw->info->clip_mask)); internal
// rb_hash_aset(ddraw, CSTR2SYM("bounds"), Segment_from_SegmentInfo(&draw->info->bounds)); internal
// rb_hash_aset(ddraw, CSTR2SYM("bounds"), Import_SegmentInfo(&draw->info->bounds)); internal
rb_hash_aset(ddraw, CSTR2SYM("clip_units"), INT2FIX(draw->info->clip_units));
rb_hash_aset(ddraw, CSTR2SYM("opacity"), QUANTUM2NUM(draw->info->opacity));
// rb_hash_aset(ddraw, CSTR2SYM("render"), draw->info->render ? Qtrue : Qfalse); internal
Expand Down Expand Up @@ -515,10 +515,10 @@ Draw_marshal_load(VALUE self, VALUE ddraw)
OBJ_TO_MAGICK_STRING(draw->info->geometry, rb_hash_aref(ddraw, CSTR2SYM("geometry")));

//val = rb_hash_aref(ddraw, CSTR2SYM("viewbox"));
//Rectangle_to_RectangleInfo(&draw->info->viewbox, val);
//Export_RectangleInfo(&draw->info->viewbox, val);

val = rb_hash_aref(ddraw, CSTR2SYM("affine"));
AffineMatrix_to_AffineMatrix(&draw->info->affine, val);
Export_AffineMatrix(&draw->info->affine, val);

draw->info->gravity = (GravityType) FIX2INT(rb_hash_aref(ddraw, CSTR2SYM("gravity")));

Expand Down Expand Up @@ -1473,5 +1473,5 @@ get_type_metrics(
rb_raise(rb_eRuntimeError, "Can't measure text. Are the fonts installed? "
"Is the FreeType library installed?");
}
return TypeMetric_from_TypeMetric(&metrics);
return Import_TypeMetric(&metrics);
}
18 changes: 9 additions & 9 deletions ext/RMagick/rmimage.c
@@ -1,4 +1,4 @@
/* $Id: rmimage.c,v 1.338 2008/12/27 00:17:52 rmagick Exp $ */
/* $Id: rmimage.c,v 1.339 2008/12/27 17:16:04 rmagick Exp $ */
/*============================================================================\
| Copyright (C) 2008 by Timothy P. Hunter
| Name: rmimage.c
Expand Down Expand Up @@ -584,7 +584,7 @@ Image_affine_transform(VALUE self, VALUE affine)
image = rm_check_destroyed(self);

// Convert Magick::AffineMatrix to AffineMatrix structure.
AffineMatrix_to_AffineMatrix(&matrix, affine);
Export_AffineMatrix(&matrix, affine);

GetExceptionInfo(&exception);
new_image = AffineTransformImage(image, &matrix, &exception);
Expand Down Expand Up @@ -1473,7 +1473,7 @@ Image_bounding_box(VALUE self)

(void) DestroyExceptionInfo(&exception);

return Rectangle_from_RectangleInfo(&box);
return Import_RectangleInfo(&box);
}


Expand Down Expand Up @@ -1787,7 +1787,7 @@ VALUE
Image_chromaticity_eq(VALUE self, VALUE chroma)
{
Image *image = rm_check_frozen(self);
ChromaticityInfo_to_ChromaticityInfo(&image->chromaticity, chroma);
Export_ChromaticityInfo(&image->chromaticity, chroma);
return self;
}

Expand Down Expand Up @@ -2661,7 +2661,7 @@ Image_composite_affine(VALUE self, VALUE source, VALUE affine_matrix)
composite_image = rm_check_destroyed(source);
new_image = rm_clone_image(image);

AffineMatrix_to_AffineMatrix(&affine, affine_matrix);
Export_AffineMatrix(&affine, affine_matrix);
(void) DrawAffineImage(new_image, composite_image, &affine);
rm_check_image_exception(new_image, DestroyOnError);

Expand Down Expand Up @@ -4704,15 +4704,15 @@ VALUE
Image_extract_info(VALUE self)
{
Image *image = rm_check_destroyed(self);
return Rectangle_from_RectangleInfo(&image->extract_info);
return Import_RectangleInfo(&image->extract_info);
}


VALUE
Image_extract_info_eq(VALUE self, VALUE rect)
{
Image *image = rm_check_frozen(self);
Rectangle_to_RectangleInfo(&image->extract_info, rect);
Export_RectangleInfo(&image->extract_info, rect);
return self;
}

Expand Down Expand Up @@ -7367,7 +7367,7 @@ VALUE
Image_page(VALUE self)
{
Image *image = rm_check_destroyed(self);
return Rectangle_from_RectangleInfo(&image->page);
return Import_RectangleInfo(&image->page);
}


Expand All @@ -7379,7 +7379,7 @@ VALUE
Image_page_eq(VALUE self, VALUE rect)
{
Image *image = rm_check_frozen(self);
Rectangle_to_RectangleInfo(&image->page, rect);
Export_RectangleInfo(&image->page, rect);
return self;
}

Expand Down

0 comments on commit 2f1dd5c

Please sign in to comment.