/*** Primer ***/
#include <stdio.h>
#include "phigs.h"
#include "libphigs.h"
void main( int argc, char *argv[])
{
float x[4] = { -200.0, 350.0, 250.0, -200.0};
float y[4] = { -200.0, 300.0, -250.0, -200.0};
float okx[5] = { -298.0, -298.0, 398.0, 398.0, -298.0};
float oky[5] = { -298.0, 398.0, 398.0, -298.0, -298.0};
int ws_id, err_ind, i, j, k;
Pmatrix ViewMappingMatrix;
Pview_map mapping;
Plimit ws_win_limits;
Plimit ws_vp_limits;
Ppoint points[5];
Ppoint_list point_list;
Ptext_align text_align;
Ppoint text_pos;
Pcolr_rep colr_rep;
/* Odpre PHIGS */
popen_phigs("Error", 255);
/* Odpre delovno postajo, 17", 1024x768*/
ws_id = 1;
popen_ws(ws_id,"", WK171024);
/* Dolocitev uporabniskih koordinat */
mapping.win.x_min = -300.0;
mapping.win.x_max = 400.0;
mapping.win.y_min = -300.0;
mapping.win.y_max = 400.0;
/* Dolocitev pogleda
(v normaliziranem koordinatnem sistemu) */
mapping.proj_vp.x_min = 0.1;
mapping.proj_vp.x_max = 0.9;
mapping.proj_vp.y_min = 0.1;
mapping.proj_vp.y_max = 0.9;
/* Izracun transformacijske matrike */
peval_view_map_matrix(&mapping, &err_ind,
ViewMappingMatrix);
/* Nastavitev mej pogleda */
ws_win_limits.x_min = 0.0;
ws_win_limits.x_max = 1.0;
ws_win_limits.y_min = 0.0;
ws_win_limits.y_max = 1.0;
pset_ws_win(ws_id, &ws_win_limits);
/* Nastavitev zaslonskih koordinat */
ws_vp_limits.x_min = 0.0;
ws_vp_limits.x_max = 0.2;
ws_vp_limits.y_min = 0.0;
ws_vp_limits.y_max = 0.2;
pset_ws_vp(ws_id, &ws_vp_limits);
/* Dolocitev barve crte
Indeksi:
0 = bela, 1 = rdeca, 2 = rumena,
3 = zelena, 4 = svetlo modra, 5 = modra,
6 = violicna, 7 = crna (ozadje) */
pset_line_colr_ind(3);
/* Izris trikotnika - 3 crte, 4 tocke */
point_list.num_points = 4;
for( i=0; i<point_list.num_points; i++){
points[i].x = x[i];
points[i].y = y[i];
}
point_list.points = points;
ppolyline(&point_list);
/* Nastavitev dolocene barve */
colr_rep.rgb.red = 0.8;
colr_rep.rgb.green = 0.8;
colr_rep.rgb.blue = 0.1;
pset_colr_rep(ws_id, 8, &colr_rep);
pset_line_colr_ind(8);
/* Izris okvirja - 4 crte, 5 tock */
point_list.num_points = 5;
for( i=0; i<point_list.num_points; i++){
points[i].x = okx[i];
points[i].y = oky[i];
}
point_list.points = points;
ppolyline(&point_list);
/* Dolocitev barve teksta */
pset_text_colr_ind(1);
/* Dolocitev visine teksta */
pset_char_ht(20.0);
/* Dolocitev poravnave texta */
text_align.hor = PHOR_CTR;
pset_text_align(&text_align);
/* Izris texta */
text_pos.x = 50.0;
text_pos.y = 250.0;
ptext(&text_pos, "PHIGS skeleton");
sleep(10);
/* Zapre delovno postajo */
pclose_ws(ws_id);
/* Zapre PHIGS (zakljuci z graficnim nacinom dela) */
pclose_phigs();
}