Sha256: 21325bad9c71eeb5f7963eb26a1edb77b54cb7a4bc3e31d1c82960cf9b2f13a5
Contents?: true
Size: 970 Bytes
Versions: 1
Compression:
Stored size: 970 Bytes
Contents
module Dedalus module Elements class Image < Dedalus::Atom attr_accessor :path, :padding, :z_order, :invert_x, :invert_y def render x,y = *position x_scale = invert_x ? -scale : scale y_scale = invert_y ? -scale : scale asset.draw(x + padding, y + padding, z_order, x_scale, y_scale) end def z_order @z_order ||= ZOrder::Foreground end def width 2*padding + (asset.width * scale) end def height 2*padding + (asset.height * scale) end def dimensions [ width, height ] end def padding @padding ||= 0.0 end def scale @scale ||= 1.0 end def self.example_data { path: "media/images/cosmos.jpg", scale: 0.2 } end def self.description "an image" end def asset @asset ||= Dedalus::ImageRepository.lookup(path) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dedalus-0.2.5 | lib/dedalus/elements/image.rb |