1 /*******************************************************************
3 ** *********************************************************
8 ** * Pixel-drawing code for the PCL DDX driver
10 ** * Created: 10/23/95
12 ** *********************************************************
14 ********************************************************************/
16 (c) Copyright 1996 Hewlett-Packard Company
17 (c) Copyright 1996 International Business Machines Corp.
18 (c) Copyright 1996 Sun Microsystems, Inc.
19 (c) Copyright 1996 Novell, Inc.
20 (c) Copyright 1996 Digital Equipment Corp.
21 (c) Copyright 1996 Fujitsu Limited
22 (c) Copyright 1996 Hitachi, Ltd.
24 Permission is hereby granted, free of charge, to any person obtaining a copy
25 of this software and associated documentation files (the "Software"), to deal
26 in the Software without restriction, including without limitation the rights
27 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28 copies of the Software, and to permit persons to whom the Software is
29 furnished to do so, subject to the following conditions:
31 The above copyright notice and this permission notice shall be included in
32 all copies or substantial portions of the Software.
34 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
38 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
39 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 Except as contained in this notice, the names of the copyright holders shall
42 not be used in advertising or otherwise to promote the sale, use or other
43 dealings in this Software without prior written authorization from said
47 #ifdef HAVE_DIX_CONFIG_H
48 #include <dix-config.h>
53 #include "windowstr.h"
59 PclPolyPoint( pDrawable
, pGC
, mode
, nPoints
, pPoints
)
60 DrawablePtr pDrawable
;
73 PclContextPrivPtr cPriv
;
74 PclPixmapPrivPtr pPriv
;
77 if( PclUpdateDrawableGC( pGC
, pDrawable
, &outFile
) == FALSE
)
80 xoffset
= pDrawable
->x
;
81 yoffset
= pDrawable
->y
;
84 * Enter HP-GL/2 and change the line style to one in which only
85 * the vertices of the specified polyline are drawn. We must also
86 * temporarily change the line width so that only a single pixel
87 * is drawn. Then move to the first possible location.
89 xloc
= pPoints
[0].x
+ pDrawable
->x
;
90 yloc
= pPoints
[0].y
+ pDrawable
->y
;
92 sprintf( t
, "\27%%0BPW0,0;LT0;PU;PA%d,%d", xloc
, yloc
);
93 SEND_PCL( outFile
, t
);
96 * Check each point against the clip region. If it is outside the
97 * region, don't send the PCL to the printer.
100 for( i
= 0; i
< nPoints
; i
++ )
102 if( POINT_IN_REGION( pGC
->pScreen
, pGC
->clientClip
, xloc
, yloc
, &box
) )
104 sprintf( t
, ",%d,%d", xloc
, yloc
);
105 SEND_PCL( outFile
, t
);
108 if( mode
== CoordModeOrigin
)
110 xloc
= pPoints
[i
+1].x
+ xoffset
;
111 yloc
= pPoints
[i
+1].y
+ yoffset
;
115 xloc
+= pPoints
[i
+1].x
;
116 yloc
+= pPoints
[i
+1].y
;
122 * Change the line style and width back to what they were before
123 * this routine was called. No, this isn't pretty...
125 if( pDrawable
->type
== DRAWABLE_WINDOW
)
127 pCon
= PclGetContextFromWindow( (WindowPtr
)pDrawable
);
128 cPriv
= pCon
->devPrivates
[PclContextPrivateIndex
].ptr
;
129 cPriv
->changeMask
= GCLineWidth
| GCLineStyle
;
134 ((PixmapPtr
)pDrawable
)->devPrivates
[PclPixmapPrivateIndex
].ptr
;
135 pPriv
->changeMask
= GCLineWidth
| GCLineStyle
;
139 PclUpdateDrawableGC( pGC
, pDrawable
, &outFile
);
144 SEND_PCL( outFile
, "\27%0A" );
148 PclPushPixels( pGC
, pBitmap
, pDrawable
, width
, height
, x
, y
)
151 DrawablePtr pDrawable
;