File: jpeg.rb

package info (click to toggle)
ruby-rghost 0.9.9-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,188 kB
  • sloc: ruby: 3,374; makefile: 6; sh: 1
file content (34 lines) | stat: -rw-r--r-- 1,095 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require "rghost/ps_object"
require "rghost/graphic"
require "rghost/cursor"
require "rghost/variable"
require "rghost/image"
# Loads JPEG image from file
#===Examples
# doc=Document.new
# doc.set Jpeg.new "../public/images/button.jpg", :x => 10, :y => 3
# Using Image.for facade
# doc.set Image.for "../public/images/button.jpg", :x => 10, :y => 3
# Using PsFacade or Document
# doc.image "images/button.jpg", :x => 10, :y => 3
# Using Zoom of the 200 percent
# doc.image "images/button.jpg", :zoom => 200
#===Options
#
# * <tt>:x and :y</tt> - Coordinates to position.
# * <tt>:rotate</tt> - Angle to image rotation if there is one.
# * <tt>:zoom</tt> - Resize proportionally the image
class RGhost::Jpeg < RGhost::Image
  def ps
    # x=Units::parse( @options[:x] )
    # y=Units::parse( @options[:y] )

    g = RGhost::Graphic.new
    g.set RGhost::Cursor.translate(@options)
    # set Cursor.translate()
    g.set RGhost::Cursor.rotate(@options[:rotate])
    g.set RGhost::Variable.new(:zoom, @options[:zoom] / 100.0)
    g.set RGhost::PsObject.new("(#{@file}) viewJPEG")
    g.ps
  end
end