pdf-core 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pdf/core/graphics_state.rb +30 -8
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1db7a454bf4818e0320591f85425fba5c81d83c
|
4
|
+
data.tar.gz: 35ddcc1adc2c2649d54d416c0f29d9f9b46ed837
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c1b1717b67cdec541fe441231f28a56e7d46f09a9d050c99d6b0f9b8332abdc210f03b633c13ded533ca6969a5813c65ab3f37f0e36847edad5e19f90ac1889
|
7
|
+
data.tar.gz: c83828520b846dd237afe54d0d7e578a965e536434d8fc8e30b6d060bfcf42851ad1804a7d207d619c3a98662c607ee897315d7ecb29efd4e8dec360d75d4917
|
@@ -43,17 +43,23 @@ module PDF
|
|
43
43
|
|
44
44
|
end
|
45
45
|
|
46
|
+
# NOTE: This class may be a good candidate for a copy-on-write hash.
|
46
47
|
class GraphicState
|
47
|
-
attr_accessor :color_space, :dash, :cap_style, :join_style, :line_width,
|
48
|
+
attr_accessor :color_space, :dash, :cap_style, :join_style, :line_width,
|
49
|
+
:fill_color, :stroke_color
|
48
50
|
|
49
51
|
def initialize(previous_state = nil)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
if previous_state
|
53
|
+
initialize_copy(previous_state)
|
54
|
+
else
|
55
|
+
@color_space = {}
|
56
|
+
@fill_color = "000000"
|
57
|
+
@stroke_color = "000000"
|
58
|
+
@dash = { :dash => nil, :space => nil, :phase => 0 }
|
59
|
+
@cap_style = :butt
|
60
|
+
@join_style = :miter
|
61
|
+
@line_width = 1
|
62
|
+
end
|
57
63
|
end
|
58
64
|
|
59
65
|
def dash_setting
|
@@ -63,6 +69,22 @@ module PDF
|
|
63
69
|
"[#{@dash[:dash]} #{@dash[:space]}] #{@dash[:phase]} d"
|
64
70
|
end
|
65
71
|
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def initialize_copy(other)
|
76
|
+
# mutable state
|
77
|
+
@color_space = other.color_space.dup
|
78
|
+
@fill_color = other.fill_color.dup
|
79
|
+
@stroke_color = other.stroke_color.dup
|
80
|
+
@dash = other.dash.dup
|
81
|
+
|
82
|
+
# immutable state that doesn't need to be duped
|
83
|
+
@cap_style = other.cap_style
|
84
|
+
@join_style = other.join_style
|
85
|
+
@line_width = other.line_width
|
86
|
+
end
|
66
87
|
end
|
67
88
|
end
|
68
89
|
end
|
90
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdf-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Brown
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2014-01-19 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: pdf-reader
|
@@ -138,3 +138,4 @@ signing_key:
|
|
138
138
|
specification_version: 4
|
139
139
|
summary: PDF::Core is used by Prawn to render PDF documents
|
140
140
|
test_files: []
|
141
|
+
has_rdoc:
|