colplate.cpp

Go to the documentation of this file.
00001 // $Id: colplate.cpp 1282 2006-06-09 09:46:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // colplate.cpp - Describe colour separation plates for ColourContexts
00099 
00100 
00101 #include "camtypes.h"
00102 
00103 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 #include "colcontx.h"
00105 #include "colourix.h"
00106 #include "colplate.h"
00107 //#include "isetres.h"
00108 #include "printctl.h"
00109 
00110 
00111 CC_IMPLEMENT_DYNCREATE(ColourPlate, ListItem);
00112 
00113 // Declare smart memory handling in Debug builds
00114 #define new CAM_DEBUG_NEW
00115 
00116 
00117 
00118 
00119 /********************************************************************************************
00120 
00121 >   void ColourPlate::InitObject(ColourPlateType NewType)
00122 
00123     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00124     Date:       25/6/96
00125 
00126     Inputs:     TheType - Describes what kind of colour plate you want
00127 
00128     Purpose:    Sets this colour plate to the given type, and then initialises ALL
00129                 member variables to suitable defautls for that type.
00130 
00131                 Used by all the constructors to share code for initialisation.
00132 
00133     Notes:      Does not check the validity of the arguments (i.e. if you ask for
00134                 COLOURPLATE_SPOT, does not check that the SpotColour is set up)
00135 
00136 ********************************************************************************************/
00137 
00138 void ColourPlate::InitObject(ColourPlateType NewType)
00139 {
00140     Disabled        = FALSE;
00141 
00142     Type            = NewType;
00143 
00144     Overprint       = FALSE;
00145     Monochrome      = TRUE;
00146     Negate          = FALSE;
00147     ActiveScreens   = FALSE;
00148 
00149     ScreenFunction  = SCRTYPE_NONE;     // represents no setscreen command output
00150 
00151     // And set up a suitable default for screen angle/frequency
00152     // Use the selected document's printer resolution and LPI defaults
00153     INT32 DPI   = 1200;     // Defaults in case of catastrophy
00154     INT32 LPI   = 60;
00155     
00156 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00157     TypesetInfo *TPInfo = TypesetInfo::FindTypesetInfoForDoc();
00158     if (TPInfo != NULL)
00159     {
00160         DPI = TPInfo->GetPrintResolution();
00161         LPI = (INT32) floor(TPInfo->GetDefaultScreenFrequency());
00162     }
00163 #endif
00164 
00165     ResetScreenToDefaults(DPI, LPI);
00166 }
00167 
00168 
00169 
00170 /********************************************************************************************
00171 
00172 >   ColourPlate::ColourPlate()
00173 >   ColourPlate::ColourPlate(ColourPlateType TheType,
00174                                 BOOL MonochromePlate = FALSE, BOOL NegatePlate = FALSE)
00175 >   ColourPlate::ColourPlate(IndexedColour *SpotColour,
00176                                 BOOL MonochromePlate = FALSE, BOOL NegatePlate = FALSE)
00177 >   ColourPlate::ColourPlate(const ColourPlate &Other);
00178 
00179     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00180     Date:       20/12/95
00181 
00182     Inputs:     TheType - Describes what kind of colour plate you want
00183 
00184                 SpotColour - Indicates that this is a spot plate, and which colour is to be
00185                 treated as the spot colour for output. Only this colour and its descendants
00186                 will be output on the plate.
00187 
00188                 Monochrome - if TRUE, all output on the plate will be monochromatic (greyscale).
00189                 If FALSE then the plate may contain colour (i.e. a Cyan plate can be output in
00190                 greyscales (e.g. for printer output) or in shades of cyan (e.g. for screen))
00191 
00192                 Negate - if TRUE, all output will be negated to give a photographic negative
00193                 of the plate. if FALSE, the output will be left alone.
00194 
00195                 Other - Another ColourPlate you want to copy
00196 
00197     Purpose:    Construct ColourPlate descriptions
00198 
00199     Notes:      The default constructor makes a simple COLOURPLATE_NONE plate
00200 
00201     Errors:     ERROR3 reports will occur if you do something stupid
00202 
00203     SeeAlso:    ColourContext
00204 
00205 ********************************************************************************************/
00206 
00207 ColourPlate::ColourPlate()
00208 {
00209     InitObject(COLOURPLATE_NONE);
00210 }
00211 
00212 
00213 
00214 ColourPlate::ColourPlate(ColourPlateType TheType, BOOL MonochromePlate, BOOL NegatePlate)
00215 {
00216     ERROR3IF(TheType == COLOURPLATE_SPOT, "Spot plates must be constructed with the Spot Colour constructor");
00217 
00218     InitObject(TheType);
00219 
00220     // And override the defaults with the supplied settings
00221     Monochrome      = MonochromePlate;
00222     Negate          = NegatePlate;
00223 }
00224 
00225 
00226 
00227 ColourPlate::ColourPlate(IndexedColour *SpotColour, BOOL MonochromePlate, BOOL NegatePlate)
00228 {
00229     ERROR3IF(SpotColour == NULL, "Spot plates must include a valid Spot Colour!");
00230 
00231     InitObject(COLOURPLATE_SPOT);
00232 
00233     // And override the defaults with the supplied settings
00234     Monochrome      = MonochromePlate;
00235     Negate          = NegatePlate;
00236 
00237     Spot.MakeRefToIndexedColour(SpotColour);
00238 }
00239 
00240 
00241 
00242 ColourPlate::ColourPlate(const ColourPlate &Other)
00243 {
00244     Disabled        = Other.Disabled;
00245     Type            = Other.Type;
00246     Overprint       = Other.Overprint;
00247     Monochrome      = Other.Monochrome;
00248     Negate          = Other.Negate;
00249     ActiveScreens   = Other.ActiveScreens;
00250     Spot            = Other.Spot;
00251 
00252     ScreenAngle     = Other.ScreenAngle;
00253     ScreenFrequency = Other.ScreenFrequency;
00254     ScreenFunction  = Other.ScreenFunction;
00255 }
00256 
00257 
00258 
00259 /********************************************************************************************
00260 
00261 >   ColourPlate &operator=(const ColourPlate &Other)
00262 
00263     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00264     Date:       13/6//96
00265 
00266     Purpose:    ColourPlate assignment operator
00267 
00268 ********************************************************************************************/
00269 
00270 ColourPlate &ColourPlate::operator=(const ColourPlate &Other)
00271 {
00272     Disabled        = Other.Disabled;
00273     Type            = Other.Type;
00274     Overprint       = Other.Overprint;
00275     Monochrome      = Other.Monochrome;
00276     Negate          = Other.Negate;
00277     ActiveScreens   = Other.ActiveScreens;
00278     Spot            = Other.Spot;
00279 
00280     ScreenAngle     = Other.ScreenAngle;
00281     ScreenFrequency = Other.ScreenFrequency;
00282     ScreenFunction  = Other.ScreenFunction;
00283 
00284     return(*this);
00285 }
00286 
00287 
00288 
00289 /********************************************************************************************
00290 
00291 >   ColourPlate::~ColourPlate()
00292 
00293     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00294     Date:       20/12/95
00295 
00296     Purpose:    Er... damn. It was on the tip of my tongue...
00297 
00298  ********************************************************************************************/
00299 
00300 ColourPlate::~ColourPlate()
00301 {
00302 }
00303 
00304 
00305 
00306 /********************************************************************************************
00307 
00308 >   void ColourPlate::GetDescription(StringBase *Description)
00309 
00310     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00311     Date:       13/6/96
00312 
00313     Outputs:    On return, the Description string will contain a description of this
00314                 colour plate. The string should be more than 64 characters in length,
00315                 or the result could be truncated.
00316 
00317     Purpose:    To retrieve a textual description of this colour plate
00318                 (e.g. "Cyan" "Gold (Spot)")
00319 
00320 ********************************************************************************************/
00321 
00322 void ColourPlate::GetDescription(StringBase *Description)
00323 {
00324     ERROR3IF(Description == NULL, "Illegal NULL param");
00325     *Description = TEXT("");
00326 
00327     switch(GetType())
00328     {
00329         case COLOURPLATE_CYAN:
00330             Description->MakeMsg(_R(IDS_COLOURPLATE_CYAN));
00331             break;
00332 
00333         case COLOURPLATE_MAGENTA:
00334             Description->MakeMsg(_R(IDS_COLOURPLATE_MAGENTA));
00335             break;
00336 
00337         case COLOURPLATE_YELLOW:
00338             Description->MakeMsg(_R(IDS_COLOURPLATE_YELLOW));
00339             break;
00340 
00341         case COLOURPLATE_KEY:
00342             Description->MakeMsg(_R(IDS_COLOURPLATE_BLACK));
00343             break;
00344 
00345         case COLOURPLATE_SPOT:
00346             {
00347                 IndexedColour *Col = GetSpotColour();
00348                 ERROR3IF(Col == NULL, "NULL Spot colour in spot plate");
00349 
00350                 Description->MakeMsg(_R(IDS_COLOURPLATE_SPOT), (TCHAR *) *(Col->GetName()) );
00351             }
00352             break;
00353         default:
00354             break;
00355     }
00356 }
00357 
00358 
00359 
00360 /********************************************************************************************
00361 
00362 >   void ColourPlate::GetDisplayColour(DocColour *Colour)
00363 
00364     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00365     Date:       24/6/96
00366 
00367     Outputs:    On return, the Colour parameter will be filled in with an appropriate colour
00368 
00369     Purpose:    To retrieve a suitable user-interface display colour for this plate.
00370                 For a spot plate, this is simply the spot colour itself.
00371                 For the process plates, a suitable colour will be returned.
00372 
00373 ********************************************************************************************/
00374 
00375 void ColourPlate::GetDisplayColour(DocColour *Colour)
00376 {
00377     ERROR3IF(Colour == NULL, "Illegal NULL param");
00378 
00379     PColourCMYK CMYKDef;
00380     CMYKDef.Cyan = CMYKDef.Magenta = CMYKDef.Yellow = CMYKDef.Key = 0;
00381 
00382     switch(GetType())
00383     {
00384         case COLOURPLATE_CYAN:      CMYKDef.Cyan = 255;     break;
00385         case COLOURPLATE_MAGENTA:   CMYKDef.Magenta = 255;  break;
00386         case COLOURPLATE_YELLOW:    CMYKDef.Yellow = 255;   break;
00387         case COLOURPLATE_KEY:       CMYKDef.Key = 255;      break;
00388 
00389         case COLOURPLATE_SPOT:
00390             {
00391                 IndexedColour *Col = GetSpotColour();
00392                 ERROR3IF(Col == NULL, "NULL Spot colour in spot plate");
00393 
00394                 Colour->MakeRefToIndexedColour(Col);
00395                 return;     // Return immediately
00396             }
00397             break;
00398 
00399         default:
00400             // Just leave it alone, which will return the default value - white
00401             break;
00402     }
00403 
00404     // If we've dropped through this far, then set the CMYK value we've
00405     // filled in, and return
00406     Colour->SetCMYKValue(&CMYKDef);
00407 }
00408 
00409 
00410 
00411 /********************************************************************************************
00412 
00413 >   void ColourPlate::SetDisabled(BOOL IsDisabled = TRUE)
00414 
00415     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00416     Date:       20/5/96
00417 
00418     Inputs:     IsDisabled - TRUE to disable this ColourPlate, FALSE to enable it
00419 
00420     Purpose:    Internally, some colour conversions need to turn of colour separations.
00421                 (e.g. user-interface colours such as dialogue greys and EOR colours).
00422 
00423                 These disable separation by setting this disabling flag - this should
00424                 only be used in a VERY temporary sense (i.e. around individual calls
00425                 to ConvertColour).
00426 
00427     Notes:      ColourPlates always default to being Enabled.
00428 
00429     SeeAlso:    ColourContext::ConvertColour; ColourContext::ConvertColourBase
00430 
00431 ********************************************************************************************/
00432 
00433 void ColourPlate::SetDisabled(BOOL IsDisabled)
00434 {
00435     Disabled = IsDisabled;
00436 }
00437 
00438 
00439 
00440 /********************************************************************************************
00441 
00442 >   void ColourPlate::SetPlateInfo(ColourContext *Parent, ColourPlateType TheType,
00443                                     BOOL MonochromePlate = FALSE, BOOL NegatePlate = FALSE)
00444 >   void ColourPlate::SetPlateInfo(ColourContext *Parent, IndexedColour *SpotColour,
00445                                     BOOL MonochromePlate = FALSE, BOOL NegatePlate = FALSE)
00446 
00447     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00448     Date:       20/12/95
00449 
00450     Inputs:     Parent - the ColourContext this plate is attached to, or NULL if it is currently
00451                 unattached. NOTE that it is vital that you pass the parent context in if it is
00452                 attached, or colours in that context will remain incorrectly cached indefinitely!
00453 
00454                 TheType - Describes what kind of colour plate you want
00455 
00456                 SpotColour - Indicates that this is a spot plate, and which colour is to be
00457                 treated as the spot colour for output. Only this colour and its descendants
00458                 will be output on the plate.
00459 
00460                 Monochrome - if TRUE, all output on the plate will be monochromatic (greyscale).
00461                 If FALSE then the plate may contain colour (i.e. a Cyan plate can be output in
00462                 greyscales (e.g. for printer output) or in shades of cyan (e.g. for screen))
00463 
00464                 Negate - if TRUE, all output will be negated to give a photographic negative
00465                 of the plate. if FALSE, the output will be left alone.
00466 
00467     Purpose:    Change this ColourPlate description
00468 
00469     Notes:      Every time the plate changes, the attached ColourContext must chnage its handle
00470                 in order to "flush" all cached colours. After 65536 such flushes, it is possible
00471                 for contexts to start using duplicate handles, so it is preferable that changes
00472                 are made to plates as infrequently as possible.
00473 
00474                 ** ALL ColourPlate settings will be reset when you call this function, i.e.
00475                 disabled plates will be re-enabled, new default screen angle/frequency values
00476                 filled in, overprint disabled, etc.
00477 
00478     Errors:     ERROR3 reports will occur if you do something stupid
00479 
00480     SeeAlso:    ColourContext
00481 
00482 ********************************************************************************************/
00483 
00484 void ColourPlate::SetPlateInfo(ColourContext *Parent, ColourPlateType TheType,
00485                                 BOOL MonochromePlate, BOOL NegatePlate)
00486 {
00487     ERROR3IF(TheType == COLOURPLATE_SPOT, "Spot plates must be constructed with the Spot Colour constructor");
00488 
00489     InitObject(TheType);
00490 
00491     Monochrome  = MonochromePlate;
00492     Negate      = NegatePlate;
00493 
00494     Spot        = DocColour(COLOUR_BLACK);
00495 
00496     if (Parent != NULL)
00497         Parent->ColourPlateHasChanged();
00498 }
00499 
00500 
00501 void ColourPlate::SetPlateInfo(ColourContext *Parent, IndexedColour *SpotColour,
00502                                 BOOL MonochromePlate, BOOL NegatePlate)
00503 {
00504     ERROR3IF(SpotColour == NULL, "Spot plates must include a valid Spot Colour!");
00505 
00506     InitObject(COLOURPLATE_SPOT);
00507 
00508     Monochrome  = MonochromePlate;
00509     Negate      = NegatePlate;
00510 
00511     Spot.MakeRefToIndexedColour(SpotColour);
00512 
00513     if (Parent != NULL)
00514         Parent->ColourPlateHasChanged();
00515 }
00516 
00517 
00518 
00519 /********************************************************************************************
00520 
00521 >   void ColourPlate::SetType(ColourContext *Parent, ColourPlateType TheType,
00522                                 IndexedColour *SpotColour = NULL)
00523 
00524     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00525     Date:       20/12/95
00526 
00527     Inputs:     Parent - the ColourContext this plate is attached to, or NULL if it is currently
00528                 unattached. NOTE that it is vital that you pass the parent context in if it is
00529                 attached, or colours in that context will remain incorrectly cached indefinitely!
00530 
00531                 TheType - Describes what kind of colour plate you want
00532 
00533                 SpotColour - NULL, or points to the colour which is to be treated as the spot
00534                 colour for output. Only this colour and its descendants will be output on the
00535                 plate. TheType must be COLOURPLATE_SPOT if this is non-NULL.
00536 
00537     Purpose:    Change this ColourPlate description
00538 
00539     Notes:      Every time the plate changes, the attached ColourContext must chnage its handle
00540                 in order to "flush" all cached colours. After 65536 such flushes, it is possible
00541                 for contexts to start using duplicate handles, so it is preferable that changes
00542                 are made to plates as infrequently as possible.
00543 
00544     Errors:     ERROR3 reports will occur if you do something stupid
00545 
00546     SeeAlso:    ColourContext
00547 
00548 ********************************************************************************************/
00549 
00550 void ColourPlate::SetType(ColourContext *Parent, ColourPlateType TheType, IndexedColour *SpotColour)
00551 {
00552     ERROR3IF(TheType == COLOURPLATE_SPOT && SpotColour == NULL,
00553                 "Spot plates must include a valid Spot Colour!");
00554 
00555     if (Type != COLOURPLATE_SPOT || Spot.FindParentIndexedColour() != SpotColour)
00556     {
00557         InitObject(TheType);
00558 
00559         if (SpotColour != NULL)
00560             Spot.MakeRefToIndexedColour(SpotColour);
00561 
00562         if (Parent != NULL)
00563             Parent->ColourPlateHasChanged();
00564     }
00565 }
00566 
00567 
00568 
00569 /********************************************************************************************
00570 
00571 >   void ColourPlate::SetScreenInfo(double Angle, double Frequency)
00572 
00573     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00574     Date:       24/6/96
00575 
00576     Inputs:     Angle       - The screen angle to use for screening of this plate
00577                                 in the range 0..360 degrees
00578                 Frequency   - The screen frequency (lpi) to use for screening of this plate
00579 
00580     Purpose:    Set new screen angle/frequency settings
00581 
00582     SeeAlso:    ColourPlate::ResetScreenToDefaults
00583 
00584 ********************************************************************************************/
00585 
00586 void ColourPlate::SetScreenInfo(double Angle, double Frequency)
00587 {
00588     ERROR3IF(Angle < 0.0 || Angle >= 360.0, "Illegal screen angle");
00589     ScreenAngle = Angle;
00590 
00591     ERROR3IF(Frequency < 1.0 || Frequency > 1000.0, "Silly screen frequency");
00592     ScreenFrequency = Frequency;
00593 }
00594 
00595 
00596 
00597 /********************************************************************************************
00598 
00599 >   void ColourPlate::SetOverprint(BOOL On)
00600 
00601     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00602     Date:       24/6/96
00603 
00604     Inputs:     On - TRUE to enable or FALSE to disable overprinting of this plate
00605 
00606     Purpose:    Sets this plate to overprint or knock-out
00607 
00608 ********************************************************************************************/
00609 
00610 void ColourPlate::SetOverprint(BOOL On)
00611 {
00612     Overprint = On;
00613 }
00614 
00615 
00616 
00617 /********************************************************************************************
00618 
00619 >   void ColourPlate::SetMonochrome(ColourContext *Parent, BOOL On = TRUE)
00620 
00621     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00622     Date:       20/12/95
00623 
00624     Inputs:     Parent - the ColourContext this plate is attached to, or NULL if it is currently
00625                 unattached. NOTE that it is vital that you pass the parent context in if it is
00626                 attached, or colours in that context will remain incorrectly cached indefinitely!
00627 
00628                 On - if TRUE, all output on the plate will be monochromatic (greyscale).
00629                 If FALSE then the plate may contain colour (i.e. a Cyan plate can be output in
00630                 greyscales (e.g. for printer output) or in shades of cyan (e.g. for screen))
00631 
00632     Purpose:    Change this ColourPlate description
00633 
00634     Notes:      Every time the plate changes, the attached ColourContext must chnage its handle
00635                 in order to "flush" all cached colours. After 65536 such flushes, it is possible
00636                 for contexts to start using duplicate handles, so it is preferable that changes
00637                 are made to plates as infrequently as possible.
00638 
00639     SeeAlso:    ColourContext
00640 
00641 ********************************************************************************************/
00642 
00643 void ColourPlate::SetMonochrome(ColourContext *Parent, BOOL On)
00644 {
00645     if (Monochrome != On)
00646     {
00647         Monochrome = On;
00648         if (Parent != NULL)
00649             Parent->ColourPlateHasChanged();
00650     }
00651 }
00652 
00653 
00654 
00655 /********************************************************************************************
00656 
00657 >   void ColourPlate::SetNegative(ColourContext *Parent, BOOL On = TRUE)
00658 
00659     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00660     Date:       20/12/95
00661 
00662     Inputs:     Parent - the ColourContext this plate is attached to, or NULL if it is currently
00663                 unattached. NOTE that it is vital that you pass the parent context in if it is
00664                 attached, or colours in that context will remain incorrectly cached indefinitely!
00665 
00666                 On - if TRUE, all output will be negated to give a photographic negative
00667                 of the plate. if FALSE, the output will be left alone.
00668 
00669     Purpose:    Change this ColourPlate description
00670 
00671     Notes:      Every time the plate changes, the attached ColourContext must chnage its handle
00672                 in order to "flush" all cached colours. After 65536 such flushes, it is possible
00673                 for contexts to start using duplicate handles, so it is preferable that changes
00674                 are made to plates as infrequently as possible.
00675 
00676     SeeAlso:    ColourContext
00677 
00678 ********************************************************************************************/
00679 
00680 void ColourPlate::SetNegative(ColourContext *Parent, BOOL On)
00681 {
00682     if (Negate != On)
00683     {
00684         Negate = On;
00685         if (Parent != NULL)
00686             Parent->ColourPlateHasChanged();
00687     }
00688 }
00689 
00690 
00691 
00692 /********************************************************************************************
00693 
00694 >   void ColourPlate::SetActiveScreening(BOOL On = TRUE)
00695 
00696     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00697     Date:       30/8/96
00698 
00699     Inputs:     On - if TRUE, this indicates to internal EPS renderers they need to render using
00700                               the specified screening functions in this plate
00701                    - if FALSE, the output device will be unaffected.
00702                 
00703     Purpose:    This function indicates whether the screen function, angle and frequency described
00704                 in this plate should be used when rendering to EPS devices.
00705 
00706 ********************************************************************************************/
00707 
00708 void ColourPlate::SetActiveScreening(BOOL On)
00709 {
00710     ActiveScreens = On;
00711 }
00712 
00713 
00714 /********************************************************************************************
00715 
00716 >   void ColourPlate::SetScreenFunction(ScreenType func)
00717 
00718     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00719     Date:       26/6/96
00720     Inputs:     func = the screen function to use
00721     Purpose:    Set a new screen function in this plate
00722 
00723 ********************************************************************************************/
00724 
00725 void ColourPlate::SetScreenFunction(ScreenType func)
00726 {
00727     ScreenFunction = func;
00728 }
00729 
00730 
00731 
00732 /********************************************************************************************
00733 
00734 >   void ColourPlate::ResetScreenToDefaults(INT32 DeviceDPI = 1200, INT32 DefaultFrequency = 60)
00735 
00736     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00737     Date:       14/8/96
00738 
00739     Inputs:     DeviceDPI -         The anticipated resolution of the output (imagesetting) device
00740                 DefaultFrequency -  The basic screen frequency (LPI) from which to derive the
00741                                     recommended defaults
00742 
00743     Purpose:    Resets this ColourPlate's screen angle to the recommended angle for
00744                 its current Screen frequency (lpi) and the current output device
00745                 resolution.
00746 
00747     SeeAlso:    ColourPlate::SetScreenInfo
00748 
00749 ********************************************************************************************/
00750 
00751 void ColourPlate::ResetScreenToDefaults(INT32 DeviceDPI, INT32 DefaultFrequency)
00752 {
00753 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00754     // Ask the XaraCMS for recommended angles for the current typesetter settings
00755     CMSScreenAngles RecAngles;
00756     XaraCMS* lpCMSMan = GetApplication()->GetCMSManager();
00757 
00758     // Set suitable defaults in case of a problem
00759     RecAngles.cyanfreq = RecAngles.magentafreq =
00760             RecAngles.yellowfreq = RecAngles.keyfreq = DefaultFrequency;
00761 
00762     RecAngles.cyanangle     = 105.0;
00763     RecAngles.magentaangle  = 75.0;
00764     RecAngles.yellowangle   = 90.0;
00765     RecAngles.keyangle      = 45.0;
00766 
00767     if (lpCMSMan != NULL)
00768         lpCMSMan->GetRecommendedAngles(DeviceDPI, DefaultFrequency, &RecAngles);
00769 
00770     // Now set a suitable default screen angle for the type of plate
00771     switch(Type)
00772     {
00773         case COLOURPLATE_CYAN:
00774             ScreenAngle     = RecAngles.cyanangle;
00775             ScreenFrequency = RecAngles.cyanfreq;
00776             break;
00777 
00778         case COLOURPLATE_MAGENTA:
00779             ScreenAngle     = RecAngles.magentaangle;
00780             ScreenFrequency = RecAngles.magentafreq;
00781             break;
00782         
00783         case COLOURPLATE_YELLOW:
00784             ScreenAngle     = RecAngles.yellowangle;
00785             ScreenFrequency = RecAngles.yellowfreq;
00786             break;
00787         
00788         case COLOURPLATE_KEY:
00789             ScreenAngle     = RecAngles.keyangle;
00790             ScreenFrequency = RecAngles.keyfreq;
00791             break;
00792 
00793         default:
00794             ScreenAngle = 45.0;
00795             ScreenFrequency = (double) DefaultFrequency;
00796             break;
00797     }
00798 #endif
00799 }
00800 

Generated on Sat Nov 10 03:44:53 2007 for Camelot by  doxygen 1.4.4