QuickdrawText.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:16k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       QuickdrawText.h
  3.  
  4.      Contains:   Quickdraw Text Interfaces.
  5.  
  6.      Version:    Technology: Mac OS 8.5
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1983-2001 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QUICKDRAWTEXT__
  18. #define __QUICKDRAWTEXT__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __MIXEDMODE__
  23. #include "MixedMode.h"
  24. #endif
  25. #if PRAGMA_ONCE
  26. #pragma once
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #if PRAGMA_IMPORT
  32. #pragma import on
  33. #endif
  34. #if PRAGMA_STRUCT_ALIGN
  35.     #pragma options align=mac68k
  36. #elif PRAGMA_STRUCT_PACKPUSH
  37.     #pragma pack(push, 2)
  38. #elif PRAGMA_STRUCT_PACK
  39.     #pragma pack(2)
  40. #endif
  41. /* new CGrafPort bottleneck ("newProc2") function, used in Unicode Text drawing */
  42. EXTERN_API_C( OSStatus )
  43. StandardGlyphs                  (void *                 dataStream,
  44.                                  ByteCount              size);
  45. enum {
  46.                                                                 /* CharToPixel directions */
  47.     leftCaret                   = 0,                            /*Place caret for left block*/
  48.     rightCaret                  = -1,                           /*Place caret for right block*/
  49.     kHilite                     = 1                             /*Direction is SysDirection*/
  50. };
  51. enum {
  52.     smLeftCaret                 = 0,                            /*Place caret for left block - obsolete */
  53.     smRightCaret                = -1,                           /*Place caret for right block - obsolete */
  54.     smHilite                    = 1                             /*Direction is TESysJust - obsolete */
  55. };
  56. enum {
  57.                                                                 /*Constants for styleRunPosition argument in PortionLine, DrawJustified, MeasureJustified, CharToPixel, and PixelToChar.*/
  58.     onlyStyleRun                = 0,                            /* This is the only style run on the line */
  59.     leftStyleRun                = 1,                            /* This is leftmost of multiple style runs on the line */
  60.     rightStyleRun               = 2,                            /* This is rightmost of multiple style runs on the line */
  61.     middleStyleRun              = 3,                            /* There are multiple style runs on the line and this is neither the leftmost nor the rightmost. */
  62.     smOnlyStyleRun              = 0,                            /* obsolete */
  63.     smLeftStyleRun              = 1,                            /* obsolete */
  64.     smRightStyleRun             = 2,                            /* obsolete */
  65.     smMiddleStyleRun            = 3                             /* obsolete */
  66. };
  67. /* type for styleRunPosition parameter in PixelToChar etc. */
  68. typedef short                           JustStyleCode;
  69. /*QuickTime3.0*/
  70. enum {
  71.                                                                 /* Constants for txFlags (which used to be the pad field after txFace) */
  72.     tfAntiAlias                 = 1 << 0,
  73.     tfUnicode                   = 1 << 1
  74. };
  75. struct FontInfo {
  76.     short                           ascent;
  77.     short                           descent;
  78.     short                           widMax;
  79.     short                           leading;
  80. };
  81. typedef struct FontInfo                 FontInfo;
  82. typedef short                           FormatOrder[1];
  83. typedef FormatOrder *                   FormatOrderPtr;
  84. /* FormatStatus was moved to TextUtils.i */
  85. struct OffPair {
  86.     short                           offFirst;
  87.     short                           offSecond;
  88. };
  89. typedef struct OffPair                  OffPair;
  90. typedef OffPair                         OffsetTable[3];
  91. typedef CALLBACK_API( Boolean , StyleRunDirectionProcPtr )(short styleRunIndex, void *dirParam);
  92. typedef STACK_UPP_TYPE(StyleRunDirectionProcPtr)                StyleRunDirectionUPP;
  93. #if OPAQUE_UPP_TYPES
  94.     EXTERN_API(StyleRunDirectionUPP)
  95.     NewStyleRunDirectionUPP        (StyleRunDirectionProcPtr userRoutine);
  96.     EXTERN_API(void)
  97.     DisposeStyleRunDirectionUPP    (StyleRunDirectionUPP    userUPP);
  98.     EXTERN_API(Boolean)
  99.     InvokeStyleRunDirectionUPP     (short                   styleRunIndex,
  100.                                     void *                  dirParam,
  101.                                     StyleRunDirectionUPP    userUPP);
  102. #else
  103.     enum { uppStyleRunDirectionProcInfo = 0x00000390 };             /* pascal 1_byte Func(2_bytes, 4_bytes) */
  104.     #define NewStyleRunDirectionUPP(userRoutine)                    (StyleRunDirectionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppStyleRunDirectionProcInfo, GetCurrentArchitecture())
  105.     #define DisposeStyleRunDirectionUPP(userUPP)                    DisposeRoutineDescriptor(userUPP)
  106.     #define InvokeStyleRunDirectionUPP(styleRunIndex, dirParam, userUPP)  (Boolean)CALL_TWO_PARAMETER_UPP((userUPP), uppStyleRunDirectionProcInfo, (styleRunIndex), (dirParam))
  107. #endif
  108. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  109. #define NewStyleRunDirectionProc(userRoutine)                   NewStyleRunDirectionUPP(userRoutine)
  110. #define CallStyleRunDirectionProc(userRoutine, styleRunIndex, dirParam) InvokeStyleRunDirectionUPP(styleRunIndex, dirParam, userRoutine)
  111. #if CALL_NOT_IN_CARBON
  112. #if CALL_NOT_IN_CARBON
  113. EXTERN_API( short )
  114. Pixel2Char                      (Ptr                    textBuf,
  115.                                  short                  textLen,
  116.                                  short                  slop,
  117.                                  short                  pixelWidth,
  118.                                  Boolean *              leadingEdge)                        FOURWORDINLINE(0x2F3C, 0x820E, 0x0014, 0xA8B5);
  119. EXTERN_API( short )
  120. Char2Pixel                      (Ptr                    textBuf,
  121.                                  short                  textLen,
  122.                                  short                  slop,
  123.                                  short                  offset,
  124.                                  short                  direction)                          FOURWORDINLINE(0x2F3C, 0x820C, 0x0016, 0xA8B5);
  125. #endif  /* CALL_NOT_IN_CARBON */
  126. #endif  /* CALL_NOT_IN_CARBON */
  127. EXTERN_API( short )
  128. PixelToChar                     (Ptr                    textBuf,
  129.                                  long                   textLength,
  130.                                  Fixed                  slop,
  131.                                  Fixed                  pixelWidth,
  132.                                  Boolean *              leadingEdge,
  133.                                  Fixed *                widthRemaining,
  134.                                  JustStyleCode          styleRunPosition,
  135.                                  Point                  numer,
  136.                                  Point                  denom)                              FOURWORDINLINE(0x2F3C, 0x8222, 0x002E, 0xA8B5);
  137. EXTERN_API( short )
  138. CharToPixel                     (Ptr                    textBuf,
  139.                                  long                   textLength,
  140.                                  Fixed                  slop,
  141.                                  long                   offset,
  142.                                  short                  direction,
  143.                                  JustStyleCode          styleRunPosition,
  144.                                  Point                  numer,
  145.                                  Point                  denom)                              FOURWORDINLINE(0x2F3C, 0x821C, 0x0030, 0xA8B5);
  146. EXTERN_API( void )
  147. DrawJustified                   (Ptr                    textPtr,
  148.                                  long                   textLength,
  149.                                  Fixed                  slop,
  150.                                  JustStyleCode          styleRunPosition,
  151.                                  Point                  numer,
  152.                                  Point                  denom)                              FOURWORDINLINE(0x2F3C, 0x8016, 0x0032, 0xA8B5);
  153. EXTERN_API( void )
  154. MeasureJustified                (Ptr                    textPtr,
  155.                                  long                   textLength,
  156.                                  Fixed                  slop,
  157.                                  Ptr                    charLocs,
  158.                                  JustStyleCode          styleRunPosition,
  159.                                  Point                  numer,
  160.                                  Point                  denom)                              FOURWORDINLINE(0x2F3C, 0x801A, 0x0034, 0xA8B5);
  161. EXTERN_API( Fixed )
  162. PortionLine                     (Ptr                    textPtr,
  163.                                  long                   textLen,
  164.                                  JustStyleCode          styleRunPosition,
  165.                                  Point                  numer,
  166.                                  Point                  denom)                              FOURWORDINLINE(0x2F3C, 0x8412, 0x0036, 0xA8B5);
  167. EXTERN_API( void )
  168. HiliteText                      (Ptr                    textPtr,
  169.                                  short                  textLength,
  170.                                  short                  firstOffset,
  171.                                  short                  secondOffset,
  172.                                  OffsetTable            offsets)                            FOURWORDINLINE(0x2F3C, 0x800E, 0x001C, 0xA8B5);
  173. #if CALL_NOT_IN_CARBON
  174. #if CALL_NOT_IN_CARBON
  175. EXTERN_API( void )
  176. DrawJust                        (Ptr                    textPtr,
  177.                                  short                  textLength,
  178.                                  short                  slop)                               FOURWORDINLINE(0x2F3C, 0x8008, 0x001E, 0xA8B5);
  179. EXTERN_API( void )
  180. MeasureJust                     (Ptr                    textPtr,
  181.                                  short                  textLength,
  182.                                  short                  slop,
  183.                                  Ptr                    charLocs)                           FOURWORDINLINE(0x2F3C, 0x800C, 0x0020, 0xA8B5);
  184. EXTERN_API( Fixed )
  185. PortionText                     (Ptr                    textPtr,
  186.                                  long                   textLength)                         FOURWORDINLINE(0x2F3C, 0x8408, 0x0024, 0xA8B5);
  187. #endif  /* CALL_NOT_IN_CARBON */
  188. #endif  /* CALL_NOT_IN_CARBON */
  189. EXTERN_API( long )
  190. VisibleLength                   (Ptr                    textPtr,
  191.                                  long                   textLength)                         FOURWORDINLINE(0x2F3C, 0x8408, 0x0028, 0xA8B5);
  192. EXTERN_API( void )
  193. GetFormatOrder                  (FormatOrderPtr         ordering,
  194.                                  short                  firstFormat,
  195.                                  short                  lastFormat,
  196.                                  Boolean                lineRight,
  197.                                  StyleRunDirectionUPP   rlDirProc,
  198.                                  Ptr                    dirParam)                           FOURWORDINLINE(0x2F3C, 0x8012, 0xFFFC, 0xA8B5);
  199. EXTERN_API( void )
  200. TextFont                        (short                  font)                               ONEWORDINLINE(0xA887);
  201. EXTERN_API( void )
  202. TextFace                        (StyleParameter         face)                               ONEWORDINLINE(0xA888);
  203. EXTERN_API( void )
  204. TextMode                        (short                  mode)                               ONEWORDINLINE(0xA889);
  205. EXTERN_API( void )
  206. TextSize                        (short                  size)                               ONEWORDINLINE(0xA88A);
  207. EXTERN_API( void )
  208. SpaceExtra                      (Fixed                  extra)                              ONEWORDINLINE(0xA88E);
  209. EXTERN_API( void )
  210. DrawChar                        (CharParameter          ch)                                 ONEWORDINLINE(0xA883);
  211. EXTERN_API( void )
  212. DrawString                      (ConstStr255Param       s)                                  ONEWORDINLINE(0xA884);
  213. #if TARGET_OS_MAC
  214.     #define MacDrawText DrawText
  215. #endif
  216. EXTERN_API( void )
  217. MacDrawText                     (const void *           textBuf,
  218.                                  short                  firstByte,
  219.                                  short                  byteCount)                          ONEWORDINLINE(0xA885);
  220. EXTERN_API( short )
  221. CharWidth                       (CharParameter          ch)                                 ONEWORDINLINE(0xA88D);
  222. EXTERN_API( short )
  223. StringWidth                     (ConstStr255Param       s)                                  ONEWORDINLINE(0xA88C);
  224. EXTERN_API( short )
  225. TextWidth                       (const void *           textBuf,
  226.                                  short                  firstByte,
  227.                                  short                  byteCount)                          ONEWORDINLINE(0xA886);
  228. EXTERN_API( void )
  229. MeasureText                     (short                  count,
  230.                                  const void *           textAddr,
  231.                                  void *                 charLocs)                           ONEWORDINLINE(0xA837);
  232. EXTERN_API( void )
  233. GetFontInfo                     (FontInfo *             info)                               ONEWORDINLINE(0xA88B);
  234. EXTERN_API( void )
  235. CharExtra                       (Fixed                  extra)                              ONEWORDINLINE(0xAA23);
  236. EXTERN_API( void )
  237. StdText                         (short                  count,
  238.                                  const void *           textAddr,
  239.                                  Point                  numer,
  240.                                  Point                  denom)                              ONEWORDINLINE(0xA882);
  241. EXTERN_API( short )
  242. StdTxMeas                       (short                  byteCount,
  243.                                  const void *           textAddr,
  244.                                  Point *                numer,
  245.                                  Point *                denom,
  246.                                  FontInfo *             info)                               ONEWORDINLINE(0xA8ED);
  247. #if CALL_NOT_IN_CARBON
  248. EXTERN_API_C( void )
  249. drawstring                      (const char *           s);
  250. EXTERN_API_C( short )
  251. stringwidth                     (const char *           s);
  252. #endif  /* CALL_NOT_IN_CARBON */
  253. EXTERN_API_C( void )
  254. stdtext                         (short                  count,
  255.                                  const void *           textAddr,
  256.                                  const Point *          numer,
  257.                                  const Point *          denom);
  258. #if OLDROUTINENAMES
  259. #define NPixel2Char(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom) 
  260.     PixelToChar(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom) 
  261. #define NChar2Pixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom) 
  262.     CharToPixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom)
  263. #define NDrawJust(textPtr, textLength, slop, styleRunPosition, numer, denom) 
  264.     DrawJustified(textPtr, textLength, slop, styleRunPosition, numer, denom)
  265. #define NMeasureJust(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom) 
  266.     MeasureJustified(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom)
  267. #define NPortionText(textPtr, textLen, styleRunPosition, numer, denom)
  268.     PortionLine(textPtr, textLen, styleRunPosition, numer, denom)
  269. #endif  /* OLDROUTINENAMES */
  270. #if PRAGMA_STRUCT_ALIGN
  271.     #pragma options align=reset
  272. #elif PRAGMA_STRUCT_PACKPUSH
  273.     #pragma pack(pop)
  274. #elif PRAGMA_STRUCT_PACK
  275.     #pragma pack()
  276. #endif
  277. #ifdef PRAGMA_IMPORT_OFF
  278. #pragma import off
  279. #elif PRAGMA_IMPORT
  280. #pragma import reset
  281. #endif
  282. #ifdef __cplusplus
  283. }
  284. #endif
  285. #endif /* __QUICKDRAWTEXT__ */