/* $XConsortium: pldata3.pi,v 5.2 94/04/17 20:48:49 rws Exp $ */ /***************************************************************** Copyright (c) 1989, 1990, 1991,1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright (c) 1989, 1990, 1991,1990 by Sun Microsystems, Inc. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Sun Microsystems, and the X Consortium, not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT 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 SOFTWARE. ******************************************************************/ ## pldata3.pi - test ppolyline_set3_data with index color. ## Draw a multi-segment polyline set, and automatically ## confirm color at 3 midpoints. tbegintest("pldata3", "polyline set3 w/data, with index color"); source macro.pi @WINSIZE = 200 @SAMPLESIZE = 200 @WHITE = 1 @RED = 2 @GREEN = 3 @BLUE = 4 @YELLOW = 5 # # data for a few polylines: vertices and RGB colors # # a polyline across the bottom and then across to upper left, # and a horizontal one from upper middle to upper right pline1 = I_Pline_vdata_list3_from_data(3, PVERT_COORD_COLOUR, PINDIRECT, 0.1,0.1,0.1, @RED, 0.9,0.1,0.2, @GREEN, 0.1,0.9,0.3, @YELLOW); pline2 = I_Pline_vdata_list3_from_data(2, PVERT_COORD_COLOUR, PINDIRECT, 0.5,0.8,0.9, @BLUE, 1.0,0.8,0.6, @WHITE); pline_set = IA_Pline_vdata_list3(2, pline1, pline2); # points in the middle of each segment drawn point1 = I_Ppoint3(0.5,0.1,0.0); point2 = I_Ppoint3(0.5,0.5,0.0); point3 = I_Ppoint3(0.7,0.8,0.0); # Set up phigs, workstation, and structure i_open_phigs(NULL,PDEF_MEM_SIZE); i_open_x_ws(1, &display, &window, 100, 300, @WINSIZE, @WINSIZE); popen_struct(1); ppost_struct(1,1,1.0); # make them wide so we won't miss pset_linewidth(3.0); ppolyline_set3_data(PVERT_COORD_COLOUR, PINDIRECT, 2, pline_set); # verify pixels using macro im_confirm_point3(display, window, 1, 0, point1, 1, 5, @RED, "first seg of 2-seg index-color polyline"); im_confirm_point3(display, window, 1, 0, point2, 1, 5, @GREEN, "second seg of 2-seg index-color polyline"); im_confirm_point3(display, window, 1, 0, point3, 1, 5, @BLUE, "middle of one-seg index-color polyline"); i_pause(); tendtest();