[futurebasic] Re: [FB] Report Printing

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2011 : Group Archive : Group : All Groups

From: Deep <Info@...>
Date: Tue, 21 Jun 2011 06:59:02 +0100
On Jun 20, 2011, at 4:57 PM, Steve wrote:

> I am not used to printing from the bottom up.  Why is this method preferred
over top left = 0,0 ?


The background to Core Graphics is "Display Postscript". In other words, it
is using Postscript which is a resolution-independent vector language
originally used for printers, and applying it in a similar manner to display

Consequently, almost all the Core Graphics commands have a similar
Postscript equivalent such as:

open a context
set a state
set a bounds box
set a scale
set the axis direction
set the origin point
move to a point
draw a line from the last point to a new point
fill the box created from the last series of lines
restore a state
close a context

Also, like Postscript, the coordinate base is set to (0,0) being bottom
left. Coordinates are measured in decimal values, as they are not set to any
specific integer boundary.

In case it helps, Postscript allows you to redefine the coordinates. After
opening the context, simply set the origin point to the top left, and the
vertical axis to be negative (top is zero, increasing value moves
downwards), and that will simulate an environment with (0,0) at the top

fn CGContextTranslateCTM( ctx, 0.0, MyScreenOrPaperHeight )
fn CGContextScaleCTM( ctx, 1.0, -1.0 )

Thereafter, you can send all coordinates in your (0,0) top down format and
items will correctly place themselves.

Look at the example:

Graphics -> CoreGraphics (Quartz) -> QuartzDrawing

It shows the use of the above two functions to simulate the (0,0) top down
drawing environment.

Hope it helps,