Class: RGhost::Circle

Inherits:
PsObject show all
Defined in:
lib/rghost/circle.rb

Overview

Constant Summary collapse

DEFAULT_OPTIONS =
{
:x => :limit_left,
:y=> :current_row,
:radius => 50, 
:ang1 => 0, 
:ang2 => 360 , 
:use => :arc, 
:content => RGhost::ShapeContent::DEFAULT_OPTIONS,
:border =>  RGhost::Border::DEFAULT_OPTIONS
}

Instance Method Summary collapse

Methods inherited from PsObject

#<<, #call, #graphic_scope, #raw, #set, #to_s

Constructor Details

#initialize(options = {}) ⇒ Circle

Returns a new instance of Circle.



83
84
85
86
# File 'lib/rghost/circle.rb', line 83

def initialize(options={})
  super(''){}
    @options=DEFAULT_OPTIONS.dup.merge(options)
end

Instance Method Details

#psObject



88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/rghost/circle.rb', line 88

def ps
  
  x,y= RGhost::Units::parse(@options[:x]), RGhost::Units::parse(@options[:y]) #with parse
  
  graph=RGhost::Graphic.new
  graph.raw :newpath
  graph.set RGhost::Border.new(@options[:border]) if @options[:border]
  graph.raw  "#{x} #{y} #{@options[:radius]} #{@options[:ang1]} #{@options[:ang2]} #{@options[:use]} " 
  graph.set RGhost::ShapeContent.new(@options[:content]) if @options[:content]
  graph.raw :stroke
  graph

end