class CTioga2::Graphics::Styles::ImageStyle
This class represents the style for an image
Public Instance Methods
draw_image(t, file, tl, br)
click to toggle source
Draws an image according to this
# File lib/ctioga2/graphics/styles/image.rb, line 56 def draw_image(t, file, tl, br) info = t.jpg_info(file) if ! info info = t.load_png(file) end r = Types::Rect.new(tl, br) ul, ll, lr = r.make_corners(t, (@auto_rotate == nil ? true : @auto_rotate), @aspect_ratio || :ignore, info['width']*1.0/info['height']) dict = info.dup dict.merge!('ul' => ul, 'll' => ll, 'lr' => lr) # @todo provide a way to reuse images ? t.context do if @transparency t.fill_opacity = 1 - @transparency end t.show_image(dict) end end