Class: Magick::KernelInfo
- Inherits:
-
Object
- Object
- Magick::KernelInfo
- Defined in:
- ext/RMagick/rmmain.c
Class Method Summary collapse
-
.builtin(what, geometry) ⇒ Object
Create new instance of KernelInfo with one of the ‘named’ built-in types of kernels used for special purposes such as gaussian blurring, skeleton pruning, and edge distance determination.
Instance Method Summary collapse
-
#clone ⇒ Object
Creates a new clone of the object so that its can be modified without effecting the original.
-
#dup ⇒ Object
Creates a new clone of the object so that its can be modified without effecting the original.
-
#initialize(kernel_string) ⇒ Object
constructor
KernelInfo object constructor.
-
#scale(scale, flags) ⇒ Object
Scales the given kernel list by the given amount, with or without normalization of the sum of the kernel values (as per given flags).
-
#scale_geometry(geometry) ⇒ Object
Takes a geometry argument string, typically provided as a “-set option:convolve:scale geometry” user setting, and modifies the kernel according to the parsed arguments of that setting.
-
#show ⇒ Object
deprecated
Deprecated.
This method has been deprecated.
-
#unity_add(scale) ⇒ Object
Adds a given amount of the ‘Unity’ Convolution Kernel to the given pre-scaled and normalized Kernel.
-
#zero_nans ⇒ Object
deprecated
Deprecated.
This method has been deprecated.
Constructor Details
#initialize(kernel_string) ⇒ Object
KernelInfo object constructor
Ruby usage:
- @verbatim KernelInfo#initialize @endverbatim
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'ext/RMagick/rmkinfo.c', line 52
VALUE
KernelInfo_initialize(VALUE self, VALUE kernel_string)
{
KernelInfo *kernel;
Check_Type(kernel_string, T_STRING);
kernel = AcquireKernelInfo(StringValueCStr(kernel_string));
if (kernel == NULL)
rb_raise(rb_eRuntimeError, "failed to parse kernel string");
DATA_PTR(self) = kernel;
return self;
}
|
Class Method Details
.builtin(what, geometry) ⇒ Object
Create new instance of KernelInfo with one of the ‘named’ built-in types of kernels used for special purposes such as gaussian blurring, skeleton pruning, and edge distance determination.
Ruby usage:
- @verbatim KernelInfo.builtin(kernel, geometry = nil) @endverbatim
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'ext/RMagick/rmkinfo.c', line 235
VALUE
KernelInfo_builtin(VALUE self, VALUE what, VALUE geometry)
{
KernelInfo *kernel;
KernelInfoType kernel_type;
GeometryInfo info;
Check_Type(geometry, T_STRING);
VALUE_TO_ENUM(what, kernel_type, KernelInfoType);
ParseGeometry(StringValueCStr(geometry), &info);
kernel = AcquireKernelBuiltIn(kernel_type, &info);
if (!kernel)
rb_raise(rb_eRuntimeError, "failed to acquire builtin kernel");
return Data_Wrap_Struct(self, NULL, rm_kernel_info_destroy, kernel);
}
|
Instance Method Details
#clone ⇒ Object
Creates a new clone of the object so that its can be modified without effecting the original.
Ruby usage:
- @verbatim KernelInfo#clone @endverbatim
178 179 180 181 182 183 |
# File 'ext/RMagick/rmkinfo.c', line 178
VALUE
KernelInfo_clone(VALUE self)
{
KernelInfo *kernel = CloneKernelInfo((KernelInfo*)DATA_PTR(self));
return Data_Wrap_Struct(Class_KernelInfo, NULL, rm_kernel_info_destroy, kernel);
}
|
#dup ⇒ Object
Creates a new clone of the object so that its can be modified without effecting the original.
Ruby usage:
- @verbatim KernelInfo#clone @endverbatim
178 179 180 181 182 183 |
# File 'ext/RMagick/rmkinfo.c', line 178
VALUE
KernelInfo_clone(VALUE self)
{
KernelInfo *kernel = CloneKernelInfo((KernelInfo*)DATA_PTR(self));
return Data_Wrap_Struct(Class_KernelInfo, NULL, rm_kernel_info_destroy, kernel);
}
|
#scale(scale, flags) ⇒ Object
Scales the given kernel list by the given amount, with or without normalization of the sum of the kernel values (as per given flags).
Ruby usage:
- @verbatim KernelInfo#scale(scale, flags) @endverbatim
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'ext/RMagick/rmkinfo.c', line 134
VALUE
KernelInfo_scale(VALUE self, VALUE scale, VALUE flags)
{
GeometryFlags geoflags;
if (!FIXNUM_P(scale))
Check_Type(scale, T_FLOAT);
if (rb_obj_is_instance_of(flags, Class_GeometryFlags))
VALUE_TO_ENUM(flags, geoflags, GeometryFlags);
else
rb_raise(rb_eArgError, "expected Integer or Magick::GeometryFlags to specify flags");
ScaleKernelInfo((KernelInfo*)DATA_PTR(self), NUM2DBL(scale), geoflags);
return Qnil;
}
|
#scale_geometry(geometry) ⇒ Object
Takes a geometry argument string, typically provided as a “-set option:convolve:scale geometry” user setting, and modifies the kernel according to the parsed arguments of that setting.
Ruby usage:
- @verbatim KernelInfo#scale_geometry(geometry) @endverbatim
161 162 163 164 165 166 167 |
# File 'ext/RMagick/rmkinfo.c', line 161
VALUE
KernelInfo_scale_geometry(VALUE self, VALUE geometry)
{
Check_Type(geometry, T_STRING);
ScaleGeometryKernelInfo((KernelInfo*)DATA_PTR(self), StringValueCStr(geometry));
return Qnil;
}
|
#show ⇒ Object
This method has been deprecated.
Dumps KernelInfo object to stderr
Ruby usage:
- @verbatim KernelInfo#show @endverbatim
114 115 116 117 118 119 120 |
# File 'ext/RMagick/rmkinfo.c', line 114
VALUE
KernelInfo_show(VALUE self)
{
rb_warning("KernelInfo#show is deprecated");
ShowKernelInfo((KernelInfo*)DATA_PTR(self));
return Qnil;
}
|
#unity_add(scale) ⇒ Object
Adds a given amount of the ‘Unity’ Convolution Kernel to the given pre-scaled and normalized Kernel.
Ruby usage:
- @verbatim KernelInfo#unity_add(scale) @endverbatim
95 96 97 98 99 100 101 102 103 |
# File 'ext/RMagick/rmkinfo.c', line 95
VALUE
KernelInfo_unity_add(VALUE self, VALUE scale)
{
if (!FIXNUM_P(scale))
Check_Type(scale, T_FLOAT);
UnityAddKernelInfo((KernelInfo*)DATA_PTR(self), NUM2DBL(scale));
return Qnil;
}
|
#zero_nans ⇒ Object
This method has been deprecated.
Zero kerne NaNs.
Ruby usage:
- @verbatim KernelInfo#zero_nans @endverbatim
78 79 80 81 82 83 84 |
# File 'ext/RMagick/rmkinfo.c', line 78
VALUE
KernelInfo_zero_nans(VALUE self)
{
rb_warning("KernelInfo#zero_nans is deprecated");
ZeroKernelNans((KernelInfo*)DATA_PTR(self));
return Qnil;
}
|