/* $XConsortium: wsxf4.pi,v 5.2 94/04/17 20:47:32 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. ******************************************************************/ ## wsxf4.pi - ## Set workstation transformation ## Test rendering with workstation transformation using non-square workstation ## Try different combinations of window and viewport: ## same asp ratio, different asp ratio, square, non-square ## Draw a polyline and verify pixels source macro.pi macro im_pixel_test(@msg) status = i_check_line3(xdisplay,xwindow,1,0,leftline,5,1); status1 = i_check_line3(xdisplay,xwindow,1,0,topline,5,1); status = or(status,status1); status1 = i_check_line3(xdisplay,xwindow,1,0,rightline,5,1); status = or(status,status1); status1 = i_check_line3(xdisplay,xwindow,1,0,bottomline,5,1); status = or(status,status1); if (status != 1) tfprintf("failed: output is rendered incorrectly, %s\n",@msg); tvprintf(1,"window(%.2f,%.2f,%.2f,%.2f,%.2f,%.2f)\n", @wxmin,@wxmax,@wymin,@wymax,@wzmin,@wzmax); tvprintf(1,"viewport(%.2f,%.2f,%.2f,%.2f,%.2f,%.2f)\n", @vxmin,@vxmax,@vymin,@vymax,@vzmin,@vzmax); endif i_pause(); endmacro tbegintest("wsxf4","rendering with ws transformation using non-square ws"); # INITIALIZE: workstation type wstype = i_get_ws_type("phigs_ws_type_x_drawable"); # SETUP: open phigs and a workstation, open and post a structure i_open_phigs(NULL,PDEF_MEM_SIZE); i_make_xwindow(&xdisplay,&xwindow,&conn,0,0,100,75); popen_ws(1,&conn,wstype); popen_struct(1); ppost_struct(1,1,1.0); # OPERATION, VERIFICATION and data INITIALIZATION begin: foreach @wxmin @wxmax @wymin @wymax @wzmin @wzmax @vxmin @vxmax @vymin @vymax @vzmin @vzmax @x1 @x2 @y1 @y2 @z1 @z2 ( 0.0;1.0; 0.0;0.75; 0.0;1.0; 0.0;100.0; 0.0;75.0; 0.0;1.0; # same aspect ratio, 0.1;0.9; 0.1;0.65; 0.1;0.9; # maximum non-square window and viewport 0.0;1.0; 0.0;1.0; 0.0;1.0; 0.0;100.0; 0.0;75.0; 0.0;1.0; # different aspect ratio, 0.1;0.9; 0.1;0.9; 0.1;0.9; # square window, non-square viewport 0.2;1.0; 0.1;0.5; 0.0;1.0; 20.0;100.0; 10.0;50.0; 0.0;1.0; # same aspect ratio, 0.3;0.9; 0.2;0.4; 0.1;0.9; # non-square window and viewport 0.0;0.5; 0.0;0.5; 0.0;1.0; 0.0;50.0; 0.0;50.0; 0.0;1.0; # same aspect ratio, 0.1;0.4; 0.1;0.4; 0.1;0.9; # square window and viewport ) # testing 2D case # initialize window and viewport structures (2D) window = I_Plimit(@wxmin,@wxmax,@wymin,@wymax); viewport = I_Plimit(@vxmin,@vxmax,@vymin,@vymax); # set ws transformation pset_ws_win(1,&window); pset_ws_vp(1,&viewport); # pixel validation, draw a box and verify pixels at expected locations box = IA_5_Ppoint(@x1,@y1, @x1,@y2, @x2,@y2, @x2,@y1, @x1,@y1); pl = I_Ppoint_list(5,box); ppolyline(&pl); leftline = IA_2_Ppoint3(@x1,@y1,0.0, @x1,@y2,0.0); topline = IA_2_Ppoint3(@x1,@y2,0.0, @x2,@y2,0.0); rightline = IA_2_Ppoint3(@x2,@y2,0.0, @x2,@y1,0.0); bottomline = IA_2_Ppoint3(@x2,@y1,0.0, @x1,@y1,0.0); im_pixel_test("2D case"); # remove polyline element from structure pdel_elem(); # testing 3D case # initialize window and viewport structures (3D) window3 = I_Plimit3(@wxmin,@wxmax,@wymin,@wymax,@wzmin,@wzmax); viewport3 = I_Plimit3(@vxmin,@vxmax,@vymin,@vymax,@vzmin,@vzmax); # set ws transformation pset_ws_win3(1,&window3); pset_ws_vp3(1,&viewport3); # pixel validation, draw a box and verify pixels at expected locations box3 = IA_5_Ppoint3(@x1,@y1,@z1,@x1,@y2,@z1,@x2,@y2,@z2, @x2,@y1,@z2,@x1,@y1,@z1); pl3 = I_Ppoint_list3(5,box3); ppolyline3(&pl3); leftline = IA_2_Ppoint3(@x1,@y1,@z1, @x1,@y2,@z1); topline = IA_2_Ppoint3(@x1,@y2,@z1, @x2,@y2,@z2); rightline = IA_2_Ppoint3(@x2,@y2,@z2, @x2,@y1,@z2); bottomline = IA_2_Ppoint3(@x2,@y1,@z2, @x1,@y1,@z1); im_pixel_test("3D case"); # remove polyline element from structure pdel_elem(); end tendtest()