Method: Magick::Image#class_type=
- Defined in:
- ext/RMagick/rmimage.cpp
#class_type=(new_class_type) ⇒ Magick::ClassType
Change the image’s storage class.
13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 |
# File 'ext/RMagick/rmimage.cpp', line 13806
VALUE
Image_class_type_eq(VALUE self, VALUE new_class_type)
{
Image *image;
ClassType class_type;
QuantizeInfo qinfo;
#if defined(IMAGEMAGICK_7)
ExceptionInfo *exception;
#endif
image = rm_check_frozen(self);
VALUE_TO_ENUM(new_class_type, class_type, ClassType);
if (class_type == UndefinedClass)
{
rb_raise(rb_eArgError, "Invalid class type specified.");
}
#if defined(IMAGEMAGICK_7)
exception = AcquireExceptionInfo();
#endif
if (image->storage_class == PseudoClass && class_type == DirectClass)
{
#if defined(IMAGEMAGICK_7)
GVL_STRUCT_TYPE(SyncImage) args = { image, exception };
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncImage), &args);
CHECK_EXCEPTION();
#else
GVL_STRUCT_TYPE(SyncImage) args = { image };
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SyncImage), &args);
#endif
magick_free(image->colormap);
image->colormap = NULL;
}
else if (image->storage_class == DirectClass && class_type == PseudoClass)
{
GetQuantizeInfo(&qinfo);
qinfo.number_colors = QuantumRange+1;
#if defined(IMAGEMAGICK_7)
GVL_STRUCT_TYPE(QuantizeImage) args = { &qinfo, image, exception };
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(QuantizeImage), &args);
CHECK_EXCEPTION();
#else
GVL_STRUCT_TYPE(QuantizeImage) args = { &qinfo, image };
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(QuantizeImage), &args);
#endif
}
#if defined(IMAGEMAGICK_7)
GVL_STRUCT_TYPE(SetImageStorageClass) args = { image, class_type, exception };
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args);
CHECK_EXCEPTION();
DestroyExceptionInfo(exception);
#else
GVL_STRUCT_TYPE(SetImageStorageClass) args = { image, class_type };
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageStorageClass), &args);
#endif
return new_class_type;
}
|