00001 /******************************************************************************, 00002 * 00003 * \file mi32/mgd2.h 00004 * \brief MicroImages Graphics Device 00005 * 00006 * \if NODOC 00007 * $Log: mgd2.h_v $ 00008 * Revision 1.68 2004/04/02 21:55:57 dwilliss 00009 * Added a DrawLabel method that takes a TEXTBLOCK 00010 * 00011 * Revision 1.67 2004/03/30 17:10:17 dwilliss 00012 * Added comments to an enum 00013 * 00014 * Revision 1.66 2003/12/10 17:47:25 dwilliss 00015 * Added private data 00016 * 00017 * Revision 1.65 2003/12/04 16:18:28 dwilliss 00018 * Make default implementation of v_InterfaceTextGetExtents() return 0s instead 00019 * of leaving return values as the random garbage they were passed in as 00020 * 00021 * Revision 1.64 2003/11/10 16:09:27 dwilliss 00022 * Added GetPixelColorNoICM and GetColorPixelNoICM 00023 * 00024 * Revision 1.63 2003/11/04 14:58:40 scowan 00025 * Removed groupkey deprecated get scalable font function. 00026 * 00027 * Revision 1.62 2003/11/04 13:25:04 mju 00028 * Remove ambiguity in dlgGetScalableFont. 00029 * 00030 * Revision 1.61 2003/11/03 20:40:26 scowan 00031 * Deprecate legacy get scalable font function. 00032 * Add new function with textid handling. 00033 * 00034 * Revision 1.60 2003/10/29 22:01:02 dwilliss 00035 * Context's method to check antialiasing no longer inline. Now also checks 00036 * to see if the device supports it 00037 * 00038 * Revision 1.59 2003/10/29 18:29:04 ldyas 00039 * *** empty log message *** 00040 * 00041 * Revision 1.58 2003/10/24 17:03:48 dwilliss 00042 * Added method to get/set thin line width hinting 00043 * 00044 * Revision 1.57 2003/10/22 21:20:42 ldyas 00045 * *** empty log message *** 00046 * 00047 * Revision 1.56 2003/10/10 22:44:48 dwilliss 00048 * Added Get/SetAntialiasing 00049 * 00050 * Revision 1.55 2003/10/08 17:46:35 ldyas 00051 * added anti-aliasing and filldevice 00052 * 00053 * Revision 1.54 2003/10/03 20:10:53 linux32build!build 00054 * Doxygen 00055 * 00056 * Revision 1.53 2003/10/01 22:16:22 dwilliss 00057 * Doxygen 00058 * 00059 * Revision 1.52 2003/09/29 22:58:22 dwilliss 00060 * Added a member to device 00061 * 00062 * Revision 1.51 2003/09/22 20:29:12 dwilliss 00063 * Got rid of an overload that wasn't used and didn't do anything useful 00064 * 00065 * Revision 1.50 2003/09/15 13:49:56 fileserver!dwilliss 00066 * Doxygen 00067 * 00068 * Revision 1.49 2003/09/09 22:11:21 scowan 00069 * nc. 00070 * 00071 * Revision 1.48 2003/09/09 17:56:22 scowan 00072 * Added more work buffers. 00073 * 00074 * Revision 1.47 2003/07/31 20:36:33 dwilliss 00075 * Made SetICMSourceProfile() non-inline. It just got a whole lot more 00076 * compilcated. 00077 * 00078 * Revision 1.46 2003/07/25 22:22:34 dwilliss 00079 * *** empty log message *** 00080 * 00081 * Revision 1.45 2003/07/03 17:52:14 dwilliss 00082 * *** empty log message *** 00083 * 00084 * Revision 1.44 2003/06/27 14:21:45 dwilliss 00085 * GetOutputScale modified to cope with this == NULL 00086 * 00087 * Revision 1.43 2003/06/24 16:11:20 dwilliss 00088 * Added a DrawLabel method 00089 * 00090 * Revision 1.42 2003/06/17 16:42:31 dwilliss 00091 * Made 3 methods of device non-inline. GetPixelSizeMM (2 flavors) and 00092 * CreateContext now cope with "this" being NULL. 00093 * 00094 * Revision 1.41 2003/06/16 22:58:58 dwilliss 00095 * *** empty log message *** 00096 * 00097 * Revision 1.40 2003/06/11 22:12:28 dwilliss 00098 * *** empty log message *** 00099 * 00100 * Revision 1.39 2003/06/11 22:08:06 dwilliss 00101 * The inline for DrawPoint was missing. 00102 * 00103 * Revision 1.38 2003/06/11 17:10:57 dwilliss 00104 * Virtual methods all renamed to start with v_ and made private (where 00105 * possible) or protected. 00106 * 00107 * Revision 1.37 2003/06/06 22:34:45 dwilliss 00108 * color management stuff 00109 * 00110 * Revision 1.36 2003/05/30 16:50:24 dwilliss 00111 * Added a new overload of a function 00112 * 00113 * Revision 1.35 2003/05/28 15:13:37 dwilliss 00114 * A bunch of ICM changes 00115 * 00116 * Revision 1.34 2003/05/23 22:41:59 dwilliss 00117 * Added methods to Clear ICM Profiles 00118 * 00119 * Revision 1.33 2003/05/21 22:30:56 dwilliss 00120 * Added ICM Profile support 00121 * 00122 * Revision 1.32 2003/01/23 15:03:13 scowan 00123 * Fixed inline calling errors for draw lines dashed. 00124 * 00125 * Revision 1.31 2003/01/20 16:45:53 mju 00126 * Fix parm names for draw/fillrectangle. 00127 * 00128 * Revision 1.30 2003/01/10 21:51:31 mju 00129 * Add comment. 00130 * 00131 * Revision 1.29 2003/01/10 21:24:30 mju 00132 * Add DrawLinesDashed versions using c-style array. 00133 * Make virtual DrawLinesDashed start with v_. 00134 * 00135 * Revision 1.28 2003/01/07 21:50:32 dwilliss 00136 * Added DrawArrow() method 00137 * 00138 * Revision 1.27 2003/01/02 20:28:49 dwilliss 00139 * Added new DrawRegion/DrawSubregion methods 00140 * 00141 * Revision 1.26 2002/11/21 23:01:36 dwilliss 00142 * Added new capabililty flag 00143 * 00144 * Revision 1.25 2002/11/15 16:25:10 dwilliss 00145 * The idea of a "work" context is gone. 00146 * 00147 * Revision 1.24 2002/11/13 23:37:02 dwilliss 00148 * Complex Clip Regions 00149 * Added DrawLines() method taking a POLYLINE 00150 * Added FillRegion() 00151 * Various private method changes necessary to fix hatch pattern filling to 00152 * use complex clip regions 00153 * 00154 * Revision 1.23 2002/10/30 21:54:22 scowan 00155 * Moved method to be private. 00156 * 00157 * Revision 1.22 2002/10/21 14:18:45 dwilliss 00158 * const issue 00159 * 00160 * Revision 1.21 2002/10/17 15:22:53 mju 00161 * COLORSPACE enum moved to mi32/colorspc.h and some items renamed. 00162 * 00163 * Revision 1.20 2002/10/03 22:05:52 dwilliss 00164 * Added InterfaceTextGetWidth(), Gave InterfaceTextDrawString() an optional 00165 * parameter for visual order drawing 00166 * 00167 * Revision 1.19 2002/10/02 22:39:29 dwilliss 00168 * Made GetImagePointer protected 00169 * 00170 * Revision 1.18 2002/10/02 20:28:44 dwilliss 00171 * Fixed a problem in SetFont. Wasn't keeping track of stuff right 00172 * 00173 * Revision 1.17 2002/09/09 17:00:42 mju 00174 * Allow mgd.h so can compile stubs. 00175 * 00176 * Revision 1.16 2002/08/19 15:15:11 scowan 00177 * nc. 00178 * 00179 * Revision 1.15 2002/08/19 15:06:10 dwilliss 00180 * Change a cast to a const_cast for clarity 00181 * 00182 * Revision 1.14 2002/08/14 17:13:00 ldyas 00183 * *** empty log message *** 00184 * 00185 * Revision 1.13 2002/08/14 17:12:25 ldyas 00186 * Added IsEmbeddable for Fonts 00187 * 00188 * Revision 1.12 2002/08/13 16:15:47 vdronov 00189 * added m_IsPerspective and Calculate3dDepthFunction 00190 * 00191 * Revision 1.11 2002/08/01 16:09:39 dwilliss 00192 * *** empty log message *** 00193 * 00194 * Revision 1.10 2002/07/03 15:27:00 dwilliss 00195 * Added MGD::FONT::ReadTTF() as a static method 00196 * 00197 * Revision 1.9 2002/06/11 22:05:42 scowan 00198 * Added another friend. 00199 * 00200 * Revision 1.8 2002/06/10 16:18:59 mju 00201 * Add COLORLOCK class. 00202 * 00203 * Revision 1.7 2002/06/04 23:18:56 ldyas 00204 * Made SetColorIsPatternValue virtual 00205 * 00206 * Revision 1.4 2002/06/03 22:58:28 ldyas 00207 * Added SetColorIsPatternVariable and DrawLinesDashed 00208 * 00209 * RCS error forced me to delete the RCS file and start over 00210 * 00211 * Revision 1.1 2002/05/29 23:00:02 dwilliss 00212 * Initial revision 00213 * 00214 * Revision 1.62 2002/05/29 22:12:18 dwilliss 00215 * TextOpenFont now takes const filename 00216 * 00217 * Revision 1.61 2002/05/28 22:58:56 dwilliss 00218 * Expanded documentation in comments 00219 * 00220 * Revision 1.60 2002/05/21 22:51:14 dwilliss 00221 * Added TextBlockBegin/End methods 00222 * 00223 * Revision 1.59 2002/05/21 16:34:49 dwilliss 00224 * SetOutputScale is no longer inline. More complicated that just assignment 00225 * 00226 * Revision 1.58 2002/05/17 22:53:31 dwilliss 00227 * Added TextSpanBegin/End 00228 * 00229 * Revision 1.57 2002/05/13 22:53:35 dwilliss 00230 * Defined new "cabability" flag. 00231 * 00232 * Revision 1.56 2002/05/13 22:50:22 dwilliss 00233 * Made some text drawing methods virtual 00234 * 00235 * Revision 1.55 2002/04/23 16:46:29 dwilliss 00236 * Added more colorspaces for 32-bit cases 00237 * 00238 * Revision 1.54 2002/04/19 14:18:13 dwilliss 00239 * Inline method was missing return value 00240 * 00241 * Revision 1.53 2002/04/05 21:03:52 mju 00242 * Add Draw...StyleSample methods use RVC::STYLE. 00243 * 00244 * Revision 1.49 2002/03/14 23:30:36 dwilliss 00245 * TEXTBLOCKs now use Unicode text exclusively. 00246 * 00247 * Revision 1.48 2002/03/13 21:11:25 dwilliss 00248 * Changes necessary to implement full justified text 00249 * 00250 * Revision 1.47 2002/03/11 18:52:00 dwilliss 00251 * Added a GetTextStyle/SetTextStyle pair 00252 * 00253 * Revision 1.46 2002/03/08 15:39:26 dwilliss 00254 * MGD::TEXTBLOCKs can't be memset now. Use the constructor 00255 * 00256 * Revision 1.45 2002/03/08 15:28:54 dwilliss 00257 * TEXTBLOCK has constructor/destructor now 00258 * 00259 * Revision 1.44 2002/02/22 16:17:56 scowan 00260 * Added clip width. 00261 * 00262 * Revision 1.43 2002/02/21 23:59:24 scowan 00263 * Added clip width variable. 00264 * 00265 * Revision 1.42 2002/02/21 18:09:40 dwilliss 00266 * Changed the comments on CopyRect() to reflect reality 00267 * 00268 * Revision 1.41 2002/02/08 23:03:05 scowan 00269 * Changed text get area to text add to clip. 00270 * 00271 * Revision 1.40 2002/02/05 15:45:28 dwilliss 00272 * Changes to CONTEXT_AUTOPTR. Constructor is explicit, copy constructor and 00273 * assignment operator are declared but unimplemented to prevent use. 00274 * 00275 * Revision 1.39 2002/02/05 15:39:44 dwilliss 00276 * Added CONTEXT_AUTOPTR 00277 * 00278 * Revision 1.38 2002/01/30 23:44:57 scowan 00279 * Removed flag for using fill span. 00280 * 00281 * Revision 1.37 2002/01/29 23:58:11 scowan 00282 * Added clear clip mask method. 00283 * 00284 * Revision 1.36 2002/01/29 15:55:21 dwilliss 00285 * Added private method to device 00286 * 00287 * Revision 1.35 2002/01/28 21:35:31 scowan 00288 * Added virtual methods to deal with clipping masks. 00289 * 00290 * Revision 1.34 2002/01/25 23:34:09 scowan 00291 * Removed legacy clip mask structure. 00292 * 00293 * Revision 1.33 2002/01/25 16:04:56 mju 00294 * Add defaults for DlgGetScalableFont like old version had. 00295 * 00296 * Revision 1.32 2002/01/16 23:34:54 scowan 00297 * Added boldnesswidth to textsettings. 00298 * 00299 * Revision 1.31 2002/01/16 23:17:46 scowan 00300 * Changed methods and added methods. 00301 * 00302 * Revision 1.30 2002/01/09 20:20:11 dwilliss 00303 * Fixed problem with null device 00304 * 00305 * Revision 1.29 2002/01/09 20:07:05 dwilliss 00306 * Added Null Device 00307 * 00308 * Revision 1.28 2002/01/08 23:48:50 dwilliss 00309 * ImageBegin/ImageEnd/PutImageSpan now deal with any source colorspace 00310 * CopyRect uses above changes so it works too. 00311 * 00312 * Revision 1.27 2002/01/08 20:52:47 dwilliss 00313 * Added version of ImageBegin that takes a rectangle instead of x,y,h,w 00314 * 00315 * Revision 1.26 2002/01/08 20:39:53 dwilliss 00316 * TextSetHeight now allows you to specify units 00317 * 00318 * Revision 1.25 2002/01/08 19:50:10 dwilliss 00319 * CreateContext no longer pure virtual. 00320 * 00321 * Revision 1.24 2002/01/08 18:57:10 dwilliss 00322 * Reworkded to move all class members to base class 00323 * 00324 * Revision 1.23 2002/01/04 21:28:08 dwilliss 00325 * Define use new mgd flag 00326 * 00327 * Revision 1.22 2002/01/04 14:59:45 dwilliss 00328 * Allow use again 00329 * 00330 * Revision 1.21 2002/01/02 22:49:31 dwilliss 00331 * Everything compiles now 00332 * 00333 * Revision 1.20 2001/12/31 16:57:52 dwilliss 00334 * GetColorSpace no longer pure virtual 00335 * 00336 * Revision 1.16 2001/12/24 16:50:53 dwilliss 00337 * Added some methods that old MGD had. 00338 * 00339 * Revision 1.15 2001/12/24 16:22:47 dwilliss 00340 * Added NoMultiPointSpan setting method 00341 * 00342 * Revision 1.8 2001/07/27 22:09:34 dwilliss 00343 * Added capability flag for being able to use a mask in PutImageSpan 00344 * 00345 * Revision 1.7 2001/07/26 20:57:10 dwilliss 00346 * Update font stuff to use new freetype 00347 * 00348 * Revision 1.6 2001/07/13 15:29:47 dwilliss 00349 * Some more Mac compile issues 00350 * 00351 * Revision 1.5 2001/07/13 15:11:14 dwilliss 00352 * Fixed Mac compiler errors 00353 * 00354 * Revision 1.4 2001/07/12 14:05:03 dwilliss 00355 * gcc didn't like #error with no quotes even though should be ifdef'd out 00356 * 00357 * Revision 1.1 2001/07/11 17:33:41 dwilliss 00358 * Initial revision 00359 * \endif 00360 */ 00361 00362 #ifndef INC_MI32_MGD2_H 00363 #define INC_MI32_MGD2_H 00364 00365 #define USE_NEW_MGD 00366 00367 #ifndef INC_MI32_STDDEFNS_H 00368 #include <mi32/stddefns.h> 00369 #endif 00370 00371 #ifndef INC_MI32_ELEMSTYL_H 00372 #include <mi32/elemstyl.h> 00373 #endif 00374 00375 #ifndef INC_MI32_MICON_H 00376 #include <mi32/micon.h> 00377 #endif 00378 00379 #ifndef INC_MI32_DISPINFO_H 00380 #include <mi32/dispinfo.h> 00381 #endif 00382 00383 #ifndef INC_MI32_COLORMAP_H 00384 #include <mi32/colormap.h> 00385 #endif 00386 00387 #ifndef INC_MI32_RECT_H 00388 #include <mi32/rect.h> 00389 #endif 00390 00391 #ifndef INC_MI32_POINT_H 00392 #include <mi32/point.h> 00393 #endif 00394 00395 #ifndef INC_MI32_SCRNUNIT_H 00396 #include <mi32/scrnunit.h> 00397 #endif 00398 00399 #ifndef INC_MI32_TEXTBASE_H 00400 #include <mi32/textbase.h> 00401 #endif 00402 00403 #ifndef INC_MI32_MILIST_H 00404 #include <mi32/milist.h> 00405 #endif 00406 00407 #ifndef INC_MI32_SIMPLEAR_H 00408 #include <mi32/simplear.h> 00409 #endif 00410 00411 #ifndef INC_MI32_COLOR_H 00412 #include <mi32/color.h> 00413 #endif 00414 00415 #ifndef INC_MI32_ERRCODES_H 00416 #include <mi32/errcodes.h> 00417 #endif 00418 00419 #ifndef INC_MI32_COLORSPC_H 00420 #include <mi32/colorspc.h> 00421 #endif 00422 00423 #ifndef INC_MI32_COLRCONV_H 00424 #include <mi32/colrconv.h> 00425 #endif 00426 #ifndef INC_MI32_COLRCONV_H 00427 #include <mi32/colrconv.h> 00428 #endif 00429 00430 #ifndef INC_MI32_POLYLINE_H 00431 #include <mi32/polyline.h> 00432 #endif 00433 00434 #ifndef INC_MI32_MG2CMS_H 00435 #include <mi32/mg2cms.h> 00436 #endif 00437 00438 #ifndef INC_MI32_TEXTID_H 00439 #include <mi32/textid.h> 00440 #endif 00441 00442 00443 #ifndef GENERATING_DOXYGEN_OUTPUT 00444 struct HATCHCOMPONENT; 00445 class MISTRING; 00446 class REGION2D; 00447 class SUBREGION2D; 00448 class LABELSTYLE; 00449 struct FTFACE; 00450 struct HATCHCOMPONENT; 00451 struct McbAnyCallbackStruct; 00452 class SAVEFONTFLAGS; 00453 namespace RVC { 00454 class STYLE; 00455 } 00456 namespace { 00457 class LOCALOPENFONTS; // Located in mg2text.c 00458 } 00459 #endif // GENERATING_DOXYGEN_OUTPUT 00460 00461 namespace MGD { 00462 00463 00464 //! This struct should be moved to a private include file, but we might 00465 //! yet find a use for it. 00466 struct STRINGDATA { 00467 STRINGDATA() {} 00468 ~STRINGDATA() {} 00469 00470 SIMPLE_ARRAY<UINT16> m_gid; 00471 SIMPLE_ARRAY<FTFACE*> m_face; 00472 SIMPLE_ARRAY<UINT16> m_gflags; 00473 SIMPLE_ARRAY<DPOINT2D> m_pos; 00474 MISTRING m_str; //!< May be used by overloaded _DrawGlyph() call 00475 private: 00476 #ifndef GENERATING_DOXYGEN_OUTPUT 00477 STRINGDATA(const STRINGDATA&); 00478 #endif // GENERATING_DOXYGEN_OUTPUT 00479 }; 00480 00481 typedef unsigned long PIXEL; 00482 00483 enum FONTTYPE { 00484 FONTTYPE_OF = 0, 00485 FONTTYPE_TTF = 1 00486 }; 00487 00488 enum ARROWTYPE { 00489 ARROWTYPE_FilledTriangle = 0, 00490 ARROWTYPE_UnfilledTriangle, 00491 ARROWTYPE_Open, 00492 ARROWTYPE_FilledArc 00493 }; 00494 00495 //! XXX How much of this is actually used? I don't think it's really 00496 //! even implemented except perhaps in the X implementation 00497 //! SetPixelFunc is used in etext.c, but sets GXinvert and GXxor, not 00498 //! these constants. 00499 //! mdview sets it to PIXELFUNC_Copy, which is the default anyway. 00500 enum PIXELFUNC { 00501 PIXELFUNC_Clear = 0, //!< 0 00502 PIXELFUNC_And, //!< src AND dst 00503 PIXELFUNC_AndReverse, //!< src AND NOT dst 00504 PIXELFUNC_Copy, //!< src 00505 PIXELFUNC_AndInverted, //!< NOT src AND dst 00506 PIXELFUNC_NoOp, //!< dst 00507 PIXELFUNC_ExclusiveOr, //!< src XOR dst 00508 PIXELFUNC_Or, //!< src OR dst 00509 PIXELFUNC_Nor, //!< NOT src AND NOT dst 00510 PIXELFUNC_Equiv, //!< NOT src XOR dst 00511 PIXELFUNC_Invert, //!< NOT dst 00512 PIXELFUNC_OrReverse, //!< src OR NOT dst 00513 PIXELFUNC_CopyInverted, //!< NOT src 00514 PIXELFUNC_OrInverted, //!< NOT src OR dst 00515 PIXELFUNC_NotAnd, //!< NOT src OR NOT dst 00516 PIXELFUNC_Set //!< 1 00517 }; 00518 00519 enum SHAPECLOSE { 00520 SHAPECLOSE_None = 0, 00521 SHAPECLOSE_Direct, 00522 SHAPECLOSE_ViaCenter 00523 }; 00524 00525 enum DEPTHTEST { 00526 DEPTHTEST_None = 0, 00527 DEPTHTEST_SetOnly = 1, 00528 DEPTHTEST_CheckAndSet = 2 00529 }; 00530 00531 enum LINECAP { 00532 LINECAP_NotLast = 0, 00533 LINECAP_Butt, 00534 LINECAP_Round, 00535 LINECAP_Projecting 00536 }; 00537 00538 enum LINEJOIN { 00539 LINEJOIN_Miter = 0, 00540 LINEJOIN_Round, 00541 LINEJOIN_Bevel 00542 }; 00543 00544 enum POLYSHAPE { 00545 POLYSHAPE_Complex = 0, //!< Polygon may or may not be convex. 00546 POLYSHAPE_NonConvex, //!< Polygon is known to be non-convex. 00547 POLYSHAPE_Convex //!< Polygon is convex (does not double back on itself at all) 00548 }; 00549 00550 enum CAPABILITY { 00551 CAPABILITY_None = 0, 00552 CAPABILITY_Transparency = 0x00000001, //!< Can do transparency 00553 CAPABILITY_3D = 0x00000002, 00554 CAPABILITY_InterfaceText = 0x00000004, 00555 CAPABILITY_ScanColorUse = 0x00000008, 00556 CAPABILITY_CopyRect = 0x00000010, 00557 CAPABILITY_GetImage = 0x00000020, 00558 CAPABILITY_MaskInImageSpan = 0x00000040, //!< PutImageSpan can use a mask array 00559 CAPABILITY_TransparencyIsExpensive = 0x00000080, //!< Can do it, but don't bother for anti-aliasing text. 00560 CAPABILITY_ComplexClip = 0x00000100, //!< Device handles clip regions 00561 CAPABILITY_BitmapFill = 0x00000200 //!< Implements its own, optimized bitmap pattern fill in FillSpan 00562 }; 00563 00564 DEFINE_ENUM_OPERATORS(CAPABILITY); 00565 00566 enum BASELINE { 00567 BASELINE_Unspecified = 0, 00568 BASELINE_Straight = 0x00000001, 00569 BASELINE_Spline = 0x00000002, 00570 BASELINE_Nonconvex = 0x00000004 00571 }; 00572 DEFINE_ENUM_OPERATORS(BASELINE); 00573 00574 enum TEXTBORDER { 00575 TEXTBORDER_None = 0, 00576 TEXTBORDER_SingleLine = 1, 00577 TEXTBORDER_DoubleLine = 2 00578 }; 00579 00580 00581 //! Flags for DrawXxxxStyleSample() 00582 enum STYLESAMPLEFLAGS { 00583 STYLESAMPLE_Default = 0x0000, 00584 STYLESAMPLE_ShrinkToFit = 0x0001, 00585 STYLESAMPLE_ForceToFit = 0x0002, 00586 STYLESAMPLE_ZigZag = 0x0004, //!< /\/ line sample 00587 STYLESAMPLE_RoundRect = 0x0008, //!< "rounded" rectangles 00588 STYLESAMPLE_NoScaleToMap = 0x0010, //!< Disable scaling to map, use symbol/pattern design scale 00589 STYLESAMPLE_CenterSymbol = 0x0020 //!< Center symbol 00590 }; 00591 DEFINE_ENUM_OPERATORS(STYLESAMPLEFLAGS); 00592 00593 00594 enum EMBEDPERMISSION { 00595 EMBEDPERMISSION_All = 0, 00596 EMBEDPERMISSION_Restricted = 0x00000002, 00597 EMBEDPERMISSION_PreviewPrint = 0x00000004, 00598 EMBEDPERMISSION_Editable = 0x00000008, 00599 EMBEDPERMISSION_NoSubset = 0x00000100 00600 }; 00601 00602 DEFINE_ENUM_OPERATORS(EMBEDPERMISSION); 00603 00604 00605 enum ICONFLAGS { 00606 ICON_OriginTop = 0x00000000, 00607 ICON_OriginLeft = 0x00000000, 00608 ICON_OriginBottom = 0x00000001, 00609 ICON_OriginRight = 0x00000002, 00610 ICON_OriginCenterX = 0x00000004, 00611 ICON_OriginCenterY = 0x00000008, 00612 ICON_OriginTopLeft = (ICON_OriginTop|ICON_OriginLeft), 00613 ICON_OriginTopCenter = (ICON_OriginTop|ICON_OriginCenterX), 00614 ICON_OriginTopRight = (ICON_OriginTop|ICON_OriginRight), 00615 ICON_OriginCenterLeft = (ICON_OriginCenterY|ICON_OriginLeft), 00616 ICON_OriginCenter = (ICON_OriginCenterY|ICON_OriginCenterX), 00617 ICON_OriginCenterRight = (ICON_OriginCenterY|ICON_OriginRight), 00618 ICON_OriginBottomLeft = (ICON_OriginBottom|ICON_OriginLeft), 00619 ICON_OriginBottomCenter = (ICON_OriginBottom|ICON_OriginCenterX), 00620 ICON_OriginBottomRight = (ICON_OriginBottom|ICON_OriginRight), 00621 ICON_Dimmed = 0x00000010 //!< Draw "dimmed" (stippled) icon 00622 }; 00623 DEFINE_ENUM_OPERATORS(ICONFLAGS); 00624 00625 enum BUILTINFILLSTYLE { 00626 BUILTINFILLSTYLE_Solid = 0, 00627 BUILTINFILLSTYLE_50pct, //!< Every other pixel in a checkerboard pattern 00628 BUILTINFILLSTYLE_OneIn2x2, //!< 2x2 pattern with one pixel on 00629 BUILTINFILLSTYLE_OneIn4x4, //!< 4x4 pattern with one pixel on 00630 BUILTINFILLSTYLE_OneIn6x6, //!< 6x6 pattern with one pixel on 00631 BUILTINFILLSTYLE_OneIn8x8, //!< 8x8 pattern with one pixel on 00632 BUILTINFILLSTYLE_Hatch8L, //!< 45 degree hatch every 8 pixels (going down to the left) 00633 BUILTINFILLSTYLE_Hatch8R, //!< 45 degree hatch every 8 pixels (going down to the right) 00634 00635 }; 00636 00637 //! These constants are defined by the TrueType spec and are used for MgdTextGetTTFName() 00638 enum TTFNAMEID { 00639 TTFNAMEID_Copyright = 0, //!< eg: "Copyright Apple Computer, Inc. 1992" 00640 TTFNAMEID_Family = 1, //!< eg: "New York" 00641 TTFNAMEID_Style = 2, //!< eg: "Bold" 00642 TTFNAMEID_ID = 3, //!< eg: "Apple Computer New York Bold version 1.0" 00643 TTFNAMEID_FullName = 4, //!< eg: "New York Bold" 00644 TTFNAMEID_Version = 5, //!< eg: "August 10, 1991, 1.08d21" 00645 TTFNAMEID_PostScript = 6, //!< eg: "Times-Bold" 00646 TTFNAMEID_Trademark = 7, 00647 TTFNAMEID_Designer = 8 00648 }; 00649 00650 //! Special characters in array of Glyph IDs (GID) returned from 00651 //! FONT.UCtoGID(). When rendering or computing string width, 00652 //! These shoul be passed through to let the rendering engine handle them 00653 //! XXX These should be private to mg2textt.c and mgdtext.c 00654 #define MgdTEXTGID_ChangeFace 0xFFFF 00655 #define MgdTEXTGID_LeftToRight 0xFFFE 00656 #define MgdTEXTGID_RightToLeft 0xFFFD 00657 #define MgdTEXTGID_NextGlyph0Width 0xFFFC 00658 #define MgdTEXTGID_FallbackFace 0xFFFB 00659 #define MgdTEXTGID_SpecialCodeMin 0xFFFB //!< For quicker comparison 00660 00661 #ifndef GENERATING_DOXYGEN_OUTPUT 00662 class CONTEXT; // Forward Declarations 00663 class DEVICE_MEM1; 00664 class DEVICE_MEM1_SPARSE; 00665 class DEVICE_MEM8G; 00666 #endif // GENERATING_DOXYGEN_OUTPUT 00667 00668 //! Information about single glyph in a font. 00669 struct GLYPHINFO { 00670 double lbearing; //!< Pixels between glyph origin and left edge 00671 double rbearing; //!< Pixels between glyph origin and right edge 00672 double rspacing; //!< Pixels between glyph origin and next character 00673 double ascent; //!< Pixels between glyph origin and top 00674 double descent; //!< Pixels between glyph origin and bottom 00675 }; 00676 00677 //! Font metrics. 00678 struct FONTINFO { 00679 double ascent; //!< Ascent above baseline in pixels 00680 double descent; //!< Descent below baseline in pixels 00681 double linespace; //!< Spacing between baselines 00682 UINT16 NumGlyphs; //!< Number of glyphs in font 00683 UINT16 InitChar; //!< Initial character having glyph defined 00684 UINT16 LastChar; //!< Last character having glyph defined 00685 UINT16 NullChar; //!< Character to user for undefined glyphs 00686 }; 00687 00688 //! Font definition and implementation. 00689 class FONT { 00690 public: 00691 00692 enum MODE { 00693 MODE_UNICODE, //!< Using Unicode 00694 MODE_RAWGID, //!< Glyph IDs instead of Unicode 00695 MODE_GID //!< Glyph IDs encoded by UCtoGID member function 00696 }; 00697 00698 enum FONTTYPE { 00699 FONTTYPE_OF, 00700 FONTTYPE_TTF 00701 }; 00702 00703 //! Read a TrueType font into memory. 00704 //! 00705 //! The "name" parameter is expected to be the filename, minus the path 00706 //! or extention. 00707 //! 00708 //! The FaceNum parameter is for TrueType Collections (ttc). A ttc file 00709 //! contains multiple ttfs 00710 //! Since TrueType fonts are embeded in resource files on the Macintosh 00711 //! (even in OS X), a simple "filename" isn't all that useful. This 00712 //! function handles reading the whole thing. 00713 static ERRVALUE ReadTTF ( 00714 const UNICODE* name, 00715 SIMPLE_ARRAY<UINT8>& data 00716 ); 00717 00718 FONT(); 00719 00720 virtual ~FONT(); 00721 00722 virtual int DrawGlyph ( 00723 MGD::CONTEXT* context, 00724 double dx, 00725 double dy, 00726 double baseangle, 00727 const UNICODE* ucstr, 00728 MGD::FONT::MODE mode 00729 ) = 0; 00730 00731 virtual int DrawGlyph ( 00732 MGD::CONTEXT* context, 00733 double dx, 00734 double dy, 00735 double baseangle, 00736 const STRINGDATA& string, 00737 int n 00738 ) = 0; 00739 00740 virtual double NextPosition ( 00741 MGD::CONTEXT* context, 00742 double* retx, 00743 double* rety, 00744 double baseangle, 00745 const STRINGDATA& string, 00746 int n, 00747 double SpaceExtra = 0.0, //!< Extra pixels per space to insert 00748 double GlyphExtra = 0.0 00749 ) = 0; 00750 00751 virtual int GetFontMetrics ( 00752 MGD::CONTEXT* context, 00753 MGD::FONTINFO& fontinfo 00754 ) = 0; 00755 00756 virtual int GetGlyphMetrics ( 00757 MGD::CONTEXT* context, 00758 UNICODE ch, 00759 MGD::GLYPHINFO& glyphinfo, 00760 MGD::FONT::MODE mode 00761 ) = 0; 00762 00763 virtual int GetGlyphExtents ( 00764 MGD::CONTEXT* context, 00765 const double& dx, 00766 const double& dy, 00767 const double& baseangle, 00768 UNICODE ch, 00769 DRECT2D& extents, 00770 MGD::FONT::MODE mode 00771 ) = 0; 00772 00773 virtual bool IsEmbeddable ( 00774 ) const = 0; 00775 00776 virtual int UCtoGID ( 00777 MGD::CONTEXT* context, 00778 const UNICODE* uc, 00779 MGD::STRINGDATA& strdata 00780 ) = 0; 00781 00782 const UNICODE* GetFontName ( 00783 ) const { 00784 return (m_fontname); 00785 } 00786 00787 virtual MGD::FONT::FONTTYPE GetFontType ( 00788 ) const = 0; 00789 00790 //! Get the outline of a glyph. This only works for TrueType 00791 //! fonts, but the caller won't have access to the TrueType-derived 00792 //! MGD::FONT_TTF. So we make it virtual and let it return an 00793 //! error by default. We could easily implement it for OF fonts 00794 //! too if it was ever needed. 00795 virtual ERRVALUE GetGlyphOutline ( 00796 UINT16 GlyphIndex, 00797 INT32 *NumContours, 00798 LPOLYGON **Def, 00799 UINT32 FontFlags 00800 ) { 00801 return (EProgramError); 00802 } 00803 00804 UNICODE GetInitChar ( 00805 ) const { 00806 return (m_InitChar); 00807 } 00808 00809 UNICODE GetLastChar ( 00810 ) const { 00811 return (m_LastChar); 00812 } 00813 00814 UNICODE GetNULLChar ( 00815 ) const { 00816 return (m_NullChar); 00817 } 00818 00819 UNICODE GetNumGlyphs ( 00820 ) const { 00821 return (m_NumGlyphs); 00822 } 00823 00824 protected: 00825 UNICODE m_fontname[32]; 00826 UNICODE m_filename[FILENAME_MAX]; 00827 UINT16 m_NumGlyphs; //!< Number of glyphs in font 00828 UNICODE m_InitChar; //!< Initial character having glyph defined 00829 UNICODE m_LastChar; //!< Last character having glyph defined 00830 UNICODE m_NullChar; //!< Character to user for undefined glyphs 00831 }; 00832 00833 00834 struct TEXTSETTINGS : public TEXTSTYLE { //! Text drawing parameters 00835 PIXEL ForegroundPixel; 00836 PIXEL BackgroundPixel; 00837 PIXEL UnderlinePixel; 00838 00839 TEXTSETTINGS ( 00840 ) { 00841 Reset(); 00842 } 00843 00844 double GetBoldness ( 00845 ) const { 00846 return (BoldnessWidth); 00847 } 00848 00849 void Reset ( 00850 ); 00851 00852 }; 00853 00854 00855 //! Text block border settings. 00856 struct TEXTBLOCKBORDER { 00857 UINT16 Type; //!< Border type 00858 UINT16 WidthUnits; //!< Units for line width (SCREENUNIT_...) 00859 float Width; //!< Line or border width 00860 COLOR Color; //!< Line color 00861 00862 TEXTBLOCKBORDER() { 00863 memset(this, 0, sizeof(TEXTBLOCKBORDER)); 00864 } 00865 }; 00866 00867 //! Text block. 00868 struct TEXTBLOCK { 00869 const UNICODE *Text; //!< Encoded text string. Note, TEXTBLOCK does not actually own the text and will not free it. 00870 TEXTSTYLE Style; //!< Initial style 00871 DPOINT2D basepoint; //!< Base point in display coordinates 00872 double baseangle; //!< Rotation angle in radians 00873 TEXTBASEORIGIN baseorigin; //!< Origin of basepoint within block 00874 COLOR Background; //!< Background color 00875 COLOR ShadowTop; //!< "Top shadow" color, usually brighter than background 00876 COLOR ShadowBottom; //!< "Bottom shadow" color, usually darker than background 00877 TEXTBLOCKBORDER Frame; 00878 TEXTBLOCKBORDER LeftBorder; 00879 TEXTBLOCKBORDER RightBorder; 00880 TEXTBLOCKBORDER TopBorder; 00881 TEXTBLOCKBORDER BottomBorder; 00882 float MarginH; 00883 float MarginV; 00884 UINT16 MarginUnits; 00885 00886 //! XXX ??? Seems to be unimplemented? 00887 ERRVALUE TextBlockGetFirstString ( 00888 MISTRING& string //!< String returned 00889 ); 00890 00891 TEXTBLOCK(); 00892 00893 ~TEXTBLOCK(); 00894 }; 00895 00896 00897 00898 //! \class DEVICE 00899 //! \brief Base class for all MGD::DEVICE derived classes 00900 //! 00901 //! @note The default constructor is protected, so you can't declare 00902 //! an MGD::DEVICE by itself. You must use one of the derived classes. 00903 class DEVICE { 00904 00905 public: 00906 00907 // Default constructor is protected. 00908 00909 //! Destructor 00910 virtual ~DEVICE ( 00911 ); 00912 00913 // (Note: copy constructor private and unimplemented. Can't copy one.) 00914 00915 00916 //! Returns true if the derived class is based on an implementation 00917 //! where fill spans are considered "bad". This is used by the 00918 //! implementation of text drawing functions to know if they should 00919 //! be drawn as fillspans of call FillPolygons 00920 bool AvoidFillSpans ( 00921 ) const { 00922 return (v_AvoidFillSpans()); 00923 } 00924 00925 //! Set the colormap for the display. Derived class should override this 00926 //! if it cares about colormaps. If not, the default version just ignores 00927 //! the caller. 00928 //! 00929 //! XXX Old version took a COLORMAPINFO which was passed to 00930 //! CompOptmFromColMap(). Has RedBits, GreenBits, BlueBits. 00931 //! What are these? 00932 ERRVALUE ChangeColorMap ( 00933 const SIMPLE_ARRAY<COLOR>& colors 00934 ) { 00935 return (v_ChangeColorMap(colors)); 00936 } 00937 00938 //! Clear the ICM Profile of the destination device. 00939 void ClearICMDestProfile ( 00940 ) { 00941 m_DestProfile.Free(); 00942 } 00943 00944 //! Clear the ICM Profile of the proofing device 00945 void ClearICMProofProfile ( 00946 ); 00947 00948 //! Create a GC for drawing. 00949 //! 00950 //! Derived classes may override this and make it return anything 00951 //! derived from MGD::CONTEXT. MGD::CONTEXT's constructor is private, so 00952 //! this is the only way for calling code to create a GC. 00953 //! 00954 MGD::CONTEXT* CreateContext ( 00955 ); 00956 00957 //! If the display is going to support 3D, then it should allocate its depth 00958 //! buffer here. If overriding this, also be sure to override 00959 //! Is3DInitialized() so that it will return true if DepthInit3D() has been 00960 //! called and override CanDo3D() to return true. 00961 //! 00962 //! This implementation allocates an in-memory buffer if the device 00963 //! size is <= 1024 x 1024. If it's bigger, it allocates a temporary 00964 //! raster to hold the data. 00965 //! 00966 //! 3D implementation code can call GetDepthBuffer() to get the depth 00967 //! buffer for a given span of data. 00968 ERRVALUE DepthInit3D ( 00969 ) { 00970 return (v_DepthInit3D()); 00971 } 00972 00973 //! Destroy a GC. 00974 //! 00975 //! Not strictly necessary, but it balances the CreateGC() method nicely. 00976 //! You can just "delete" an MGD::CONTEXT. 00977 // Would inline this, but the compiler complains that MGD::CONTEXT is incomplete 00978 // and won't let me "delete" one here. 00979 void DestroyContext ( 00980 MGD::CONTEXT* gc 00981 ); 00982 00983 //! Return true if DepthInit3D() has been called. 00984 //! Derived class should override this to return true if DepthInit3D has 00985 //! been called. 00986 bool Is3DInitialized ( 00987 ) const { 00988 return (m_zbuf != 0); 00989 } 00990 00991 //! Return true if the display is for an X drawable 00992 bool IsX11 ( 00993 ) const { 00994 return (v_IsX11()); 00995 } 00996 00997 //! Get the ColorMap for the device. Will return NULL 00998 //! if the device doesn't use one. 00999 const SIMPLE_ARRAY<COLOR>* GetColorMap ( 01000 ) const { 01001 return (&m_ColorMap); 01002 } 01003 01004 //! Get the ColorMapInfo structure for this device 01005 //! Will return NULL if the device doesn't have one. 01006 //! Will be depricated. Use GetColorMap() instead 01007 const COLMAPINFO* GetColorMapInfo ( 01008 ) { 01009 memset(&m_ColorMapInfo, 0, sizeof(COLMAPINFO)); 01010 m_ColorMapInfo.colmap = const_cast<COLOR*>((const COLOR*)GetColorMap()); 01011 m_ColorMapInfo.NumColors = GetColorMap()->GetNumItems(); 01012 //! The rest of the structure is never used any more 01013 return (&m_ColorMapInfo); 01014 } 01015 01016 //! Given a color, return the Pixel value that matches (or is as close 01017 //! possible) 01018 //! Does NOT take ICM into account. The one in context does. 01019 01020 #if !defined(NO_DEPRECATED) 01021 //! Deprecated because you should call the one in the context 01022 //! \deprecated Call the version in the context 01023 PIXEL GetColorPixel ( 01024 const COLOR& color 01025 ) { 01026 return (v_GetColorPixel(color)); 01027 } 01028 #endif 01029 01030 //! Return the "native" COLORSPACE used by the display 01031 //! Image operations using this colorspace will be more effeciant. 01032 //! Default implementation determines the colorspace from the 01033 //! DeviceInfo 01034 COLORSPACE GetColorSpace ( 01035 ) const { 01036 return (v_GetColorSpace()); 01037 } 01038 01039 //! return the depth at a given pixel location. 01040 //! This is GC-indapendant. 01041 float GetDepth3D ( 01042 INT32 x, 01043 INT32 y 01044 ) { 01045 return (v_GetDepth3D(x, y)); 01046 } 01047 01048 const DISPLAYINFO& GetDeviceInfo ( 01049 ) const { 01050 return m_devinfo; 01051 } 01052 01053 const LRECT2D& GetExtents ( 01054 ) const { 01055 return m_Extents; 01056 } 01057 01058 INT32 GetHeight ( 01059 ) const { 01060 return (GetExtents().GetHeight()); 01061 } 01062 01063 01064 int GetImageBytesPerPixel ( 01065 ) const { 01066 return m_ImageBytesPerPixel; 01067 } 01068 01069 //! Return the number of bytes needed to hold one line of image data 01070 //! Should be overridden by derived class unless images are not possible 01071 //! (such as a pen plotter) 01072 INT32 GetLineBytes ( 01073 ) const { 01074 return (v_GetLineBytes()); 01075 } 01076 01077 //! Determine if full image lines are needed (no tiled output). 01078 bool GetNeedFullImageLine ( 01079 ) const { 01080 return (v_GetNeedFullImageLine()); 01081 } 01082 01083 //! Get the OPTMPARM structure for the device. Will return NULL 01084 //! if the device doesn't use one. 01085 const OPTMPARM* GetOptmParm ( 01086 ) const { 01087 return (&m_optmparm); 01088 } 01089 01090 #if !defined(NO_DEPRECATED) 01091 //! Given a pixel value, return the color it represents 01092 //! \deprecated Call the one in the context instead 01093 void GetPixelColor ( 01094 PIXEL pixel, 01095 COLOR& color 01096 ) const { 01097 v_GetPixelColor(pixel, color); 01098 } 01099 #endif 01100 01101 //! Return the pixel size in millimeters, assuming square pixels. 01102 //! This method will cope with "this" being NULL by returning the 01103 //! pixel size of a NULL device 01104 double GetPixelSizeMM ( 01105 ) const; 01106 01107 //! Return the pixel size in millimeters without assuming squareness 01108 //! This method will cope with "this" being NULL by returning the 01109 //! pixel size of a NULL device 01110 void GetPixelSizeMM ( 01111 double& xsize, 01112 double& ysize 01113 ) const; 01114 01115 //! Return the pixel size in DPI, assuming square pixels. 01116 double GetPixelSizeDPI ( 01117 ) const { 01118 return ((1000.0 / METERSTOINCHES) / GetPixelSizeMM()); 01119 } 01120 01121 //! Return the pixel size in DPI without assuming squareness 01122 void GetPixelSizeDPI ( 01123 double& xsize, 01124 double& ysize 01125 ) const { 01126 double x, y; 01127 GetPixelSizeMM(x, y); 01128 xsize = (1000.0 / METERSTOINCHES) / x; 01129 ysize = (1000.0 / METERSTOINCHES) / y; 01130 } 01131 01132 INT32 GetWidth ( 01133 ) const { 01134 return (GetExtents().GetWidth()); 01135 } 01136 01137 bool HasCapability ( 01138 MGD::CAPABILITY capability 01139 ) { 01140 return ((v_GetCapabilities() & capability) != 0); 01141 } 01142 01143 //! Scan the image for color usage. 01144 //! (may not need for all implementations?) 01145 ERRVALUE ScanColorUse ( 01146 HISTORGB& historgb 01147 ) { 01148 return (v_ScanColorUse(historgb)); 01149 } 01150 01151 const PROFILE& GetICMDestProfile ( 01152 ) const { 01153 return (m_DestProfile); 01154 } 01155 01156 PROFILE::INTENT GetICMIntent ( 01157 ) const { 01158 return m_ICMIntent; 01159 } 01160 01161 //! Set the ICM Profile of the destination device. 01162 void SetICMDestProfile ( 01163 const PROFILE& profile, 01164 PROFILE::INTENT intent = PROFILE::INTENT_Perceptual 01165 ); 01166 01167 //! Set the ICM Profile of the destination device. 01168 void SetICMDestProfile ( 01169 const PROFILEPARMS_PRINTER& profile 01170 ); 01171 01172 //! Set the ICM Profile of the destination device to the currently 01173 //! selected Screen profile (Selected in the TNTmips preferences) 01174 void SetICMDestProfileScreen ( 01175 ); 01176 01177 //! Set the ICM Profile of the proofing device 01178 //! If set, will cause images and colors to be mapped to the gamut of 01179 //! the proofing device (printer) before being mapped to the gamut of 01180 //! the Dest device. This way, the Dest device (screen) won't show any 01181 //! colors which the Proofing device (printer) is incapable of rendering. 01182 void SetICMProofProfile ( 01183 const PROFILEPARMS_PRINTER& profile 01184 ); 01185 01186 //! Set the pixel size in millimeters without assuming squareness 01187 void SetPixelSizeMM ( 01188 double xsize, 01189 double ysize 01190 ) { 01191 m_mmPerPixel.x = xsize; 01192 m_mmPerPixel.y = ysize; 01193 return; 01194 } 01195 01196 protected: 01197 LRECT2D m_Extents; //!< All implementations need this 01198 OPTMPARM m_optmparm; //!< move to derived class? GetColorPixel uses it 01199 PIXEL m_AllPlanesMask; 01200 int m_ImageBytesPerPixel; 01201 DPOINT2D m_mmPerPixel; 01202 SIMPLE_ARRAY<COLOR> m_ColorMap; 01203 COLMAPINFO m_ColorMapInfo; //!< Only for old code 01204 LPOINT2D m_TileSize; //!< Raster tile size hint (0's if tiles not helpful) 01205 01206 01207 //! Constructor. 01208 //! 01209 //! Because we could get an error while allocating an MGD::DEVICE, 01210 //! and we don't deal with exception handling code, 01211 //! the constructor should only initialize the class members. 01212 //! Each derived class should have an Initialize() method to 01213 //! actually allocate memory. This would be a pure-virtual 01214 //! function, but the parameters necessary are likely to be 01215 //! implementation dependant. For example, the raster implementation 01216 //! would need to take an RVC::RASTER object or something. 01217 //! An X implementation would require a Drawable, etc... 01218 //! 01219 DEVICE(); 01220 01221 virtual ERRVALUE v_CopyColorMap ( 01222 SIMPLE_ARRAY<COLOR> colors 01223 ) { 01224 return (0); 01225 } 01226 01227 //! Fill a horizontal span. 01228 //! 01229 //! Many of the default method implementations call this to do all the work. 01230 //! Not all of them even need it., so not pure-virtual. 01231 //! Derived classes that implement this do not need to worry about 01232 //! clipping, as the default implementation in CONTEXT does 01233 //! clipping and then calls this version. 01234 //! 01235 //! If your implementation handles bitmap pattern fills in a way that's 01236 //! optimized for your dest device, you should return CAPABALITY_BitmapFill 01237 //! in GetCapabilities 01238 virtual ERRVALUE v_FillSpan ( 01239 MGD::CONTEXT* gc, 01240 INT32 x1, 01241 INT32 x2, 01242 INT32 y 01243 ) { 01244 return (0); 01245 } 01246 01247 PIXEL GetAllPlanesMask ( 01248 ) const { 01249 return (m_AllPlanesMask); 01250 } 01251 01252 //! Return a list of the capabilities of this device. 01253 //! Don't forget to OR in the capabilities of the base class in the derived class 01254 virtual CAPABILITY v_GetCapabilities ( 01255 ) const { 01256 return CAPABILITY_3D; 01257 } 01258 01259 //! Get a pointer to the depth buffer for a given location. 01260 //! Since this is protected, it's assumed that you've already 01261 //! validated the coordinates. If the depth buffer is all in memory, 01262 //! this returns a pointer into that buffer. If it's being spooled 01263 //! to a temporary file, it reads the requested part into a buffer 01264 //! and returns that buffer. In the temporary raster case, each call 01265 //! to GetDepthBuffer() reuses the same buffer. After modifying the 01266 //! depth buffer, you should call WriteDepthBuffer(). WriteDepthBuffer() 01267 //! does nothing unless the depth buffer is from a temporary raster, in 01268 //! which case it writes it back out. 01269 //! This function will return NULL if the depth buffer is not initialized 01270 //! or if reading from the temporary raster would cause an error. 01271 float* GetDepthBuffer ( 01272 INT32 x, 01273 INT32 y, 01274 INT32 len 01275 ); 01276 01277 //! Return a pointer to a piece of the image buffer. 01278 //! This only has to be implemented if HasCapability(CAPABILITY_GetImage) 01279 //! returns true. The CopyRect() routines use it to read the source image. 01280 //! Note that this may return a pointer directly into the screen buffer 01281 //! or a temporary buffer into which it has read the requested data. It's 01282 //! up to the implementation to decide how to handle this. 01283 UINT8* GetImagePointer ( 01284 INT32 x, 01285 INT32 y, 01286 INT32 len 01287 ) { 01288 return (v_GetImagePointer(x, y, len)); 01289 } 01290 01291 01292 //! Same as GetImagePointer() but returns a const pointer. 01293 const UINT8* GetImagePointerConst ( 01294 INT32 x, 01295 INT32 y, 01296 INT32 len 01297 ) { 01298 return (v_GetImagePointer(x, y, len)); 01299 } 01300 01301 //! If GetImagePointer returns a pointer directly into the frame buffer, 01302 //! this function does not need to be overridden. 01303 //! If GetImagePointer has to actually read something (say via an X 01304 //! call to the display or reading out of a raster, then this version 01305 //! should just return a temporary buffer big enough to hold a single 01306 //! line. 01307 UINT8* GetImagePointerNoRead ( 01308 INT32 x, 01309 INT32 y, 01310 INT32 len 01311 ) { 01312 return (v_GetImagePointerNoRead(x, y, len)); 01313 } 01314 01315 //! Sets the bits, shift, and mask parameters of the DEVICEINFO 01316 //! Currently only handles 16 and 24 bit RGB and BGR cases 01317 void SetDeviceColorSpace ( 01318 COLORSPACE colorspace 01319 ); 01320 01321 //! To be called by Create() method to set stuff up. 01322 ERRVALUE SetDeviceInfo ( 01323 const DISPLAYINFO& dispinfo 01324 ); 01325 01326 //! Update the Depth Buffer. 01327 //! Does nothing unless the Depth Buffer is initialized and 01328 //! is using a raster for depth buffering. 01329 ERRVALUE WriteDepthBuffer ( 01330 INT32 x, 01331 INT32 y, 01332 INT32 len, 01333 const float* zbuf 01334 ); 01335 01336 //! Write an image buffer to the display 01337 //! If GetImagePointer reutrns a pointer directly into the frame buffer, 01338 //! this method can just return 0. If GetImagePointer has to actually 01339 //! read something, this method is used to write the result back out. 01340 //! Typically used when drawing to a raster 01341 ERRVALUE WriteImageBuffer ( 01342 INT32 x, 01343 INT32 y, 01344 INT32 len, 01345 UINT8* buf 01346 ) { 01347 return (v_WriteImageBuffer(x, y, len, buf)); 01348 } 01349 01350 01351 private: 01352 #ifndef GENERATING_DOXYGEN_OUTPUT 01353 //! Copy constructor private and unimplemented 01354 DEVICE(const DEVICE&); 01355 01356 01357 friend class CONTEXT; //!< Is allowed access to FillSpan() 01358 01359 01360 float* m_zbuf; 01361 int m_zrhandle; //!< Handle for Z buffer if it's a raster 01362 int m_zfhandle; //!< Handle for Z buffer if it's a raster 01363 DISPLAYINFO m_devinfo; //!< MUST call Set method to modify 01364 01365 PROFILE m_DestProfile; 01366 PROFILE::INTENT m_ICMIntent; 01367 PROFILEPARMS_PRINTER m_ProofProfileParms; 01368 01369 static void MCB_ScreenProfileChanged ( 01370 McbAnyCallbackStruct*, 01371 void* 01372 ); 01373 #endif // GENERATING_DOXYGEN_OUTPUT 01374 01375 //! Given a color, return the Pixel value that matches (or is as close 01376 //! possible). This should NOT take ICM into account. The context will 01377 //! have already translated the color through the ICM transform (if any) 01378 //! before calling this function 01379 virtual PIXEL v_GetColorPixel ( 01380 const COLOR& color 01381 ); 01382 01383 //! Return a pointer to a piece of the image buffer. 01384 //! This only has to be implemented if HasCapability(CAPABILITY_GetImage) 01385 //! returns true. The CopyRect() routines use it to read the source image. 01386 //! Note that this may return a pointer directly into the screen buffer 01387 //! or a temporary buffer into which it has read the requested data. It's 01388 //! up to the implementation to decide how to handle this. 01389 virtual UINT8* v_GetImagePointer ( 01390 INT32 x, 01391 INT32 y, 01392 INT32 len 01393 ) { 01394 return (0); 01395 } 01396 01397 //! If GetImagePointer returns a pointer directly into the frame buffer. 01398 //! this function does not need to be overridden. 01399 //! If GetImagePointer has to actually read something (say via an X 01400 //! call to the display or reading out of a raster, then this version 01401 //! should just return a temporary buffer big enough to hold a single 01402 //! line. 01403 virtual UINT8* v_GetImagePointerNoRead ( 01404 INT32 x, 01405 INT32 y, 01406 INT32 len 01407 ) { 01408 return (v_GetImagePointer(x, y, len)); 01409 } 01410 01411 //! Given a pixel value, return the color it represents. 01412 //! This should NOT take ICM into account. The context will translate 01413 //! the color back through the inverse ICM transform (if any) 01414 virtual void v_GetPixelColor ( 01415 PIXEL pixel, 01416 COLOR& color 01417 ) const; 01418 01419 //! Return true if the display is for an X drawable. 01420 virtual bool v_