Browse files

PageState: add a method for performing a CTM transform

  • Loading branch information...
1 parent fd25ba0 commit cf8f730711108f48ccc1fd1afda0ac43e2870beb @yob committed Feb 18, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 lib/pdf/reader/page_state.rb
View
10 lib/pdf/reader/page_state.rb
@@ -195,6 +195,16 @@ def invoke_xobject(label)
# Public Visible State
#####################################################
+ # transform x and y co-ordinates from the current user space to the
+ # underlying device space.
+ #
+ def ctm_transform(x, y, z = 1)
+ [
+ (ctm[0,0] * x) + (ctm[1,0] * y) + (ctm[2,0] * z),
+ (ctm[0,1] * x) + (ctm[1,1] * y) + (ctm[2,1] * z)
+ ]
+ end
+
# transform x and y co-ordinates from the current text space to the
# underlying device space.
#

0 comments on commit cf8f730

Please sign in to comment.