Skip to content
This repository
Browse code

PageState: add a method for performing a CTM transform

  • Loading branch information...
commit cf8f730711108f48ccc1fd1afda0ac43e2870beb 1 parent fd25ba0
James Healy authored February 18, 2012

Showing 1 changed file with 10 additions and 0 deletions. Show diff stats Hide diff stats

  1. 10  lib/pdf/reader/page_state.rb
10  lib/pdf/reader/page_state.rb
@@ -195,6 +195,16 @@ def invoke_xobject(label)
195 195
       # Public Visible State
196 196
       #####################################################
197 197
 
  198
+      # transform x and y co-ordinates from the current user space to the
  199
+      # underlying device space.
  200
+      #
  201
+      def ctm_transform(x, y, z = 1)
  202
+        [
  203
+          (ctm[0,0] * x) + (ctm[1,0] * y) + (ctm[2,0] * z),
  204
+          (ctm[0,1] * x) + (ctm[1,1] * y) + (ctm[2,1] * z)
  205
+        ]
  206
+      end
  207
+
198 208
       # transform x and y co-ordinates from the current text space to the
199 209
       # underlying device space.
200 210
       #

0 notes on commit cf8f730

Please sign in to comment.
Something went wrong with that request. Please try again.