This is graph_primi.c in view mode; [Download] [Up]
/****************************************************************
* *
* I C A O M a p - *
* *
* A n A v i a t i o n U t i l i t y *
* *
* *
* Copyright (C) 1993, 1994 Martin Pauly *
* *
* N e x t V e r s i o n *
* *
* Copyright (C) 1994 Stefan Leuker & Oliver Meyer *
* *
* This file may be freely distributed only if it includes *
* the above copyright notice. *
* *
****************************************************************/
#include "graph_primi.h"
#include <dpsclient/wraps.h>
#include <appkit/color.h>
BOOL screenIsMono = NO;
BOOL optimizeForMono = YES;
int media = SCREEN;
extern int NXDrawingStatus;
struct rgbcolor
{
float r, g, b;
}
colortab[10] =
{
0, 0, 0, //Black
1, 1, 1, //White
190.0/255.0, 190.0/255.0, 190.0/255.0, //Gray
0.666, 0.666, 0.666, //LightGray
0, 0, 0.5, //NavyBlue
0, 191.0/255.0, 1, //DeepSkyBlue
1, 0, 0, //Red
// 1, 182.0/255.0, 193.0/255.0, //LightPink
1, 61.0/255.0, 91.0/255.0, //Pink
179.0/255.0, 238.0/255, 58.0/255.0, //LightGreen
1, 1, 0 // Yellow
},
monotab[10] =
{
0, 0, 0, //Black
1, 1, 1, //White
0.5, 0.5, 0.5, //Gray
0.666, 0.666, 0.666, //LightGray
0, 0, 0.5, //NavyBlue
0, 0.5, 1, //DeepSkyBlue
1, 0, 0, //Red
0.9, 0.9, 0.9, //LightPink
0.888, 0.888, 0.888, //LightGreen
1, 1, 0 // Yellow
};
void
gp_drawline(int x1, int y1, int x2, int y2)
{
PSW_strokeline(x1, y1, x2, y2);
}
void
gp_drawcircle(int x, int y, int radius) /* radius or diameter? */
{
if (radius > 1)
PSW_strokecircle(x, y, radius / 2);
else
PSW_fill1circle(x, y);
}
void
gp_drawrect(int x1, int y1, int x2, int y2)
{
/* PSW_strokerect(x1, y1, x2, y2); */
PSrectstroke(x1, y1, x2 - x1, y2 - y1);
}
/* draw filled rectangle using polygon */
void
gp_drawfilledrect(int x1, int y1, int x2, int y2)
{
/* PSW_strokefilledrect(x1, y1, x2, y2); */
PSrectfill(x1, y1, x2-x1, y2-y1);
}
/* draw polygon */
void
gp_drawarea(int *x, int *y, int numpoints)
{
int i;
PSmoveto(x[0], y[0]);
for (i = 1; i < numpoints; i++)
PSlineto(x[i], y[i]);
PSclosepath();
PSfill();
}
void
gp_setlinestyle(int width, int style)
{
static int oldW, oldS;
float w;
if (width == 1)
w = 0.15;
else
w = width;
if ((oldW == w) && (oldS == style))
return;
if (style == DOT)
PSW_setdotline(w);
if (style == DASH)
PSW_setdashline(w);
if (style == SOLID)
PSW_setsolidline(w);
}
void
gp_setcolor(int color)
{
NXColor newcolor;
float alpha;
/* 1 == NX_DRAWING (or see View.h), but don't make this Objective-C */
if ((color == PINK) && NXDrawingStatus == 1)
alpha = 0.3;
else
alpha = 1.0;
if (screenIsMono && optimizeForMono)
newcolor = NXConvertRGBAToColor(
monotab[color].r, monotab[color].g, monotab[color].b,
alpha);
else
newcolor = NXConvertRGBAToColor(
colortab[color].r, colortab[color].g, colortab[color].b,
alpha);
NXSetColor(newcolor);
}
void
gp_smalltextleftaligned(int x, int y, char *string) /* lower left */
{
PSW_smalltextleftaligned(x, y, string);
}
void
gp_smalltext(int x, int y, char *string) /* center of string */
{
PSW_smalltext(x, y, string);
}
void
gp_bigtext(int x, int y, char *string) /* center of string */
{
PSW_bigtext(x, y, string);
}
void
gp_setplane(unsigned long plane)
{
}
void
gp_drawplanearea(int *x, int *y, int numpoints)
{
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.