home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / IntermediateFrameworks3 / AppKit.framework / Headers / obsoleteGraphics.h < prev    next >
Text File  |  1995-05-12  |  6KB  |  174 lines

  1. /*
  2.     graphics.h
  3.     Application Kit, Release 2.0
  4.     Copyright (c) 1988, 1989, 1990, NeXT, Inc.  All rights reserved. 
  5. */
  6.  
  7. #import "NSColor.h"
  8. #import <Foundation/NSGeometry.h>
  9.  
  10. /* This file defines the most primitive client graphic structures. */
  11.  
  12. #ifndef GRAPHICS_H
  13. #define GRAPHICS_H
  14.  
  15. #ifndef EVENT_H
  16. #import "dpsfriends.h"
  17. #import "event.h"
  18. #endif EVENT_H
  19.  
  20. #ifndef OBJC_INCL
  21. #import <objc/objc.h>
  22. #endif OBJC_INCL
  23.  
  24. #import <objc/typedstream.h>
  25.  
  26. #define    NSWhite    (1.0)
  27. #define    NSLightGray    (2.0/3.0)
  28. #define    NSDarkGray    (1.0/3.0)
  29. #define    NSBlack    (0.0)
  30.  
  31. typedef NSRect NXRect;
  32. typedef NSSize NXSize;
  33. typedef NSPoint NXPoint;
  34. typedef float NXCoord;
  35.  
  36. #define    NX_X(aRect)    ((aRect)->origin.x)
  37. #define    NX_Y(aRect)    ((aRect)->origin.y)
  38. #define    NX_WIDTH(aRect)    ((aRect)->size.width)
  39. #define    NX_HEIGHT(aRect)    ((aRect)->size.height)
  40. #define    NX_MAXX(aRect)    ((aRect)->origin.x + (aRect)->size.width)
  41. #define    NX_MAXY(aRect)    ((aRect)->origin.y + (aRect)->size.height)
  42. #define    NX_MIDX(aRect)    (NX_X(aRect)+NX_WIDTH(aRect)/2.0)
  43. #define    NX_MIDY(aRect)    (NX_Y(aRect)+NX_HEIGHT(aRect)/2.0)
  44.  
  45. /* The sides of a rectangle */
  46. #define NX_XMIN    0
  47. #define NX_YMIN    1
  48. #define NX_XMAX    2
  49. #define NX_YMAX    3
  50.  
  51. /*
  52.  * The following values should be used in describing color space of bitmaps.
  53.  */
  54. typedef enum _NXColorSpace { 
  55.     NX_CustomColorSpace = -1,        /* color space from graphics state */
  56.     NX_OneIsBlackColorSpace = 0,    /* monochrome, 1 is black */
  57.     NX_OneIsWhiteColorSpace = 1,    /* monochrome, 1 is white */
  58.     NX_RGBColorSpace = 2,            
  59.     NX_CMYKColorSpace = 5
  60. } NXColorSpace;
  61.  
  62. /*
  63.  * NXWindowDepth defines the values used in setting window depth limits.
  64.  * Use the functions NXBPSFromDepth() and NXColorSpaceFromDepth()
  65.  * to extract colorspace/bps info from an NXWindowDepth.
  66.  */
  67. typedef enum _NXWindowDepth { 
  68.     NX_DefaultDepth = 0,
  69.     NX_TwoBitGrayDepth = 258,
  70.     NX_EightBitGrayDepth = 264,
  71.     NX_EightBitRGBDepth = 514,
  72.     NX_TwelveBitRGBDepth = 516,
  73.     NX_TwentyFourBitRGBDepth = 520
  74. } NXWindowDepth;
  75.  
  76.  
  77. extern NSColor * NXReadPixel(const NXPoint *p);
  78. extern void NXCopyBits(int sgnum, const NXRect *sRect, const NXPoint *dPoint);
  79. extern void NXDrawButton(const NXRect *aRect, const NXRect *clipRect);
  80. extern void NXDrawGrayBezel(const NXRect *aRect, const NXRect *clipRect);
  81. extern void NXDrawGroove(const NXRect *aRect, const NXRect *clipRect);
  82. extern NXRect *NXDrawTiledRects(NXRect *boundsRect, const NXRect *clipRect,
  83.         const int *sides, const float *grays, int count);
  84. extern void NXDrawWhiteBezel(const NXRect *aRect, const NXRect *clipRect);
  85. extern void NXEraseRect(const NXRect *aRect);
  86. extern void NXFrameRect(const NXRect *aRect);
  87. extern void NXFrameRectWithWidth(const NXRect *aRect, NXCoord frameWidth);
  88. extern void NXRectClip(const NXRect *aRect);
  89. extern void NXRectClipList(const NXRect *rects, int count);
  90. extern void NXRectFill(const NXRect *aRect);
  91. extern void NXRectFillList(const NXRect *rects, int count);
  92. extern void NXHighlightRect(const NXRect *aRect);
  93. extern void NXRectFillListWithGrays(const NXRect *rects, const float *grays, int count);
  94.  
  95. extern BOOL NXContainsRect(const NXRect *a, const NXRect *b);
  96. extern NXRect *NXDivideRect(NXRect *aRect, NXRect *bRect, NXCoord slice, int edge);
  97. extern BOOL NXEmptyRect(const NXRect *aRect);
  98. extern BOOL NXEqualRect(const NXRect *aRect, const NXRect *bRect);
  99. extern void NXInsetRect(NXRect *aRect, NXCoord dX, NXCoord dY);
  100. extern void NXIntegralRect(NXRect *aRect);
  101. extern NXRect *NXIntersectionRect(const NXRect *aRect, NXRect *bRect);
  102. extern BOOL NXIntersectsRect(const NXRect *aRect, const NXRect *bRect);
  103. extern void NXOffsetRect(NXRect *aRect, NXCoord dX, NXCoord dY);
  104. extern BOOL NXPointInRect(const NXPoint *aPoint, const NXRect *aRect);
  105. extern BOOL NXMouseInRect(const NXPoint *aPoint, const NXRect *aRect, BOOL flipped);
  106. extern void NXSetRect(NXRect *aRect, NXCoord x, NXCoord y, NXCoord w, NXCoord h);
  107. extern NXRect *NXUnionRect(const NXRect *aRect, NXRect *bRect);
  108.  
  109. extern NXColorSpace NXColorSpaceFromDepth (NXWindowDepth depth);
  110. extern int NXBPSFromDepth (NXWindowDepth depth);
  111. extern int NXNumberOfColorComponents (NXColorSpace colorSpace);
  112. extern BOOL NXGetBestDepth (NXWindowDepth *depth, int numColors, int bps);
  113.  
  114. extern void NXPing(void);
  115.  
  116. extern void NXDrawBitmap(const NXRect *rect, int width, int height,
  117.             int bps, int spp, int bpp, int bpr, 
  118.             BOOL isPlanar, BOOL hasAlpha, NXColorSpace colorSpace,
  119.             const unsigned char *const data[5]);
  120.  
  121. extern void NXReadBitmap(const NXRect *rect, int w, int h, int bps, int spp, 
  122.                 int planarConfig, int photoInt,
  123.                 void *data1, void *data2, void *data3,
  124.                 void *data4, void *data5 );
  125.  
  126. extern void NXSizeBitmap(const NXRect *rect, int *size, int *width, 
  127.     int *height, int *bps, int *spp, int *planarConfig, int *photoInt );
  128.  
  129. extern void NXCopyBitmapFromGState (int srcGState,
  130.                     const NXRect *srcRect,
  131.                     const NXRect *destRect);
  132.  
  133. extern void NXWritePoint (NXTypedStream *s, const NXPoint *aPoint);
  134.     /* Equivalent to NXWriteTypes (s, "ff", &aPoint.x, &aPoint.y) */
  135. extern void NXReadPoint (NXTypedStream *s, NXPoint *aPoint);
  136.  
  137. extern void NXWriteSize (NXTypedStream *s, const NXSize *aSize);
  138.     /* Equivalent to NXWriteTypes (s, "ff", &aSize.width, &aSize.height) */
  139. extern void NXReadSize (NXTypedStream *s, NXSize *aSize);
  140.  
  141. extern void NXWriteRect (NXTypedStream *s, const NXRect *aRect);
  142.     /* Equivalent to NXWriteArray (s, "f", 4, &aRect) */
  143. extern void NXReadRect (NXTypedStream *s, NXRect *aRect);
  144.  
  145. /*
  146.  * NXContainRect() is obsolete and used in the 1.0 API.
  147.  */
  148. extern int NXContainRect(NXRect *aRect, const NXRect *bRect);
  149.  
  150. /*
  151.  * The following four constants are obsolete and used in the 1.0 API. 
  152.  * Use NXColorSpace instead.
  153.  */
  154. #define NX_MONOTONICMASK    1
  155. #define NX_COLORMASK        2
  156. #define NX_ALPHAMASK        4
  157. #define NX_PALETTEMASK        8
  158.  
  159. /*
  160.  * The following two constants are obsolete and used in the 1.0 API to
  161.  * describe planar configuration of bitmaps. 2.0 API uses a boolean (isPlanar) 
  162.  * instead.
  163.  */
  164. #define NX_MESHED        1
  165. #define NX_PLANAR        2    
  166.  
  167. /*
  168.  * #defines for historical reasons; don't use these in new applications.
  169.  */
  170. #define NXWindowDepthType    NXWindowDepth
  171. #define NXColorSpaceType    NXColorSpace
  172.  
  173. #endif GRAPHICS_H
  174.