module Glimmer::Gtk::Transformable
Represents transformable view elements like shapes and drawing_area
Public Class Methods
new(keyword, parent, args, &block)
click to toggle source
Calls superclass method
# File lib/glimmer/gtk/transformable.rb, line 64 def initialize(keyword, parent, args, &block) @transforms = [] super end
Public Instance Methods
apply_transforms(cairo_context, target: )
click to toggle source
applies transform on target type (:shape, :drawing_area, :fill, :stroke, :clip)
# File lib/glimmer/gtk/transformable.rb, line 70 def apply_transforms(cairo_context, target: ) @transforms.each do |transform| operation = transform.first args = transform.last.dup options = args.pop excluded_types = [options[:exclude]].flatten cairo_context.send(operation, *args) if !excluded_types.include?(target) end end
rotate(angle, options = {})
click to toggle source
# File lib/glimmer/gtk/transformable.rb, line 88 def rotate(angle, options = {}) @transforms << [:rotate, [angle, options]] end
scale(x, y, options = {})
click to toggle source
# File lib/glimmer/gtk/transformable.rb, line 84 def scale(x, y, options = {}) @transforms << [:scale, [x, y, options]] end
translate(x, y, options = {})
click to toggle source
# File lib/glimmer/gtk/transformable.rb, line 80 def translate(x, y, options = {}) @transforms << [:translate, [x, y, options]] end