ftp.nice.ch/pub/next/graphics/apps/GraphicsWrap.N.bs.tar.gz#/462/NXBitmapGraphicRep.h

This is NXBitmapGraphicRep.h in view mode; [Download] [Up]

/* NXBitmapGraphicRep.h -- The meaty part of the front end.
 *
 * Written By: Bill Bumgarner (Friday Software & Consulting)
 *             <wb1j+@andrew.cmu.edu>
 *             414 S.Craig, #119
 *             Pittsburgh, PA. 15213
 *             412-268-5378
 *
 * <see NXBitmapGraphicRep.m for notes>
 */

#import <appkit/NXBitmapImageRep.h>
#import <appkit/color.h>

@interface NXBitmapGraphicRep : NXBitmapImageRep
{
  long num_bytes;      // number of bytes in entire image
  long bytes_per_row;  // bytes per single scan line
  unsigned char *data; // pointer to the actual bitmap data

  NXColor foreColor;
  NXColor backColor;
  unsigned char cur_red, cur_grn, cur_blu;
  unsigned char bck_red, bck_grn, bck_blu;
  unsigned char gray_level;
  unsigned char bck_gray_level;

  int yh; // pixelsHigh-1 -- used in the calculation of the offset
          // into data to auto-flip the image.
  int imageDepth;
}
// used to initialize the bitmap w/a certain size and color model with the
// background color set to c
- initWithSize:(NXSize *) aSize depth:(int) aDepth andColor:(NXColor)c;

// calls above with c=NX_COLORBLACK to force a black background
- initWithSize:(NXSize *) aSize andDepth:(int) aDepth;

// erases the current frame to aColor
- eraseFrameToColor:(NXColor) aColor;
// erases the current frame to backColor
- eraseFrame;

// plots points in the current foreColor and erases points to the current
// backColor.  WATCHOUT:  both these routines do some nasty bit level
// manipulation in the twelve bit and two bit modes.
- plotPoint:(long)x :(long)y;
- erasePoint:(long)x :(long)y;

/* sets the background and foreground color.  In two bit and twelve
 * bit mode, the color model stays in the full NXColor structure--
 * only the pixels that are put on screen drop back to the lower bit model.
 * NXColor structure is defined as:
 * typedef struct _NXColor {
 *  unsigned short colorField[8];
 *  } NXColor;
 * Because of this, this object is completely compatible with RGB,
 * HSB, and CMYK color models.  To appropriately set the various
 * values of the structure, use the various methods defined in
 * /usr/include/appkit/color.h
 * (Look in digital libararian for more information */
- setColor:(NXColor) aColor;
- setBackColor:(NXColor) aColor;

/* returns the current color or current backColor of the image */
- (NXColor)color;
- (NXColor)backColor;

/* returns the current depth of the color model being used. */
- (int)imageDepth;

// ASSIGNMENT #1 line drawing routine.
- line:(int)x0 :(int)y0 :(int)x1 :(int)y1;
- cmdDraw:(int)x :(int)y;
- cmdMove:(int)x :(int)y;
- cmdCircle:(int)r;
- cmdFps:(int)f;
- cmdHold:(int)seconds;
- cmdNewframe;
- cmdDrawPoly:vertexList;
@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.