| Class Imlib2::Image |
|
| Methods |
| Public Class methods |
| new(VALUE klass, VALUE w, VALUE h) |
Returns a new Imlib2::Image with the specified width and height.
Examples:
width, height = 640, 480 image = Imlib2::Image.new width, height width, height = 320, 240 image = Imlib2::Image.create width, height
| draw_pixel_workaround?(VALUE klass) |
Are we using the buggy imlib_image_draw_pixel() work-around?
Versions of Imlib2 up to and including 1.0.5 had a broken imlib_image_draw_pixel() call. Imlib2-Ruby has a work-around, which simulates drawing a pixel with a 1x1 rectangle. This method allows you to check whether the work-around behavior is enabled.
Examples:
puts 'work-around is enabled' if Imlib2::Image::draw_pixel_workaround? puts 'work-around is enabled' if Imlib2::Image::bypass_draw_pixel?
| bypass_draw_pixel?(VALUE klass) |
Are we using the buggy imlib_image_draw_pixel() work-around?
Versions of Imlib2 up to and including 1.0.5 had a broken imlib_image_draw_pixel() call. Imlib2-Ruby has a work-around, which simulates drawing a pixel with a 1x1 rectangle. This method allows you to check whether the work-around behavior is enabled.
Examples:
puts 'work-around is enabled' if Imlib2::Image::draw_pixel_workaround? puts 'work-around is enabled' if Imlib2::Image::bypass_draw_pixel?
| draw_pixel_workaround=(VALUE klass) |
Are we using the buggy imlib_image_draw_pixel() work-around?
Versions of Imlib2 up to and including 1.0.5 had a broken imlib_image_draw_pixel() call. Imlib2-Ruby has a work-around, which simulates drawing a pixel with a 1x1 rectangle. This method allows you to check whether the work-around behavior is enabled.
Examples:
puts 'work-around is enabled' if Imlib2::Image::draw_pixel_workaround? puts 'work-around is enabled' if Imlib2::Image::bypass_draw_pixel?
| bypass_draw_pixel=(VALUE klass) |
Are we using the buggy imlib_image_draw_pixel() work-around?
Versions of Imlib2 up to and including 1.0.5 had a broken imlib_image_draw_pixel() call. Imlib2-Ruby has a work-around, which simulates drawing a pixel with a 1x1 rectangle. This method allows you to check whether the work-around behavior is enabled.
Examples:
puts 'work-around is enabled' if Imlib2::Image::draw_pixel_workaround? puts 'work-around is enabled' if Imlib2::Image::bypass_draw_pixel?
| create(VALUE klass, VALUE w, VALUE h) |
Returns a new Imlib2::Image with the specified width and height.
Examples:
width, height = 640, 480 image = Imlib2::Image.new width, height width, height = 320, 240 image = Imlib2::Image.create width, height
| create_using_data(VALUE klass, VALUE w, VALUE h, VALUE data_o) |
Returns a new Imlib2::Image initialized with the specified data.
Examples:
other_image = Imlib2::Image.load 'sample_file.png' width, height = other_image.width, other_image.height data = other_image.data_for_reading_only image = Imlib2::Image.create_using_data width, height, data
| create_using_copied_data(VALUE klass, VALUE w, VALUE h, VALUE data_o) |
Returns a new Imlib2::Image initialized with the specified data.
Examples:
other_image = Imlib2::Image.load 'sample_file.png' width, height = other_image.width, other_image.height data = other_image.data image = Imlib2::Image.create_using_copied_data width, height, data
| load(VALUE klass, VALUE filename) |
Load an Imlib2::Image from a file (throws exceptions).
Examples:
image = Imlib2::Image.load 'sample_file.png'
begin
image = Imlib2::Image.load 'sample_file.png'
rescue Imlib2::FileError
$stderr.puts 'Couldn't load file: ' + $!
end
| load_image(VALUE klass, VALUE filename) |
Load an Imlib2::Image from a file (no exceptions or error).
Imlib2::Image::load_image() provides access to the low-level imlib_load_image() function. You probably want to use Imlib2::Image::load() instead of Imlib2::Image::load_image().
Examples:
image = Imlib2::Image.load_image 'sample_file.png'
| load_immediately(VALUE klass, VALUE filename) |
Load an Imlib2::Image from a file (no exceptions or error).
Imlib2::Image::load_immediately() provides access to the low-level imlib_load_image_immediately() function. You probably want to use Imlib2::Image::load() instead of this function.
Examples:
image = Imlib2::Image.load_immediately 'sample_file.png'
| load_without_cache(VALUE klass, VALUE filename) |
Load an Imlib2::Image from a file (no caching, exception, or error).
Imlib2::Image::load_without_cache() provides access to the low-level imlib_load_image_without_cache() function. You probably want to use Imlib2::Image::load() instead of this function.
Examples:
image = Imlib2::Image.load_without_cache 'sample_file.png'
| load_immediately_without_cache(VALUE klass, VALUE filename) |
Load an Imlib2::Image from a file (no caching, deferred loading, exceptions, or errors).
Imlib2::Image::load_immediately_without_cache() provides access to the low-level imlib_load_image_immediately_without_cache() function. You probably want to use Imlib2::Image::load() instead of this function.
Examples:
image = Imlib2::Image.load_immediately_without_cache 'sample_file.png'
| load_with_error_return(VALUE klass, VALUE filename) |
Load an Imlib2::Image from a file with a hash of the error value and the image.
Imlib2::Image::load_with_error_return() provides access to the low-level imlib_load_image_with_error_return() function. You probably want to use Imlib2::Image::load() instead of this function.
Examples:
hash = Imlib2::Image.load_with_error_return 'sample_file.png'
if hash['error'] == 0 # 0 is no error
image = hash['image']
end
| create_from_drawable(...) |
| create_from_ximage(...) |
| Public Instance methods |
| initialize(VALUE self) |
Imlib2::Image constructor (currently just an empty placeholder).
| save(VALUE self, VALUE val) |
Save an Imlib2::Image to a file (throws an exception on error).
Examples:
image.save 'output_file.png'
filename = 'output_file.jpg'
begin
image.save filename
rescue Imlib2::FileError
$stderr.puts "Couldn't save file \"#{filename}\": " + $!
end
| save_image(VALUE self, VALUE val) |
Save an Imlib2::Image to a file (no exception or error).
Provides access to the low-level imlib_save_image() call. You probably want to use Imlib2::Image::save() instead.
Examples:
image.save_image 'output_file.png'
| save_with_error_return(VALUE self, VALUE val) |
Save an Imlib2::Image to a file (error returned as number).
Provides access to the low-level imlib_save_image_with_error_return() call. You probably want to use Imlib2::Image::save() instead.
Examples:
error = image.save_with_error_return 'output_file.png' puts 'an error occurred' unless error == 0
| width(VALUE self) |
| w(VALUE self) |
| height(VALUE self) |
| h(VALUE self) |
| filename(VALUE self) |
| data(VALUE self) |
Return a copy of an image's raw 32-bit data.
Examples:
raw = image.data
| data_for_reading_only(VALUE self) |
Return a read-only reference to an image's raw 32-bit data.
Examples:
RAW_DATA = image.data_for_reading_only RAW_DATA = image.data!
| data!(VALUE self) |
Return a read-only reference to an image's raw 32-bit data.
Examples:
RAW_DATA = image.data_for_reading_only RAW_DATA = image.data!
| data=(VALUE self, VALUE str) |
Fill an image using raw 32-bit data.
Examples:
RAW_DATA = other_image.data! image.put_data RAW_DATA RAW_DATA = other_image.data! image.data = RAW_DATA
| put_back_data(VALUE self, VALUE str) |
Fill an image using raw 32-bit data.
Examples:
RAW_DATA = other_image.data! image.put_data RAW_DATA RAW_DATA = other_image.data! image.data = RAW_DATA
| has_alpha(VALUE self) |
Does this image have transparent or translucent regions?
Examples:
if image.has_alpha?
puts 'this image has alpha'
end
| has_alpha?(VALUE self) |
Does this image have transparent or translucent regions?
Examples:
if image.has_alpha?
puts 'this image has alpha'
end
| has_alpha=(VALUE self, VALUE val) |
Set image alpha transparency.
Examples:
image.set_has_alpha true image.has_alpha = true
| set_has_alpha(VALUE self, VALUE val) |
Set image alpha transparency.
Examples:
image.set_has_alpha true image.has_alpha = true
| changes_on_disk(VALUE self) |
Flag this image as changing on disk
Examples:
image.changes_on_disk
| set_changes_on_disk(VALUE self) |
Flag this image as changing on disk
Examples:
image.changes_on_disk
| border(VALUE self) |
Get the Imlib2::Border of an Imlib2::Image
Examples:
border = image.get_border border = image.border
| get_border(VALUE self) |
Get the Imlib2::Border of an Imlib2::Image
Examples:
border = image.get_border border = image.border
| border=(VALUE self, VALUE border) |
| set_border(VALUE self, VALUE border) |
| format(VALUE self) |
Get the on-disk format of an Imlib2::Image
Examples:
format = image.get_format format = image.format
| get_format(VALUE self) |
Get the on-disk format of an Imlib2::Image
Examples:
format = image.get_format format = image.format
| format=(VALUE self, VALUE format) |
| set_format(VALUE self, VALUE format) |
| irrelevant_format=(VALUE self, VALUE val) |
Set the irrelevant_format flag of an Imlib2::Image
Examples:
image.set_irrelevant_format true image.irrelevant_format = true
| set_irrelevant_format(VALUE self, VALUE val) |
Set the irrelevant_format flag of an Imlib2::Image
Examples:
image.set_irrelevant_format true image.irrelevant_format = true
| irrelevant_border=(VALUE self, VALUE val) |
Set the irrelevant_border flag of an Imlib2::Image
Examples:
image.set_irrelevant_border true image.irrelevant_border = true
| set_irrelevant_border(VALUE self, VALUE val) |
Set the irrelevant_border flag of an Imlib2::Image
Examples:
image.set_irrelevant_border true image.irrelevant_border = true
| irrelevant_alpha=(VALUE self, VALUE val) |
Set the irrelevant_alpha flag of an Imlib2::Image
Examples:
image.set_irrelevant_alpha true image.irrelevant_alpha = true
| set_irrelevant_alpha(VALUE self, VALUE val) |
Set the irrelevant_alpha flag of an Imlib2::Image
Examples:
image.set_irrelevant_alpha true image.irrelevant_alpha = true
| pixel(VALUE self, VALUE x, VALUE y) |
Get the Imlib2::Color::RgbaColor value of the pixel at x, y
Examples:
color = image.query_pixel 320, 240 color = image.pixel 320, 240
| pixel_rgba(VALUE self, VALUE x, VALUE y) |
Get the Imlib2::Color::RgbaColor value of the pixel at x, y
Examples:
color = image.query_pixel 320, 240 color = image.pixel 320, 240
| query_pixel(VALUE self, VALUE x, VALUE y) |
Get the Imlib2::Color::RgbaColor value of the pixel at x, y
Examples:
color = image.query_pixel 320, 240 color = image.pixel 320, 240
| query_pixel_rgba(VALUE self, VALUE x, VALUE y) |
Get the Imlib2::Color::RgbaColor value of the pixel at x, y
Examples:
color = image.query_pixel 320, 240 color = image.pixel 320, 240
| pixel_hsva(VALUE self, VALUE x, VALUE y) |
Get the Imlib2::Color::HsvaColor value of the pixel at x, y
Examples:
color = image.query_pixel_hsva 320, 240 color = image.pixel_hsva 320, 240
| query_pixel_hsva(VALUE self, VALUE x, VALUE y) |
Get the Imlib2::Color::HsvaColor value of the pixel at x, y
Examples:
color = image.query_pixel_hsva 320, 240 color = image.pixel_hsva 320, 240
| pixel_hlsa(VALUE self, VALUE x, VALUE y) |
Get the Imlib2::Color::HlsaColor value of the pixel at x, y
Examples:
color = image.query_pixel_hlsa 320, 240 color = image.pixel_hlsa 320, 240
| query_pixel_hlsa(VALUE self, VALUE x, VALUE y) |
Get the Imlib2::Color::HlsaColor value of the pixel at x, y
Examples:
color = image.query_pixel_hlsa 320, 240 color = image.pixel_hlsa 320, 240
| pixel_cmya(VALUE self, VALUE x, VALUE y) |
Get the Imlib2::Color::CmyaColor value of the pixel at x, y
Examples:
color = image.query_pixel_cmya 320, 240 color = image.pixel_cmya 320, 240
| query_pixel_cmya(VALUE self, VALUE x, VALUE y) |
Get the Imlib2::Color::CmyaColor value of the pixel at x, y
Examples:
color = image.query_pixel_cmya 320, 240 color = image.pixel_cmya 320, 240
| crop(int argc, VALUE *argv, VALUE self) |
Return a cropped copy of the image
Examples:
x, y, w, h = 10, 10, old_image.width - 10, old_image.height - 10 new_image = old_image.crop x, y, w, h rect = [10, 10, old_image.width - 10, old_image.height - 10] new_image = old_image.crop rect
x, y, w, h = 10, 10, old_image.width - 10, old_image.height - 10 new_image = old_image.create_cropped x, y, w, h rect = [10, 10, old_image.width - 10, old_image.height - 10] new_image = old_image.create_cropped rect
| create_cropped(int argc, VALUE *argv, VALUE self) |
Return a cropped copy of the image
Examples:
x, y, w, h = 10, 10, old_image.width - 10, old_image.height - 10 new_image = old_image.crop x, y, w, h rect = [10, 10, old_image.width - 10, old_image.height - 10] new_image = old_image.crop rect
x, y, w, h = 10, 10, old_image.width - 10, old_image.height - 10 new_image = old_image.create_cropped x, y, w, h rect = [10, 10, old_image.width - 10, old_image.height - 10] new_image = old_image.create_cropped rect
| crop!(int argc, VALUE *argv, VALUE self) |
Crop an image
Examples:
x, y, w, h = 10, 10, image.width - 10, image.height - 10 image.crop! x, y, w, h rect = [10, 10, image.width - 10, image.height - 10] image.crop! rect
x, y, w, h = 10, 10, image.width - 10, image.height - 10 image.create_cropped! x, y, w, h rect = [10, 10, image.width - 10, image.height - 10] image.create_cropped! rect
| create_cropped!(int argc, VALUE *argv, VALUE self) |
Crop an image
Examples:
x, y, w, h = 10, 10, image.width - 10, image.height - 10 image.crop! x, y, w, h rect = [10, 10, image.width - 10, image.height - 10] image.crop! rect
x, y, w, h = 10, 10, image.width - 10, image.height - 10 image.create_cropped! x, y, w, h rect = [10, 10, image.width - 10, image.height - 10] image.create_cropped! rect
| crop_scaled(int argc, VALUE *argv, VALUE self) |
Create a cropped and scaled copy of an image
Examples:
iw, ih = old_image.width, old_image.height new_w, new_h = iw - 20, ih - 20 x, y, w, h = 10, 10, iw - 10, ih - 10 new_image = old_image.crop_scaled x, y, w, h, new_w, new_h iw, ih = old_image.width, old_image.height new_w, new_h = iw - 20, ih - 20 values = [10, 10, iw - 10, iw - 10, new_w, new_h] new_image = old_image.crop_scaled values
iw, ih = old_image.width, old_image.height new_w, new_h = iw - 20, ih - 20 x, y, w, h = 10, 10, iw - 10, ih - 10 new_image = old_image.create_crop_scaled x, y, w, h, new_w, new_h iw, ih = old_image.width, old_image.height new_w, new_h = iw - 20, ih - 20 values = [10, 10, iw - 10, iw - 10, new_w, new_h] new_image = old_image.create_crop_scaled values
| create_cropped_scaled(int argc, VALUE *argv, VALUE self) |
Create a cropped and scaled copy of an image
Examples:
iw, ih = old_image.width, old_image.height new_w, new_h = iw - 20, ih - 20 x, y, w, h = 10, 10, iw - 10, ih - 10 new_image = old_image.crop_scaled x, y, w, h, new_w, new_h iw, ih = old_image.width, old_image.height new_w, new_h = iw - 20, ih - 20 values = [10, 10, iw - 10, iw - 10, new_w, new_h] new_image = old_image.crop_scaled values
iw, ih = old_image.width, old_image.height new_w, new_h = iw - 20, ih - 20 x, y, w, h = 10, 10, iw - 10, ih - 10 new_image = old_image.create_crop_scaled x, y, w, h, new_w, new_h iw, ih = old_image.width, old_image.height new_w, new_h = iw - 20, ih - 20 values = [10, 10, iw - 10, iw - 10, new_w, new_h] new_image = old_image.create_crop_scaled values
| crop_scaled!(int argc, VALUE *argv, VALUE self) |
Crop and scale an image
Examples:
iw, ih = image.width, image.height new_w, new_h = iw - 20, ih - 20 x, y, w, h = 10, 10, iw - 10, ih - 10 image.crop_scaled! x, y, w, h, new_w, new_h iw, ih = image.width, image.height new_w, new_h = iw - 20, ih - 20 values = [10, 10, iw - 10, iw - 10, new_w, new_h] image.crop_scaled! values
iw, ih = image.width, image.height new_w, new_h = iw - 20, ih - 20 x, y, w, h = 10, 10, iw - 10, ih - 10 image.create_crop_scaled! x, y, w, h, new_w, new_h iw, ih = image.width, image.height new_w, new_h = iw - 20, ih - 20 values = [10, 10, iw - 10, iw - 10, new_w, new_h] image.create_crop_scaled! values
| create_cropped_scaled!(int argc, VALUE *argv, VALUE self) |
Crop and scale an image
Examples:
iw, ih = image.width, image.height new_w, new_h = iw - 20, ih - 20 x, y, w, h = 10, 10, iw - 10, ih - 10 image.crop_scaled! x, y, w, h, new_w, new_h iw, ih = image.width, image.height new_w, new_h = iw - 20, ih - 20 values = [10, 10, iw - 10, iw - 10, new_w, new_h] image.crop_scaled! values
iw, ih = image.width, image.height new_w, new_h = iw - 20, ih - 20 x, y, w, h = 10, 10, iw - 10, ih - 10 image.create_crop_scaled! x, y, w, h, new_w, new_h iw, ih = image.width, image.height new_w, new_h = iw - 20, ih - 20 values = [10, 10, iw - 10, iw - 10, new_w, new_h] image.create_crop_scaled! values
| flip_horizontal(VALUE self) |
Create a horizontally-flipped copy of an image
Examples:
backwards_image = old_image.flip_horizontal
| flip_horizontal!(VALUE self) |
Flip an image horizontally
Examples:
image.flip_horizontal!
| flip_vertical(VALUE self) |
Create a vertically-flipped copy of an image
Examples:
upside_down_image = old_image.flip_vertical
| flip_vertical!(VALUE self) |
Flip an image vertically
Examples:
image.flip_vertical!
| flip_diagonal(VALUE self) |
Create a copy of an image flipped along it's diagonal axis
Examples:
new_image = old_image.flip_diagonal
| flip_diagonal!(VALUE self) |
Flip an image along it's diagonal axis
Examples:
image.flip_diagonal!
| orientate(VALUE self, VALUE val) |
Return a copy of an image rotated in 90 degree increments
Examples:
increments = 3 # 90 * 3 degrees (eg 270 degrees) new_image = old_image.orientate increments
| orientate!(VALUE self, VALUE val) |
Rotate an image in 90 degree increments
Examples:
increments = 3 # 90 * 3 degrees (eg 270 degrees) image.orientate! increments
| blur(VALUE self, VALUE val) |
Return a blurred copy of an image
Examples:
radius = 20 # radius of blur, in pixels new_image = old_image.blur radius
| blur!(VALUE self, VALUE val) |
Blur an image
Examples:
radius = 20 # radius of blur, in pixels image.blur! radius
| sharpen(VALUE self, VALUE val) |
Return a sharpened copy of an image
Examples:
radius = 15 # radius of sharpen, in pixels new_image = old_image.sharpen radius
| sharpen!(VALUE self, VALUE val) |
Sharpened an image
Examples:
radius = 15 # radius of sharpen, in pixels image.sharpen! radius
| tile_horizontal(VALUE self) |
Return a copy of an image suitable for seamless horizontal tiling
Examples:
horiz_tile = old_image.tile_horizontal
| tile_horizontal!(VALUE self) |
Modify an image so it is suitable for seamless horizontal tiling
Examples:
image.tile_horizontal!
| tile_vertical(VALUE self) |
Return a copy of an image suitable for seamless vertical tiling
Examples:
vert_tile = old_image.tile_vertical
| tile_vertical!(VALUE self) |
Modify an image so it is suitable for seamless vertical tiling
Examples:
image.tile_vertical!
| tile(VALUE self) |
Return a copy of an image suitable for seamless tiling
Examples:
horiz_tile = old_image.tile
| tile!(VALUE self) |
Modify an image so it is suitable for seamless tiling
Examples:
image.tile!
| draw_pixel(int argc, VALUE *argv, VALUE self) |
Draw a pixel at the specified coordinates.
Note: Versions of Imlib2 up to and including 1.0.5 had a broken imlib_image_draw_pixel() call. Imlib2-Ruby has a work-around, which simulates drawing a pixel with a 1x1 rectangle. To disable this behavior, see the Imlib2::Image::draw_pixel_workaround= method.
Examples:
im.draw_pixel 10, 10 # draw using context color im.draw_pixel 10, 10, Imlib2::Color::BLUE # draw blue pixel im.draw_pixel [10, 10], Imlib2::Color::RED # draw red pixel
| draw_line(int argc, VALUE *argv, VALUE self) |
Draw a line at the specified coordinates.
Examples:
# draw line from 10, 10 to 20, 20 using context color im.draw_line 10, 10, 20, 20 # draw magenta line from 5, 10 to 15, 20 im.draw_line 5, 10, 15, 20, Imlib2::Color::MAGENTA
# draw line from 10, 15 to 20, 25 using context color im.draw_pixel [10, 15], [20, 25] # draw line from 1000, 2000 to 2100, 4200 with funky color my_color = Imlib2::Color::CmykColor.new 100, 255, 0, 128 im.draw_line [1000, 2000], [2100, 4200], my_color
| clip_line(...) |
| draw_rect(int argc, VALUE *argv, VALUE self) |
Draw a rectangle outline at the specified coordinates.
Examples:
# draw rectangle around edge of image using context color rect = [1, 1, im.width - 2, im.height - 2] im.draw_rect rect # draw magenta rectangle outline in top-left corner of image color = Imlib2::Color::MAGENTA im.draw_rect [0, 0], [im.width / 2, im.height / 2], color
# draw square from 10, 10 to 30, 30 using context color im.draw_rect [10, 10, 20, 20]
| draw_rectangle(int argc, VALUE *argv, VALUE self) |
Draw a rectangle outline at the specified coordinates.
Examples:
# draw rectangle around edge of image using context color rect = [1, 1, im.width - 2, im.height - 2] im.draw_rect rect # draw magenta rectangle outline in top-left corner of image color = Imlib2::Color::MAGENTA im.draw_rect [0, 0], [im.width / 2, im.height / 2], color
# draw square from 10, 10 to 30, 30 using context color im.draw_rect [10, 10, 20, 20]
| fill_rect(int argc, VALUE *argv, VALUE self) |
Fill a rectangle at the specified coordinates.
Examples:
# fill image using context color rect = [0, 0, im.width, im.height] im.fill_rect rect # fill top-left quarter of image with green color = Imlib2::Color::GREEN im.fill_rect [0, 0], [im.width / 2, im.height / 2], color
# fill square from 10, 10 to 30, 30 using context color im.fill_rect [10, 10, 20, 20]
| fill_rectangle(int argc, VALUE *argv, VALUE self) |
Fill a rectangle at the specified coordinates.
Examples:
# fill image using context color rect = [0, 0, im.width, im.height] im.fill_rect rect # fill top-left quarter of image with green color = Imlib2::Color::GREEN im.fill_rect [0, 0], [im.width / 2, im.height / 2], color
# fill square from 10, 10 to 30, 30 using context color im.fill_rect [10, 10, 20, 20]
| copy_alpha(int argc, VALUE *argv, VALUE self) |
Copy the alpha channel from the source image to the specified coordinates
Examples:
image.copy_alpha source_image, 10, 10 image.copy_alpha source_image, [10, 10]
| copy_alpha_rect(int argc, VALUE *argv, VALUE self) |
Copy the alpha channel from a rectangle of the source image to the specified coordinates
Examples:
x, y, w, h = 10, 20, 100, 200 dest_x, dest_y = 5, 10 image.copy_alpha_rect source_image, x, y, w, h, dest_x, dest_y source_rect = [10, 20, 100, 200] dest_coords = [5, 10] image.copy_alpha_rect source_image, source_rect, dest_coords
values = [10, 20, 100, 200, 5, 10] image.copy_alpha_rect source_image, values
| scroll_rect(int argc, VALUE *argv, VALUE self) |
Scroll a rectangle to the specified coordinates
Examples:
x, y, w, h = 10, 20, 100, 200 dest_x, dest_y = 5, 10 image.scroll_rect x, y, w, h, dest_x, dest_y source_rect = [10, 20, 100, 200] dest_coords = [5, 10] image.scroll_rect source_rect, dest_coords
values = [10, 20, 100, 200, 5, 10] image.scroll_rect values
| copy_rect(int argc, VALUE *argv, VALUE self) |
Copy a rectangle to the specified coordinates
Examples:
x, y, w, h = 10, 20, 100, 200 dest_x, dest_y = 5, 10 image.copy_rect x, y, w, h, dest_x, dest_y source_rect = [10, 20, 100, 200] dest_coords = [5, 10] image.copy_rect source_rect, dest_coords
values = [10, 20, 100, 200, 5, 10] image.copy_rect values
| draw_ellipse(int argc, VALUE *argv, VALUE self) |
Draw an ellipse at the specified coordinates with the given color
Examples:
# draw an ellipse in the center of the image using the context color xc, yc, w, h = image.w / 2, image.h / 2, image.w / 2, image.h / 2 image.draw_oval xc, yc, w, h # draw a violet circle in the center of the image rect = [image.w / 2, image.h / 2, image.w / 2, image.w / 2] color = Imlib2::Color::VIOLET image.draw_ellipse rect, color
| draw_oval(int argc, VALUE *argv, VALUE self) |
Draw an ellipse at the specified coordinates with the given color
Examples:
# draw an ellipse in the center of the image using the context color xc, yc, w, h = image.w / 2, image.h / 2, image.w / 2, image.h / 2 image.draw_oval xc, yc, w, h # draw a violet circle in the center of the image rect = [image.w / 2, image.h / 2, image.w / 2, image.w / 2] color = Imlib2::Color::VIOLET image.draw_ellipse rect, color
| fill_ellipse(int argc, VALUE *argv, VALUE self) |
Fill an ellipse at the specified coordinates with the given color
Examples:
# fill an ellipse in the center of the image using the context color xc, yc, w, h = image.w / 2, image.h / 2, image.w / 2, image.h / 2 image.draw_oval xc, yc, w, h # fill a violet circle in the center of the image rect = [image.w / 2, image.h / 2, image.w / 2, image.w / 2] color = Imlib2::Color::VIOLET image.draw_ellipse rect, color
| fill_oval(int argc, VALUE *argv, VALUE self) |
Fill an ellipse at the specified coordinates with the given color
Examples:
# fill an ellipse in the center of the image using the context color xc, yc, w, h = image.w / 2, image.h / 2, image.w / 2, image.h / 2 image.draw_oval xc, yc, w, h # fill a violet circle in the center of the image rect = [image.w / 2, image.h / 2, image.w / 2, image.w / 2] color = Imlib2::Color::VIOLET image.draw_ellipse rect, color
| draw_text(int argc, VALUE *argv, VALUE self) |
Draw a string with the given Imlib2::Font at the specified coordinates
Examples:
font = Imlib2::Font.new 'helvetica/12' string = 'the blue crow flies at midnight' image.draw_text font, string, 10, 10 # draw text in a specified color font = Imlib2::Font.new 'helvetica/12' string = 'the blue crow flies at midnight' color = Imlib2::Color::AQUA image.draw_text font, string, 10, 10, color
# draw text in a specified direction
font = Imlib2::Font.new 'verdana/24'
string = 'the blue crow flies at midnight'
color = Imlib2::Color::YELLOW
direction = Imlib2::Direction::DOWN
image.draw_text font, string, 10, 10, color, direction
# draw text with return metrics
font = Imlib2::Font.new 'arial/36'
string = 'the blue crow flies at midnight'
color = Imlib2::Color::PURPLE
direction = Imlib2::Direction::LEFT
metrics = image.draw_text font, string, 10, 10, color, direction
['width', 'height', 'horiz_advance', 'vert_advance'].each_index { |i, v|
puts v << ' = ' << metrics[i]
}
| gradient(int argc, VALUE *argv, VALUE self) |
Fill a rectangle with the given Imlib2::Gradient at a given angle
Examples:
x, y, w, h = 10, 10, image.width - 20, image.height - 20 angle = 45.2 image.fill_gradient gradient, x, y, w, h, angle rect = [5, 5, 500, 20] image.gradient gradient, rect, 36.8
| fill_gradient(int argc, VALUE *argv, VALUE self) |
Fill a rectangle with the given Imlib2::Gradient at a given angle
Examples:
x, y, w, h = 10, 10, image.width - 20, image.height - 20 angle = 45.2 image.fill_gradient gradient, x, y, w, h, angle rect = [5, 5, 500, 20] image.gradient gradient, rect, 36.8
| color_range(int argc, VALUE *argv, VALUE self) |
Fill a rectangle with the given Imlib2::Gradient at a given angle
Examples:
x, y, w, h = 10, 10, image.width - 20, image.height - 20 angle = 45.2 image.fill_gradient gradient, x, y, w, h, angle rect = [5, 5, 500, 20] image.gradient gradient, rect, 36.8
| fill_color_range(int argc, VALUE *argv, VALUE self) |
Fill a rectangle with the given Imlib2::Gradient at a given angle
Examples:
x, y, w, h = 10, 10, image.width - 20, image.height - 20 angle = 45.2 image.fill_gradient gradient, x, y, w, h, angle rect = [5, 5, 500, 20] image.gradient gradient, rect, 36.8
| draw_poly(int argc, VALUE *argv, VALUE self) |
Draw an Imlib2::Polygon with the specified color
Examples:
# create a simple blue right triangle triangle = Imlib2::Polygon.new [10, 10], [20, 20], [10, 20] image.draw_polygon triangle, Imlib2::Color::BLUE # create an open red square polygon square = Imlib2.Polygon.new [10, 10], [20, 10], [20, 20], [10, 20] image.draw_poly square, false, Imlib2::Color::RED
| draw_polygon(int argc, VALUE *argv, VALUE self) |
Draw an Imlib2::Polygon with the specified color
Examples:
# create a simple blue right triangle triangle = Imlib2::Polygon.new [10, 10], [20, 20], [10, 20] image.draw_polygon triangle, Imlib2::Color::BLUE # create an open red square polygon square = Imlib2.Polygon.new [10, 10], [20, 10], [20, 20], [10, 20] image.draw_poly square, false, Imlib2::Color::RED
| fill_poly(int argc, VALUE *argv, VALUE self) |
Fill an Imlib2::Polygon with the specified color
Examples:
# create an filled green diamond polygon square = Imlib2.Polygon.new [50, 10], [70, 30], [50, 50], [30, 30] image.fill_poly square, false, Imlib2::Color::GREEN
| fill_polygon(int argc, VALUE *argv, VALUE self) |
Fill an Imlib2::Polygon with the specified color
Examples:
# create an filled green diamond polygon square = Imlib2.Polygon.new [50, 10], [70, 30], [50, 50], [30, 30] image.fill_poly square, false, Imlib2::Color::GREEN
| blend!(int argc, VALUE *argv, VALUE self) |
Blend a source image onto the image
Examples:
src_x, src_y, src_w, src_h = 10, 10, 100, 100
dst_x, dst_y, dst_w, dst_h = 10, 10, 50, 50
image.blend! source_image,
src_x, src_y, src_w, src_h,
dst_x, dst_y, dst_w, dst_h
src_rect = [50, 50, 5, 5]
dst_rect = [0, 0, image.width, image.height]
merge_alpha = false
image.blend! source_image, src_rect, dst_rect, merge_alpha
src_x, src_y, src_w, src_h = 10, 10, 100, 100
dst_x, dst_y, dst_w, dst_h = 10, 10, 50, 50
image.blend_image! source_image,
src_x, src_y, src_w, src_h,
dst_x, dst_y, dst_w, dst_h
src_rect = [50, 50, 5, 5]
dst_rect = [0, 0, image.width, image.height]
merge_alpha = false
image.blend_image! source_image, src_rect, dst_rect, merge_alpha
| blend_image!(int argc, VALUE *argv, VALUE self) |
Blend a source image onto the image
Examples:
src_x, src_y, src_w, src_h = 10, 10, 100, 100
dst_x, dst_y, dst_w, dst_h = 10, 10, 50, 50
image.blend! source_image,
src_x, src_y, src_w, src_h,
dst_x, dst_y, dst_w, dst_h
src_rect = [50, 50, 5, 5]
dst_rect = [0, 0, image.width, image.height]
merge_alpha = false
image.blend! source_image, src_rect, dst_rect, merge_alpha
src_x, src_y, src_w, src_h = 10, 10, 100, 100
dst_x, dst_y, dst_w, dst_h = 10, 10, 50, 50
image.blend_image! source_image,
src_x, src_y, src_w, src_h,
dst_x, dst_y, dst_w, dst_h
src_rect = [50, 50, 5, 5]
dst_rect = [0, 0, image.width, image.height]
merge_alpha = false
image.blend_image! source_image, src_rect, dst_rect, merge_alpha
| blend(int argc, VALUE *argv, VALUE self) |
Return a copy of the image with the a portion of the source image blended at the specified rectangle.
Examples:
src_x, src_y, src_w, src_h = 10, 10, 100, 100
dst_x, dst_y, dst_w, dst_h = 10, 10, 50, 50
image.blend source_image,
src_x, src_y, src_w, src_h,
dst_x, dst_y, dst_w, dst_h
src_rect = [50, 50, 5, 5]
dst_rect = [0, 0, image.width, image.height]
merge_alpha = false
image.blend source_image, src_rect, dst_rect, merge_alpha
src_x, src_y, src_w, src_h = 10, 10, 100, 100
dst_x, dst_y, dst_w, dst_h = 10, 10, 50, 50
image.blend_image source_image,
src_x, src_y, src_w, src_h,
dst_x, dst_y, dst_w, dst_h
src_rect = [50, 50, 5, 5]
dst_rect = [0, 0, image.width, image.height]
merge_alpha = false
image.blend_image source_image, src_rect, dst_rect, merge_alpha
| blend_image(int argc, VALUE *argv, VALUE self) |
Return a copy of the image with the a portion of the source image blended at the specified rectangle.
Examples:
src_x, src_y, src_w, src_h = 10, 10, 100, 100
dst_x, dst_y, dst_w, dst_h = 10, 10, 50, 50
image.blend source_image,
src_x, src_y, src_w, src_h,
dst_x, dst_y, dst_w, dst_h
src_rect = [50, 50, 5, 5]
dst_rect = [0, 0, image.width, image.height]
merge_alpha = false
image.blend source_image, src_rect, dst_rect, merge_alpha
src_x, src_y, src_w, src_h = 10, 10, 100, 100
dst_x, dst_y, dst_w, dst_h = 10, 10, 50, 50
image.blend_image source_image,
src_x, src_y, src_w, src_h,
dst_x, dst_y, dst_w, dst_h
src_rect = [50, 50, 5, 5]
dst_rect = [0, 0, image.width, image.height]
merge_alpha = false
image.blend_image source_image, src_rect, dst_rect, merge_alpha
| rotate(VALUE self, VALUE angle) |
Return a rotated copy of the image
Examples:
new_image = old_image.rotate 37.2
| rotate!(VALUE self, VALUE angle) |
Rotates the image
Examples:
image.rotate! 37.2
| clone(VALUE self) |
| dup(VALUE self) |
| clear(VALUE self) |
Clear the contents of an image
Examples:
image.clear
| clear_color(VALUE self, VALUE rgba_color) |
I'm honestly not quite sure what this function does, but I wrapped it anyway.
| clear_color!(VALUE self, VALUE rgba_color) |
I'm honestly not quite sure what this function does, but I wrapped it anyway.
| filter(VALUE self, VALUE filter) |
Apply a scripted filter or a static (eg Imlib2::Filter) filter
Example:
# apply a static filter
filter = Imlib2::Filter.new 20
filter.set 2, 2, Imlib2::Color::GREEN
image.filter filter
# apply a scripted filter
x, y = 20, 10
filter_string = "tint( x=#{x}, y=#{y}, red=255, alpha=55 );"
image.filter filter_string
| apply_filter(VALUE self, VALUE filter) |
Apply a scripted filter or a static (eg Imlib2::Filter) filter
Example:
# apply a static filter
filter = Imlib2::Filter.new 20
filter.set 2, 2, Imlib2::Color::GREEN
image.filter filter
# apply a scripted filter
x, y = 20, 10
filter_string = "tint( x=#{x}, y=#{y}, red=255, alpha=55 );"
image.filter filter_string
| static_filter(VALUE self, VALUE filter) |
Apply an Imlib2::Filter (eg a static filter)
You should probably using Imlib2::Image#filter() instead, since it is polymorphic (eg, it can handle both static and scripted filters).
Example:
filter = Imlib2::Filter.new 20 filter.set 2, 2, Imlib2::Color::GREEN image.static_filter filter
| script_filter(VALUE self, VALUE filter) |
Apply a scripted filter
You should probably using Imlib2::Image#filter() instead, since it is polymorphic (eg, it can handle both static and scripted filters).
Example:
x, y = 20, 10
filter_string = "tint( x=#{x}, y=#{y}, red=255, alpha=55 );"
image.script_filter filter_string
| apply_color_modifier(int argc, VALUE *argv, VALUE self) |
Apply an Imlib2::ColorModifier to the image
Examples:
# modify the contrast of the entire image cmod = Imlib2::ColorModifier.new cmod.contrast = 1.5 image.apply_cmod color_mod # adjust the gamma of the given rect cmod = Imlib2::ColorModifier.new cmod.gamma = 0.5 rect = [10, 10, 20, 40] image.apply_color_modifier cmod, rect
| apply_cmod(int argc, VALUE *argv, VALUE self) |
Apply an Imlib2::ColorModifier to the image
Examples:
# modify the contrast of the entire image cmod = Imlib2::ColorModifier.new cmod.contrast = 1.5 image.apply_cmod color_mod # adjust the gamma of the given rect cmod = Imlib2::ColorModifier.new cmod.gamma = 0.5 rect = [10, 10, 20, 40] image.apply_color_modifier cmod, rect
| apply(int argc, VALUE *argv, VALUE self) |
Apply an Imlib2::ColorModifier to the image
Examples:
# modify the contrast of the entire image cmod = Imlib2::ColorModifier.new cmod.contrast = 1.5 image.apply_cmod color_mod # adjust the gamma of the given rect cmod = Imlib2::ColorModifier.new cmod.gamma = 0.5 rect = [10, 10, 20, 40] image.apply_color_modifier cmod, rect
| render_pixmap(...) |
| pixmap(...) |
| render_on_drawable(...) |
| copy_drawable(...) |
| blend_drawable(...) |
| render_on_drawable_skewed(...) |
| render_on_drawable_at_angle(...) |