📄 grphics.cpp
字号:
/********************************************************************** * File: grphics.c (Formerly graphics.c) * Description: Starbase stubs for connection to sbdaemon * Author: Ray Smith * Created: Wed May 16 08:34:32 BST 1990 * * (C) Copyright 1990, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** http://www.apache.org/licenses/LICENSE-2.0 ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. * **********************************************************************/#include "mfcpch.h"#include <stdlib.h>#include <string.h>#ifdef __UNIX__#include <signal.h>#endif#include "grphics.h"//#include "sbderrs.h"//#include "grpherr.h"#include "grphshm.h"#include "evntlst.h"#define XSIZE_INCREMENT 8#define YSIZE_INCREMENT 30void def_overlap_picture_ops(BOOL8 update);WINCREATEFUNC create_func = WINFD::create;void (*overlap_func) (BOOL8) = def_overlap_picture_ops;/********************************************************************** * line_color_index * * Set the colour map index for drawing lines with. **********************************************************************/void WINFD::Line_color_index( /*set line colour */ COLOUR index /*index to use */ ) { ONEOP *newop; /*message structure */ /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = LINECOLOUR; /*send the operator */ newop->param.p.i = index; /*set parameter */ }}/********************************************************************** * perimeter_color_index * * Set the colour map index for drawing perimeters with. **********************************************************************/void WINFD::Perimeter_color_index( /*set perimeter colour */ COLOUR index /*index to use */ ) { ONEOP *newop; /*message structure */ /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ /*send the operator */ newop->type = PERIMETERCOLOUR; newop->param.p.i = index; /*set parameter */ }}/********************************************************************** * fill_color_index * * Set the colour map index for drawing fills with. **********************************************************************/void WINFD::Fill_color_index( /*set fill colour */ COLOUR index /*index to use */ ) { ONEOP *newop; /*message structure */ /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = FILLCOLOUR; /*send the operator */ newop->param.p.i = index; /*set parameter */ }}/********************************************************************** * fill_color * * Set the RGB colour for drawing fills with. **********************************************************************/void WINFD::Fill_color( /*set fill colour */ UINT8 red, UINT8 green, UINT8 blue) { ONEOP *newop; /*message structure */ UINT32 packed_colour; packed_colour = (blue << 24) + (green << 16) + (red << 8); /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = FILLCOLOUR; /*send the operator */ /*set parameter */ newop->param.p.i = (INT32) packed_colour; }}/********************************************************************** * marker_color_index * * Set the colour map index for drawing markers with. **********************************************************************/void WINFD::Marker_color_index( /*set marker colour */ COLOUR index /*index to use */ ) { ONEOP *newop; /*message structure */ /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = MARKERCOLOUR; /*send the operator */ newop->param.p.i = index; /*set parameter */ }}/********************************************************************** * text_color_index * * Set the colour map index for drawing texts with. **********************************************************************/void WINFD::Text_color_index( /*set text colour */ COLOUR index /*index to use */ ) { ONEOP *newop; /*message structure */ /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = TEXTCOLOUR; /*send the operator */ newop->param.p.i = index; /*set parameter */ }}/********************************************************************** * text_font_index * * Set the text font index for drawing texts with. **********************************************************************/void WINFD::Text_font_index( /*set text font */ INT16 index /*index to use */ ) { ONEOP *newop; /*message structure */ /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = TEXTFONT; /*send the operator */ newop->param.p.i = index; /*set parameter */ }}/********************************************************************** * character_height * * Set the VDC height of subsequent text. **********************************************************************/void WINFD::Character_height( /*set text height */ float height /*height to use */ ) { ONEOP *newop; /*message structure */ /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = CHARHEIGHT; /*send the operator */ newop->param.p.f = height; /*set parameter */ }}/********************************************************************** * line_type * * Set the line type for all subsequent lines. **********************************************************************/void WINFD::Line_type( /*set line type */ INT16 style /*style to use */ ) { ONEOP *newop; /*message structure */ /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = LINETYPE; /*send the operator */ newop->param.p.i = style; /*set parameter */ }}/********************************************************************** * marker_type * * Set the marker type for all subsequent lines. **********************************************************************/void WINFD::Marker_type( /*set marker type */ INT16 type /*type to use */ ) { ONEOP *newop; /*message structure */ /*get some space */ newop = (ONEOP *) getshm (sizeof (ONEOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = MARKERTYPE; /*send the operator */ newop->param.p.i = type; /*set parameter */ }}/********************************************************************** * interior_style * * Set the fill type and boundary presence for arcs, ellipses etc. **********************************************************************/void WINFD::Interior_style( /*set polygon style */ INT16 style, /*style to use */ INT16 edged /*draw edge or not */ ) { TWOOP *newop; /*message structure */ /*get some space */ newop = (TWOOP *) getshm (sizeof (TWOOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = INTERIORSTYLE; /*send the operator */ newop->param.p[0].i = style; /*set parameter */ newop->param.p[1].i = edged; }}/********************************************************************** * marker_size * * Set the size of markers in polymarker2d. **********************************************************************/void WINFD::Marker_size( /*set marker size */ float size /*size to use */ ) { TWOOP *newop; /*message structure */ /*get some space */ newop = (TWOOP *) getshm (sizeof (TWOOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = MARKERSIZE; /*send the operator */ newop->param.p[0].f = size; /*set parameter */ newop->param.p[1].i = FALSE; }}/********************************************************************** * move2d * * Move the pen to the given position. **********************************************************************/void WINFD::Move2d( /*move the pen */ float x, /*coords to move to */ float y /*coords to move to */ ) { TWOOP *newop; /*message structure */ /*get some space */ newop = (TWOOP *) getshm (sizeof (TWOOP)); if (newop != NULL) { newop->header.fd = fd; /*send the fd */ newop->type = MOVE2D; /*send the operator */ newop->param.p[0].f = x; /*set parameters */ newop->param.p[1].f = y; }}/********************************************************************** * draw2d * * Draw from current position to the given position using the current colour **********************************************************************/void WINFD::Draw2d( /*draw the pen */ float x, /*coords to draw to */ float y /*coords to draw to */ ) { TWOOP *newop; /*message structure */ /*get some space */ newop = (TWOOP *) getshm (sizeof (TWOOP)); if (newop != NULL) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -