File: shape_content.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 (21 lines) | stat: -rw-r--r-- 526 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
# Responsible for fill shapes
class RGhost::ShapeContent < RGhost::PsObject
  DEFAULT_OPTIONS = {
    fill: true, color: "#F0FFFF"

  }
  # You can use parameter :color(facade for Color.create) or disable using :fill => false
  def initialize(options = {})
    super("") {}
    @options = DEFAULT_OPTIONS.dup.merge(options)
  end

  def ps
    p = RGhost::PsObject.new
    p.raw :gsave
    p.set RGhost::Color.create(@options[:color]) if @options[:color]
    p.raw :fill if @options[:fill]
    p.raw :grestore
    p
  end
end