doccoord.cpp File Reference

(r1785/r1282)

#include "camtypes.h"
#include "usercord.h"
#include "chapter.h"

Go to the source code of this file.

Functions

Matrix ComposeDocToOilMat (const DocCoord &ChapterPos, const XLONG &ChapterDepth, const FIXED16 &ViewScale, const WorkCoord &ScrollOffset)
XMatrix ComposeDocToWorkXMat (const DocCoord ChapterPos, const XLONG ChapterDepth, const FIXED16 ViewScale)
DocCoord operator+ (const DocCoord &One, const DocCoord &Two)
 Adds two DocCoords together. ie One.x+Two.x, One.y+Two.y.
DocCoord operator- (const DocCoord &One, const DocCoord &Two)
 Subtracts the two DocCoords. ie One.x-Two.x, One.y-Two.y.


Function Documentation

Matrix ComposeDocToOilMat const DocCoord ChapterPos,
const XLONG ChapterDepth,
const FIXED16 ViewScale,
const WorkCoord ScrollOffset
 

Definition at line 145 of file doccoord.cpp.

00150 {
00151 // Scale ChapterDepth into device units so that it can be combined with the scroll offset
00152 // BEFORE we build the scroll translation matrix. In this way we avoid storing 64-bit
00153 // translation values in our final matrix...
00154 //
00155 // If we COULD store 64-bit E and F values temporarilly during this composition then
00156 // we would not need to perform this trick at all. This would have the knock-on advantage
00157 // that the OSMapping matrix supplied by the OIL layer could contain the scroll offsets!
00158 //
00159 // NOTE: This adjustment can be removed when testing the system!
00160 
00161     Matrix DocToOil;
00162 
00163 //**********************************************************************
00164 // Is it just me or is there gunna be a problem with this ?
00165 // If ChapterDepth is big (atfer all it is an XLONG) and ViewScale
00166 // is big too (Say we are zoomed to 1000%) won't this go VERY wrong ?
00167 //
00168 // - Will.
00169 
00170     Matrix Scroll(  -ScrollOffset.x,
00171                     -(ScrollOffset.y + (ChapterDepth * (ViewScale)))
00172                  );
00173 
00174 //**********************************************************************
00175 
00176     Matrix ScaleMat(ViewScale,ViewScale);
00177     Matrix Translate(-((Coord)ChapterPos));
00178 
00179 // The following matrix compositions MUST be performed in this order. If you are tempted
00180 // to optimise this code MAKE SURE THAT THEY ARE STILL IN THIS ORDER WHEN YOU'VE FINISHED!
00181 //
00182 // Apply translation to get coordinates into logical column...
00183     DocToOil *= Translate;
00184 
00185 // Apply scale factors to convert from millipoint distances to pixel distances...
00186     DocToOil *= ScaleMat;
00187 
00188 // Apply scroll-offset translation to move origin to viewing position...
00189     DocToOil *= Scroll;
00190 
00191     return DocToOil;
00192 }

XMatrix ComposeDocToWorkXMat const DocCoord  ChapterPos,
const XLONG  ChapterDepth,
const FIXED16  ViewScale
 

Definition at line 221 of file doccoord.cpp.

00225 {
00226 
00227     XMatrix ScaleMat(ViewScale,ViewScale);
00228 
00229 // Conversion of chapter position from DocCoords to WorkCoords
00230 //    WorkCoord WrkChapPos(MakeXLong(ChapterPos.x), MakeXLong(ChapterPos.y));
00231     WorkCoord WrkChapPos(MakeXLong(ChapterPos.x), MakeXLong(ChapterPos.y)+ChapterDepth);
00232 
00233 // DocToOS matrix is initialised as the Translate matrix: saving space and performance
00234 // by the exclusion of an extra multiplication.
00235     XMatrix DocToWork(-(WrkChapPos));
00236     
00237 // The following matrix compositions MUST be performed in this order. If you are tempted
00238 // to optimise this code MAKE SURE THAT THEY ARE STILL IN THIS ORDER WHEN YOU'VE FINISHED!
00239 //
00240 
00241 // Apply scale factors to convert from millipoint distances to pixel distances...
00242     DocToWork *= ScaleMat;
00243 
00244     return DocToWork;
00245 }

DocCoord operator+ const DocCoord One,
const DocCoord Two
 

Adds two DocCoords together. ie One.x+Two.x, One.y+Two.y.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/12/94
Parameters:
One - The first DocCoord [INPUTS] Two - The second DocCoord
Returns:
The result of adding the two DocCoords together.

Definition at line 645 of file doccoord.cpp.

00646 {
00647     DocCoord Result;
00648 
00649     // Add the two DocCoords together
00650     Result.x = One.x + Two.x;
00651     Result.y = One.y + Two.y;
00652 
00653     // return the result
00654     return Result;
00655 }

DocCoord operator- const DocCoord One,
const DocCoord Two
 

Subtracts the two DocCoords. ie One.x-Two.x, One.y-Two.y.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/12/94
Parameters:
One - The first DocCoord [INPUTS] Two - The second DocCoord
Returns:
the DocCoord that is the first DocCoord minus the second DocCoord

Definition at line 671 of file doccoord.cpp.

00672 {
00673     DocCoord Result;
00674 
00675     // Subtract the two DocCoords from each other
00676     Result.x = One.x - Two.x;
00677     Result.y = One.y - Two.y;
00678 
00679     // return the result
00680     return Result;
00681 }


Generated on Sat Nov 10 03:49:08 2007 for Camelot by  doxygen 1.4.4