⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alignment.c

📁 Intro/: Directory containing introductory examples. HelloWorld.c A simple program that draws a bo
💻 C
字号:
#include <phigs.h>			/* get HP-PHIGS definitions for C */#include <stdio.h>			/* get standard I/O definitions */main()					/* file "Alignment.c" */{    Pint	WorkstnID = 1;		/* workstation identifier */    Pint	ConnID;			/* connection identifier */    Pint	WorkstnType = POIDDX;	/* out/in, direct, dbl bfr, Xwindow */    Pint	TheStructure = 1;	/* structure ID (chosen by user) */    static Ptext_align	CenterCap =	/* alignment for the top labels */		{PHOR_CTR, PVERT_CAP};    static Ptext_align	LeftHalf =	/* alignment for the left labels */		{PHOR_LEFT, PVERT_HALF};    Ptext_align	Alignment;		/* alignment for the middle labels */    Ppoint	Loc;			/* location of text strings */    int		Halign, Valign;		/* loop control variables */    float	H, V;			/* temporary variables */    popen_phigs((char *) stderr, 0);	/* errors go to "stderr" */    pescape_u4("/dev/screen/phigs_window", &ConnID);    popen_ws(WorkstnID, (void *) ConnID, WorkstnType);    popen_struct(TheStructure);    /*--- do top labels ----------------------------------------------------*/    pset_char_ht(0.015);    pset_text_align(&CenterCap);    Loc.y = 1.0;    Loc.x = 0.1, ptext(&Loc, "TOP");	/* \			    */    Loc.x = 0.3, ptext(&Loc, "CAP");	/*  \  do the labels for    */    Loc.x = 0.5, ptext(&Loc, "HALF");	/*   > vertical alignment   */    Loc.x = 0.7, ptext(&Loc, "BASE");	/*  /  along top of plot    */    Loc.x = 0.9, ptext(&Loc, "BOTTOM");	/* /			    */    /*--- do left labels ---------------------------------------------------*/    pset_text_align(&LeftHalf);    Loc.x = 0.0;    Loc.y = 0.2, ptext(&Loc, "LEFT");	/* \  labels for horizontal */    Loc.y = 0.5, ptext(&Loc, "CTR");	/*  > alignment are along   */    Loc.y = 0.8, ptext(&Loc, "RIGHT");	/* /  left edge of the plot */    /*--- do letters in the middle -----------------------------------------*/    pset_char_ht(0.03);    pset_char_expan(0.8);    for (Valign = PVERT_TOP; Valign <= PVERT_BOTTOM; Valign++) {	for (Halign = PHOR_LEFT; Halign <= PHOR_RIGHT; Halign++) {	    V = Valign * 0.2 - 0.1;		/* calculate X value */	    H = Halign * 0.3 - 0.1;		/* calculate Y value */	    DoLine(V + 0.01, H + 0.01, V - 0.01, H - 0.01);	/* NE to SW */	    DoLine(V + 0.01, H - 0.01, V - 0.01, H + 0.01);	/* SE to NW */	    Alignment.hor = Halign, Alignment.vert = Valign;	    pset_text_align(&Alignment);	    Loc.x = V, Loc.y = H;	    ptext(&Loc, "Test");	}    }    pclose_struct();    ppost_struct(WorkstnID, TheStructure, 1.0);    pupd_ws(WorkstnID, PFLAG_PERFORM);	/* (regeneration flag) */    pclose_ws(WorkstnID);    pclose_phigs();}/****************************************************************************/DoLine(X1, Y1, X2, Y2)float	X1, Y1, X2, Y2;			/* endpoints of line */{    Ppoint	LinePts[2];		/* XYs of polyline */    Ppoint_list	LineData;		/* all data for polyline */        LinePts[0].x = X1, LinePts[0].y = Y1;    LinePts[1].x = X2, LinePts[1].y = Y2;    LineData.num_points = 2, LineData.points = LinePts;    ppolyline(&LineData);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -