summaryrefslogtreecommitdiff
path: root/xc/unsupported/test/suspex/testcases/oc_sun/intrAttr.c
blob: 17b89b257b77cc95695707a000414cd1498825c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/* $XConsortium$ */

/*
        NOTICE TO USER: The source code in this file is copyrighted under
        U.S. and international laws.  SunSoft, Inc., a Sun Microsystems,
        Inc. business of Mountain View, California owns the copyright.
        Users and possessors of this source code are hereby granted a
        nonexclusive, royalty-free copyright and design patent license
        to use this code in individual and commercial software.

        Any use of this source code must include, in the user documentation
        and internal comments to the code, notices to the end user as follows:

(c) Copyright 1992, 1993 SunSoft, Inc., a Sun Microsystems, Inc. business.
 
        SUNSOFT, INC. AND SUN MICROSYSTEMS, INC. MAKE NO REPRESENTATIONS
        ABOUT THE SUITABILITY OF THIS SOURCE CODE FOR ANY PURPOSE. IT IS
        PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
        SUNSOFT, INC., AND SUN MICROSYSTEMS, INC., SEVERALLY AND
        INDIVIDUALLY, DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOURCE
        CODE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
        FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUNSOFT, INC.
        OR SUN MICROSYSTEMS, INC., BE LIABLE FOR ANY SPECIAL, INDIRECT,
        INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
        RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
        OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
        OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE.
*/ 
#include <X11/PEX5/PEXlib.h>
#include <stdio.h>
#include "surface.h"
#include "misc.h"

char test_description[] = "\
Interior Attributes Tests:\n\n\
Note: fa=fill area; fas=fill area set\n\
Top row:    fa2D, depth cued fa, nested fas2D, self-intersecting fas\n\
Mid row:    test front face attributes\n\
            4fa - hatched in blue, empty/white dot edge,\n\
                  hollow green/white dot edge, solid yellow (bundled attrs)\n\
Bottom row: test back face attributes\n\
            4fa - hatched in red, empty with white dashdot edge,\n\
                  hollow blue/white dashdot edge, solid blue (bundled attrs)\n\
";

void
outputCommands(dpy, resourceID, req_type)
    Display		*dpy;
    XID			resourceID;
    PEXOCRequestType	req_type;
{	
    PEXColor		colr;
    int			i,j;

    static		PEXCoord2D pts0[] = { 
	0.05, 0.7,
	0.15, 0.8,
	0.25, 0.7,
    };
    static		PEXCoord pts1[] = { 
	0.05, 0.5, 1.0,
	0.15, 0.6, 0.0,
	0.25, 0.5, 1.0,
    };
    static              PEXCoord pts2[] = {
        0.45, 0.7, 0.0,
        0.45, 0.8, 0.0,
        0.65, 0.8, 0.0,
        0.65, 0.7, 0.0,
    };
    static              PEXCoord pts3[] = {
        0.45, 0.75, 0.0,
        0.55, 0.8, 0.0,
        0.65, 0.75, 0.0,
        0.55, 0.7, 0.0,
    };
    static		PEXCoord2D pts4[] = { 
	0.75, 0.9,
	0.95, 0.9,
	0.95, 0.7,
	0.65, 0.7,
	0.65, 0.85,
	0.85, 0.85,
	0.85, 0.75,
	0.75, 0.75,
    };
    static		PEXCoord pts5[] = { 
	0.25, 0.7, 1.0,
	0.35, 0.8, 0.0,
	0.45, 0.7, 1.0,
    };
    static		PEXListOfCoord2D fas1[] = { {8, pts4} };
    static		PEXListOfCoord fas2[] = { {4, pts2},{4, pts3}, };

    colr.rgb.red = 0.0;
    colr.rgb.green = 0.0;
    colr.rgb.blue = 1.0;

/* Testing front face attributes */

    /* default attrs */
    FILLAREA2D(PEXShapeConvex, False, 3, pts0);

    /* depth cued, solid */
    SET_DEPTH_CUE_INDEX(1)
    SET_INTERIOR_STYLE(PEXInteriorStyleSolid)
    FILLAREA(PEXShapeConvex, False, 3, pts5);
    SET_DEPTH_CUE_INDEX(0)

    /* fill area set, solid */ 
    FILLAREA_SET(PEXShapeConvex, False, PEXContourNested, 2, fas2);

    /* fill area set 2D, hatch */
    SET_INTERIOR_STYLE(PEXInteriorStyleHatch)
    FILLAREA_SET2D(PEXShapeComplex, False, PEXContourDisjoint, 1, fas1);

    /* interior style HATCH, surface colour */
    SET_INTERIOR_STYLE(PEXInteriorStyleHatch)
    SET_SURFACE_COLOR(PEXColorTypeRGB,&colr);
    SET_INTERIOR_STYLE_INDEX(1)
    FILLAREA(PEXShapeConvex, False, 3, pts1);
    TRANSLATE_VERTEX(x, 0.2, 3, pts1);

    /* interior styles EMPTY, surface color index,
    surface edge DOTTED, surface edge color index  */
    SET_EDGE_TYPE(PEXSurfaceEdgeDotted);
    SET_EDGE_COLOR_INDEX(1);
    SET_EDGE_FLAG(PEXOn);
    SET_SURFACE_COLOR_INDEX(3);
    SET_INTERIOR_STYLE(PEXInteriorStyleEmpty)
    FILLAREA(PEXShapeConvex, False, 3, pts1);
    TRANSLATE_VERTEX(x, 0.2, 3, pts1);

    /* interior styles HOLLOW, surface edge DOTTED, edge color index */
    SET_INTERIOR_STYLE(PEXInteriorStyleHollow)
    FILLAREA(PEXShapeConvex, False, 3, pts1);
    TRANSLATE_VERTEX(x, 0.2, 3, pts1);
    SET_EDGE_FLAG(PEXOff);

    /* interior bundle */
    SET_INTERIOR_BUNDLE_INDEX(1);
    SET_INDIVIDUAL_ASF(PEXASFInteriorStyle,PEXBundled);
    SET_INDIVIDUAL_ASF(PEXASFInteriorStyleIndex,PEXBundled);
    SET_INDIVIDUAL_ASF(PEXASFSurfaceColor,PEXIndividual);
    FILLAREA(PEXShapeConvex, False, 3, pts1);


/* Testing back face attributes */
    SET_FACET_DISTINGUISH_FLAG(PEXOn)

    colr.rgb.red = 1.0;
    colr.rgb.green = 0.0;
    colr.rgb.blue = 0.0;

    /* interior style HATCH, surface colour */
    TRANSLATE_VERTEX(x, -0.6, 3, pts1);
    TRANSLATE_VERTEX(y, -0.2, 3, pts1);
    SET_BF_INTERIOR_STYLE(PEXInteriorStyleHatch)
    SET_BF_SURFACE_COLOR(PEXColorTypeRGB,&colr);
    SET_BF_INTERIOR_STYLE_INDEX(1)
    FILLAREA(PEXShapeConvex, False, 3, pts1);
    TRANSLATE_VERTEX(x, 0.2, 3, pts1);

    /* interior styles EMPTY, surface color index,
    surface edge DASHED, edge color index  */
    SET_EDGE_TYPE(PEXSurfaceEdgeDashDot);
    SET_EDGE_FLAG(PEXOn);
    SET_BF_SURFACE_COLOR_INDEX(4);
    SET_BF_INTERIOR_STYLE(PEXInteriorStyleEmpty)
    FILLAREA(PEXShapeConvex, False, 3, pts1);
    TRANSLATE_VERTEX(x, 0.2, 3, pts1);

    /* interior styles HOLLOW, surface edge DASHDOT, surface edge color index  */
    SET_BF_INTERIOR_STYLE(PEXInteriorStyleHollow)
    FILLAREA(PEXShapeConvex, False, 3, pts1);
    TRANSLATE_VERTEX(x, 0.2, 3, pts1);
    SET_EDGE_FLAG(PEXOff);

    /* interior bundle */
    SET_INTERIOR_BUNDLE_INDEX(1);
    SET_INDIVIDUAL_ASF(PEXASFBFInteriorStyle,PEXBundled);
    SET_INDIVIDUAL_ASF(PEXASFBFInteriorStyleIndex,PEXBundled);
    SET_INDIVIDUAL_ASF(PEXASFBFSurfaceColor,PEXIndividual);
    FILLAREA(PEXShapeConvex, False, 3, pts1);

}
 
void
testproc(dpy,window,x,y,w,h)
    Display		*dpy;
    Window		window;
    int			x,y,w,h;
{
    image_testproc("intrAttr",
	"interior attributes with fillarea and fillareaset", test_description,
	dpy,window,x,y,w,h);
} 

void
misc_setup(dpy, window, renderer)
Display		*dpy;
Window		window;
PEXRenderer	renderer;
{
}