public
Description: Fast, Nimble PDF Writer for Ruby
Homepage: http://prawn.majesticseacreature.com
Clone URL: git://github.com/sandal/prawn.git
Bounding Box API docs [#26]
sandal (author)
Thu Jun 26 16:16:37 -0700 2008
commit  4af5a3de3ace36547c74b700da6f77e556ae821d
tree    1ba33bd7d514a471c2163aaceb72527ed4cce995
parent  ac6f92198b789d69e3623bc5a2fb2db0809134eb
...
69
70
71
 
 
 
 
 
 
 
72
73
74
...
84
85
86
 
87
88
89
90
91
 
92
93
94
95
96
 
97
98
99
100
101
 
102
103
104
105
106
 
107
108
109
110
111
 
112
113
114
115
116
 
117
118
119
120
121
 
122
123
124
125
126
 
127
128
129
130
131
 
132
133
134
135
136
 
137
138
139
140
141
 
142
143
144
145
146
 
147
148
149
150
151
 
152
153
154
155
156
 
157
158
159
160
161
 
162
163
164
165
166
 
167
168
169
170
171
 
172
173
174
...
176
177
178
 
179
180
181
...
69
70
71
72
73
74
75
76
77
78
79
80
81
...
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
...
201
202
203
204
205
206
207
0
@@ -69,6 +69,13 @@ module Prawn
0
       @bounding_box = parent_box
0
     end
0
 
0
+    # A shortcut to produce a bounding box which is mapped to the document's
0
+    # absolute coordinates
0
+    #
0
+    #   pdf.canvas do
0
+    #     pdf.line pdf.bounds.bottom_left, pdf.bounds.top_right
0
+    #   end
0
+    #
0
     def canvas(&block)
0
       bounding_box( [0, page_dimensions[3]], 
0
        :width  => page_dimensions[2], :height => page_dimensions[3], &block)
0
@@ -84,91 +91,109 @@ module Prawn
0
        
0
       # The translated origin (x,y-height) which describes the location
0
       # of the bottom left corner of the bounding box in absolute terms.
0
+      #
0
       def anchor
0
         [@x, @y - height]
0
       end
0
       
0
       # Relative left x-coordinate of the bounding box. (Always 0)
0
+      #
0
       def left
0
         0
0
       end
0
       
0
       # Relative right x-coordinate of the bounding box. (Equal to the box width)
0
+      #
0
       def right
0
         @width
0
       end
0
       
0
       # Relative top y-coordinate of the bounding box. (Equal to the box height)
0
+      #
0
       def top
0
         height
0
       end
0
       
0
       # Relative bottom y-coordinate of the bounding box (Always 0)
0
+      #
0
       def bottom
0
         0
0
       end
0
 
0
       # Relative top-left point of the bounding_box
0
+      #
0
       def top_left
0
         [left,top]
0
       end
0
 
0
       # Relative top-right point of the bounding box
0
+      #
0
       def top_right
0
         [right,top]
0
       end
0
 
0
       # Relative bottom-right point of the bounding box
0
+      #
0
       def bottom_right
0
         [right,bottom]
0
       end
0
 
0
       # Relative bottom-left point of the bounding box
0
+      #
0
       def bottom_left
0
         [left,bottom]
0
       end
0
       
0
       # Absolute left x-coordinate of the bounding box
0
+      #
0
       def absolute_left
0
         @x
0
       end
0
       
0
       # Absolute right x-coordinate of the bounding box
0
+      #
0
       def absolute_right
0
         @x + width
0
       end
0
       
0
       # Absolute top y-coordinate of the bounding box
0
+      #
0
       def absolute_top
0
         @y
0
       end
0
       
0
       # Absolute bottom y-coordinate of the bottom box
0
+      #
0
       def absolute_bottom
0
         @y - height
0
       end
0
 
0
       # Absolute top-left point of the bounding box
0
+      #
0
       def absolute_top_left
0
         [absolute_left, absolute_top]
0
       end
0
 
0
       # Absolute top-right point of the bounding box
0
+      #
0
       def absolute_top_right
0
         [absolute_right, absolute_top]
0
       end
0
 
0
       # Absolute bottom-left point of the bounding box
0
+      #
0
       def absolute_bottom_left
0
         [absolute_left, absolute_bottom]
0
       end
0
 
0
       # Absolute bottom-left point of the bounding box
0
+      #
0
       def absolute_bottom_right
0
         [absolute_right, absolute_bottom]
0
       end
0
       
0
       # Width of the bounding box
0
+      #
0
       def width
0
         @width
0
       end
0
@@ -176,6 +201,7 @@ module Prawn
0
       # Height of the bounding box.  If the box is 'stretchy' (unspecified
0
       # height attribute), height is calculated as the distance from the top of
0
       # the box to the current drawing position.
0
+      #
0
       def height
0
         if @height.nil?
0
           absolute_top - @parent.y

Comments