rghost 0.8.6.1 → 0.8.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rghost/color.rb CHANGED
@@ -24,6 +24,9 @@ class RGhost::Color < RGhost::PsObject
24
24
  # Color.create :cyan=> 1 ,:magenta => 0.3, :yellow => 0, :black => 0
25
25
  #Hash with 4 pair of key/value. Valids keys :c, :m, :y and :b
26
26
  # Color.create :c=> 1 ,:m => 0.3, :y => 0, :b => 0
27
+ #====Creating CMYK Spot color
28
+ #Hash with 5 pair of key/value. Valids keys :cyan, :magenta, :yellow, :black, and :name
29
+ # Color.create :cyan=> 0, :magenta => 100, :yellow => 63, :black => 12, :name => 'Pantone 200 C'
27
30
  #====Creating Gray color
28
31
  #A single Numeric
29
32
  # Color.create 0.5
@@ -43,6 +46,8 @@ class RGhost::Color < RGhost::PsObject
43
46
  RGhost::RGB.new(color)
44
47
  elsif color.size == 4
45
48
  RGhost::CMYK.new(color)
49
+ elsif color.size == 5
50
+ RGhost::CMYKSpot.new(color)
46
51
  else
47
52
  raise ArgumentError.new("#{color}##{color.class}")
48
53
  end
@@ -120,16 +125,36 @@ class RGhost::CMYK < RGhost::Color
120
125
  end
121
126
 
122
127
  def ps
123
-
124
128
  value=case @color
125
- when Hash: [@color[:cyan] || @color[:c],@color[:magenta] || @color[:m],@color[:yellow] || @color[:y],@color[:black] || @color[:k]]
126
- when Array: @color
129
+ when Hash: [@color[:cyan] || @color[:c],@color[:magenta] || @color[:m],@color[:yellow] || @color[:y],@color[:black] || @color[:k]]
130
+ when Array: @color
127
131
  end
132
+
128
133
  array_to_stack(value.map{|n| n > 1 ? n/100.0: n})+"setcmykcolor"
129
-
130
134
  end
131
135
 
132
136
  end
137
+
138
+ #Creates CMYK Spot color space
139
+ class RGhost::CMYKSpot < RGhost::Color
140
+ attr_accessor :cyan ,:magenta, :yellow, :black, :name
141
+
142
+ def initialize(color={:name => 'spot', :cyan=> 1 ,:magenta => 0, :yellow => 0, :black => 0})
143
+ @name = color[:name]
144
+ color.delete(:name)
145
+ @color = color
146
+ end
147
+
148
+ def ps
149
+ value=case @color
150
+ when Hash: [@color[:cyan] || @color[:c],@color[:magenta] || @color[:m],@color[:yellow] || @color[:y],@color[:black] || @color[:k]]
151
+ when Array: @color
152
+ end
153
+
154
+ array_to_stack(value.map{|n| n > 1 ? n/100.0: n}) + "(#{@name.to_s}) findcmykcustomcolor \n/#{@name.to_s.gsub(' ', '_')} exch def\n\n#{@name.to_s.gsub(' ', '_')} 1 setcustomcolor"
155
+ end
156
+ end
157
+
133
158
  #Creates Gray color
134
159
  class RGhost::Gray < RGhost::Color
135
160
  attr_accessor :gray
@@ -480,7 +480,7 @@ class RGhost::Document < RGhost::PsFacade
480
480
  #Creates Grid::Rails inside of the document. Facade to RGhost::Grid::Rails
481
481
  def rails_grid(default_columns_options={})
482
482
 
483
- grid=Grid::Rails.new(default_columns_options)
483
+ grid=RGhost::Grid::Rails.new(default_columns_options)
484
484
  yield grid
485
485
  grid.style(default_columns_options[:style]) if default_columns_options[:style]
486
486
  grid.data(default_columns_options[:data]) if default_columns_options[:data]
@@ -489,7 +489,7 @@ class RGhost::Document < RGhost::PsFacade
489
489
  end
490
490
  #Creates Grid::CSV inside of the document. Facade to RGhost::Grid::CSV
491
491
  def csv_grid(default_columns_options={})
492
- grid=Grid::CSV.new(default_columns_options)
492
+ grid=RGhost::Grid::CSV.new(default_columns_options)
493
493
  yield grid
494
494
  grid.style(default_columns_options[:style]) if default_columns_options[:style]
495
495
  grid.data(default_columns_options[:data]) if default_columns_options[:data]
@@ -497,7 +497,7 @@ class RGhost::Document < RGhost::PsFacade
497
497
  end
498
498
  #Creates Grid::Matrix inside of the document. Facade to RGhost::Grid::Matrix
499
499
  def matrix_grid(default_columns_options={})
500
- grid=Grid::Matrix.new(default_columns_options)
500
+ grid=RGhost::Grid::Matrix.new(default_columns_options)
501
501
  yield grid
502
502
  grid.style(default_columns_options[:style]) if default_columns_options[:style]
503
503
  set grid
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rghost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6.1
4
+ version: 0.8.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shairon Toledo
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-02 00:00:00 -05:00
12
+ date: 2009-01-08 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -31,7 +31,6 @@ files:
31
31
  - lib/rghost/convert.rb
32
32
  - lib/rghost/cursor.rb
33
33
  - lib/rghost/dash.rb
34
- - lib/rghost/doc
35
34
  - lib/rghost/document.rb
36
35
  - lib/rghost/document_callback_facade.rb
37
36
  - lib/rghost/dsc_entry.rb
@@ -76,7 +75,6 @@ files:
76
75
  - lib/rghost/point_with_command.rb
77
76
  - lib/rghost/polygon.rb
78
77
  - lib/rghost/ps
79
- - lib/rghost/ps/__datagrid.ps
80
78
  - lib/rghost/ps/_cusor.ps
81
79
  - lib/rghost/ps/AdobeExpert.enc
82
80
  - lib/rghost/ps/AdobeLatinEncoding.enc
@@ -1,52 +0,0 @@
1
- /col_padding 0.1 cm def
2
-
3
- /st_center{ exch strlen 3 -1 roll sub -2 div dup 0 rmoveto exch show 0 rmoveto } def
4
- /st_right{ exch strlen 3 -1 roll X add sub neg col_padding sub current_row moveto show col_padding 0 rmoveto } def
5
- /st_left{ X add exch X col_padding add current_row moveto show current_row moveto }def
6
-
7
- /col 0 def
8
- /current_table_row 0 def %current row table
9
- /nextcol{ /col inc } def
10
-
11
- /headings? true def
12
-
13
- /header_proc {
14
- new_page? {
15
- %before_row_create callback_row
16
- before_header_create
17
- header_titles {
18
- before_column_header callback_col
19
- headings? {
20
- table_header col get aload pop cvx exec nextcol
21
-
22
- }{ pop } ifelse
23
- after_column_header callback_col
24
- } forall
25
- after_header_create
26
- after_row
27
- /new_page? false def
28
- }if
29
- } def
30
-
31
- /after_row{
32
- /current_table_row inc
33
- /col 0 def
34
- next_row
35
- new_current_row_point
36
- limit_left current_row moveto
37
- }def
38
-
39
- /table_proc {
40
- {limit_left current_row moveto
41
- header_proc
42
- before_row callback_row
43
- row_odd_or_even callback_row
44
- {
45
- before_column callback_col
46
- table_params col get aload pop cvx exec nextcol
47
- after_column callback_col
48
- } forall
49
- after_row
50
- } forall
51
- after_table_create
52
- }bind def