Class: Compass::Canvas::Backend::Interface::Context
- Inherits:
-
Base
- Object
- Sass::Script::Literal
- Base
- Compass::Canvas::Backend::Interface::Context
- Defined in:
- lib/canvas/backend/interface/context.rb
Overview
Interface Context class.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#antialias(type) ⇒ Object
Unpacks argument
type
from Sass to a Ruby object. -
#fill_rule(type) ⇒ Object
Unpacks argument
type
from Sass to a Ruby object. -
#line_cap(type) ⇒ Object
Unpacks argument
type
from Sass to a Ruby object. -
#line_join(type) ⇒ Object
Unpacks argument
type
from Sass to a Ruby object. -
#line_width(width) ⇒ Object
Unpacks argument
width
from Sass to a Ruby object. -
#miter_limit(limit) ⇒ Object
Unpacks argument
limit
from Sass to a Ruby object. -
#rotate(angle) ⇒ Object
Unpacks argument
angle
from Sass to a Ruby object. -
#scale(x, y) ⇒ Object
Unpacks arguments
X
andY
from Sass to Ruby objects. - #slow_blur(*args) ⇒ Object
-
#tolerance(level) ⇒ Object
Unpacks argument
level
from Sass to a Ruby object. -
#transform(xx, yx, xy, yy, x0, y0) ⇒ Object
Unpacks matrix arguments from Sass to Ruby objects.
-
#translate(x, y) ⇒ Object
Unpacks arguments
X
andY
from Sass to Ruby objects.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Compass::Canvas::Backend::Interface::Base
Instance Method Details
#antialias(type) ⇒ Object
Unpacks argument type
from Sass to a Ruby object.
25 26 27 28 29 30 31 |
# File 'lib/canvas/backend/interface/context.rb', line 25 def antialias(type) if type.is_a?(Sass::Script::Color) [type.to_s] else [type.value] end end |
#fill_rule(type) ⇒ Object
Unpacks argument type
from Sass to a Ruby object.
34 35 36 |
# File 'lib/canvas/backend/interface/context.rb', line 34 def fill_rule(type) [type.value] end |
#line_cap(type) ⇒ Object
Unpacks argument type
from Sass to a Ruby object.
10 11 12 |
# File 'lib/canvas/backend/interface/context.rb', line 10 def line_cap(type) [type.value] end |
#line_join(type) ⇒ Object
Unpacks argument type
from Sass to a Ruby object.
15 16 17 |
# File 'lib/canvas/backend/interface/context.rb', line 15 def line_join(type) [type.value] end |
#line_width(width) ⇒ Object
Unpacks argument width
from Sass to a Ruby object.
5 6 7 |
# File 'lib/canvas/backend/interface/context.rb', line 5 def line_width(width) [width.value] end |
#miter_limit(limit) ⇒ Object
Unpacks argument limit
from Sass to a Ruby object.
20 21 22 |
# File 'lib/canvas/backend/interface/context.rb', line 20 def miter_limit(limit) [limit.value] end |
#rotate(angle) ⇒ Object
Unpacks argument angle
from Sass to a Ruby object.
54 55 56 |
# File 'lib/canvas/backend/interface/context.rb', line 54 def rotate(angle) [angle.value * (Math::PI / 180.0)] end |
#scale(x, y) ⇒ Object
Unpacks arguments X
and Y
from Sass to Ruby objects.
49 50 51 |
# File 'lib/canvas/backend/interface/context.rb', line 49 def scale(x, y) [x.value, y.value] end |
#slow_blur(*args) ⇒ Object
63 64 65 66 |
# File 'lib/canvas/backend/interface/context.rb', line 63 def slow_blur(*args) radius = args.shift.value [radius].concat(Compass::Canvas::Functions.unpack(args).flatten) end |
#tolerance(level) ⇒ Object
Unpacks argument level
from Sass to a Ruby object.
39 40 41 |
# File 'lib/canvas/backend/interface/context.rb', line 39 def tolerance(level) [level.value] end |
#transform(xx, yx, xy, yy, x0, y0) ⇒ Object
Unpacks matrix arguments from Sass to Ruby objects.
59 60 61 |
# File 'lib/canvas/backend/interface/context.rb', line 59 def transform(xx, yx, xy, yy, x0, y0) [xx.value, yx.value, xy.value, yy.value, x0.value, y0.value] end |
#translate(x, y) ⇒ Object
Unpacks arguments X
and Y
from Sass to Ruby objects.
44 45 46 |
# File 'lib/canvas/backend/interface/context.rb', line 44 def translate(x, y) [x.value, y.value] end |