[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PScomposite questions
From: |
Quentin Mathé |
Subject: |
PScomposite questions |
Date: |
Thu, 1 Apr 2010 14:21:46 +0200 |
Hi,
I have troubles to understand how PScomposite is expected to work
precisely.
The only real documentation I was able to find is here: <http://objc.toodarkpark.net/AppKit/Functions/PSOperators.html
>
And also this mail: <http://markmail.org/message/stsiwrdgdvrv76ca?q=PScomposite&page=1
>
Based on my tests, the destination point is simply expressed in the
destination coordinate system. For example on Mac OS X, the
destination point (50, 50) is not the same with and without the xform
rotation, although the destination rect itself is not rotated.
[destView lockFocus];
NSAffineTransform *xform = [NSAffineTransform transform];
[xform rotateByDegrees: 10];
[xform concat];
PScomposite(0, 0, 0, 0, [sourceView gState], 50, 50);
Any rotation, translation and scaling applies in a destination view
before using PScomposite() moves this point.
What I don't understand is how the source rect is interpreted, it
seems to me it should be interpreted in the source coordinate system.
But if that's the case, its conflicts with what the PSOperators doc
states: "(Even if the two graphic states have different orientations,
the images will not; composite will not rotate images.)"
The other thing I have observed on Mac OS X is that passing a view
gstate or a window gstate to PScomposite is the same (also true with
NSCopyBits). Unlike what I expected, it always interprets the source
rect in the base coordinate system and never in the view coordinate
system. Hence to composite a view gstate, the source rect relative to
the view must be first converted to the window coordinate system. I
don't know whether this behavior was the same on OpenStep or not. It
could be a Mac OS X limitation.
The Cairo backend could be correct when it converts the source rect
back to base coordinate system to get the minimum bounding rectangle,
but since there is no way to express a source rect relative a view
gstate in Mac OS X, I cannot be sure.
In the PSOperators doc, what "compared to the source" means in:
"The destination image has the same size, shape, and orientation as
the source; destx and desty give destination's location image compared
to the source. (Even if the two graphic states have different
orientations, the images will not; composite will not rotate images.)"
Cheers,
Quentin.
- PScomposite questions,
Quentin Mathé <=