Module: FreeImage::Transforms
- Included in:
- Bitmap
- Defined in:
- lib/free-image/modules/transforms.rb
Instance Method Summary collapse
-
#flip_horizontal! ⇒ Object
call-seq: bitmap.flip_horizontal -> boolean.
-
#flip_vertical! ⇒ Object
call-seq: bitmap.flip_vertical -> boolean.
-
#rotate(angle, bk_color = nil) ⇒ Object
call-seq: bitmap.rotate(angle, bk_color) -> bitmap.
-
#rotate_ex(angle, x_shift, y_shift, x_origin, y_origin, use_mask = false) ⇒ Object
call-seq: bitmap.rotate_ex(aangle, x_shift, y_shift, x_origin, y_origin, use_mask = false) -> bitmap.
Instance Method Details
#flip_horizontal! ⇒ Object
call-seq:
bitmap.flip_horizontal -> boolean
Flip the input image horizontally along the vertical axis.
66 67 68 69 70 |
# File 'lib/free-image/modules/transforms.rb', line 66 def flip_horizontal! result = FreeImage.FreeImage_FlipHorizontal(self) FreeImage.check_last_error result end |
#flip_vertical! ⇒ Object
call-seq:
bitmap.flip_vertical -> boolean
Flip the input image vertically horizontally along the horizontal axis.
77 78 79 80 81 |
# File 'lib/free-image/modules/transforms.rb', line 77 def flip_vertical! result = FreeImage.FreeImage_FlipHorizontal(self) FreeImage.check_last_error result end |
#rotate(angle, bk_color = nil) ⇒ Object
call-seq:
bitmap.rotate(angle, bk_color) -> bitmap
Rotates an image around the center of the image area by means of 3 shears. The rotated image retains the same size and aspect ratio of source image (the resulting image size is usually bigger), so that this function should be used when rotating an image by 90°, 180° or 270°.
When the angle value isn’t an integer multiple of 90°, the background is filled with the supplied bkcolor parameter. When bkcolor is nil, the default value, the background is filled with a black.
Parameters
angle:: Specifies the angle of rotation in degrees
bk_color:: The color used to fill the background.
32 33 34 35 36 |
# File 'lib/free-image/modules/transforms.rb', line 32 def rotate(angle, bk_color = nil) ptr = FreeImage.FreeImage_Rotate(self, angle, bk_color) FreeImage.check_last_error self.class.new(ptr) end |
#rotate_ex(angle, x_shift, y_shift, x_origin, y_origin, use_mask = false) ⇒ Object
call-seq:
bitmap.rotate_ex(aangle, x_shift, y_shift, x_origin, y_origin, use_mask = false) -> bitmap
Rotates an image using a 3rd order (cubic) B-Spline. The rotated image will have the same width and height as the source image, so that this function is better suited for computer vision and robotics.
Parameters:
angle:: Specifies the angle of rotation in degrees
x_shift:: Specifies horizonal image translation
y_shift:: Specifies vertical image translation
x_origin:: Specifies the x coordinate of the center of rotation
y_origin:: Specifies the y coordinate of the center of rotation
use_mask:: When true, irrelevant parts of the image are set to black,
otherwise, a mirroring technique is used to fill irrelevant pixels.
55 56 57 58 59 |
# File 'lib/free-image/modules/transforms.rb', line 55 def rotate_ex(angle, x_shift, y_shift, x_origin, y_origin, use_mask = false); ptr = FreeImage.FreeImage_RotateEx(self, angle, x_shift, y_shift, x_origin, y_origin, use_mask) FreeImage.check_last_error self.class.new(ptr) end |