Class: Ray::ImageTarget
- Defined in:
- lib/ray/image_target.rb,
ext/image_target.c
Class Method Summary collapse
-
.available? ⇒ true, false
True when ImageTargets are available.
-
.unbind ⇒ Object
Unbinds any image target.
Instance Method Summary collapse
-
#bind ⇒ Object
Binds an image target to draw directly on it.
-
#image ⇒ Ray::Image
Image the target draws on.
- #image=(img) ⇒ Object
-
#initialize(image = nil) ⇒ ImageTarget
constructor
A new instance of ImageTarget.
-
#update ⇒ Object
Updates the content of the image target.
Methods inherited from Target
#[], #clear, #clip, #default_view, #draw, #make_current, #rect, #shader, #size, #to_image, #turtle, #view, #view=, #viewport_for, #with_view
Constructor Details
#initialize(image = nil) ⇒ ImageTarget
Returns a new instance of ImageTarget.
4 5 6 7 8 9 10 |
# File 'lib/ray/image_target.rb', line 4 def initialize(image = nil) self.image = image if image if block_given? yield self end end |
Class Method Details
.available? ⇒ true, false
Returns True when ImageTargets are available.
68 69 70 |
# File 'ext/image_target.c', line 68 VALUE ray_image_target_available(VALUE self) { return say_image_target_is_available() ? Qtrue : Qfalse; } |
.unbind ⇒ Object
Unbinds any image target. This is mostly not needed, as making a window the current target will call this automatically.
55 56 57 58 59 60 61 62 63 |
# File 'ext/image_target.c', line 55
VALUE ray_image_target_unbind(VALUE self) {
/*
* No need for an error when this is not supported, because it just means
* we don't need to unbind anything.
*/
if (say_image_target_is_available())
say_image_target_unbind();
return Qnil;
}
|
Instance Method Details
#bind ⇒ Object
Binds an image target to draw directly on it
46 47 48 49 |
# File 'ext/image_target.c', line 46 VALUE ray_image_target_bind(VALUE self) { say_image_target_bind(ray_rb2image_target(self)); return self; } |
#image ⇒ Ray::Image
Returns image the target draws on.
35 36 37 |
# File 'ext/image_target.c', line 35 VALUE ray_image_target_image(VALUE self) { return rb_iv_get(self, "@image"); } |
#image=(img) ⇒ Object
27 28 29 30 31 32 |
# File 'ext/image_target.c', line 27
VALUE ray_image_target_set_image(VALUE self, VALUE img) {
rb_check_frozen(self);
say_image_target_set_image(ray_rb2image_target(self), ray_rb2image(img));
rb_iv_set(self, "@image", img);
return img;
}
|
#update ⇒ Object
Updates the content of the image target
40 41 42 43 |
# File 'ext/image_target.c', line 40 VALUE ray_image_target_update(VALUE self) { say_image_target_update(ray_rb2image_target(self)); return self; } |