3 Copyright 1996, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
27 * (c) Copyright 1996 Hewlett-Packard Company
28 * (c) Copyright 1996 International Business Machines Corp.
29 * (c) Copyright 1996 Sun Microsystems, Inc.
30 * (c) Copyright 1996 Novell, Inc.
31 * (c) Copyright 1996 Digital Equipment Corp.
32 * (c) Copyright 1996 Fujitsu Limited
33 * (c) Copyright 1996 Hitachi, Ltd.
35 * Permission is hereby granted, free of charge, to any person obtaining
36 * a copy of this software and associated documentation files (the
37 * "Software"), to deal in the Software without restriction, including
38 * without limitation the rights to use, copy, modify, merge, publish,
39 * distribute, sublicense, and/or sell copies of the Software, and to
40 * permit persons to whom the Software is furnished to do so, subject
41 * to the following conditions:
43 * The above copyright notice and this permission notice shall be included
44 * in all copies or substantial portions of the Software.
46 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
49 * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
50 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
51 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
54 * Except as contained in this notice, the names of the copyright holders
55 * shall not be used in advertising or otherwise to promote the sale, use
56 * or other dealings in this Software without prior written authorization
57 * from said copyright holders.
60 /*******************************************************************
62 ** *********************************************************
66 ** * Contents: Arc-drawing code for the PS DDX driver
68 ** * Created By: Roger Helmendach (Liberty Systems)
70 ** * Copyright: Copyright 1996 The Open Group, Inc.
72 ** *********************************************************
74 ********************************************************************/
76 #ifdef HAVE_DIX_CONFIG_H
77 #include <dix-config.h>
84 #include "windowstr.h"
88 DrawablePtr pDrawable
,
93 if( pDrawable
->type
==DRAWABLE_PIXMAP
)
96 PixmapPtr pix
= (PixmapPtr
)pDrawable
;
97 PsPixmapPrivPtr priv
= (PsPixmapPrivPtr
)pix
->devPrivate
.ptr
;
101 if ((gc
= PsCreateAndCopyGC(pDrawable
, pGC
)) == NULL
) return;
103 disp
= PsGetFreeDisplayBlock(priv
);
105 elm
= &disp
->elms
[disp
->nelms
];
106 elm
->type
= PolyArcCmd
;
108 elm
->c
.arcs
.nArcs
= nArcs
;
109 elm
->c
.arcs
.pArcs
= (xArc
*)xalloc(nArcs
*sizeof(xArc
));
110 memcpy(elm
->c
.arcs
.pArcs
, pArcs
, nArcs
*sizeof(xArc
));
119 if( PsUpdateDrawableGC(pGC
, pDrawable
, &psOut
, &cMap
)==FALSE
) return;
120 PsOut_Offset(psOut
, pDrawable
->x
, pDrawable
->y
);
121 PsOut_Color(psOut
, PsGetPixelColor(cMap
, pGC
->fgPixel
));
122 PsLineAttrs(psOut
, pGC
, cMap
);
123 for( i
=0 ; i
<nArcs
; i
++ )
125 PsOut_DrawArc(psOut
, (int)pArcs
[i
].x
, (int)pArcs
[i
].y
,
126 (int)pArcs
[i
].width
, (int)pArcs
[i
].height
,
127 (float)pArcs
[i
].angle1
/64.,
128 (float)pArcs
[i
].angle2
/64.);
135 DrawablePtr pDrawable
,
140 if( pDrawable
->type
==DRAWABLE_PIXMAP
)
143 PixmapPtr pix
= (PixmapPtr
)pDrawable
;
144 PsPixmapPrivPtr priv
= (PsPixmapPrivPtr
)pix
->devPrivate
.ptr
;
148 if ((gc
= PsCreateAndCopyGC(pDrawable
, pGC
)) == NULL
) return;
150 disp
= PsGetFreeDisplayBlock(priv
);
152 elm
= &disp
->elms
[disp
->nelms
];
153 elm
->type
= PolyFillArcCmd
;
155 elm
->c
.arcs
.nArcs
= nArcs
;
156 elm
->c
.arcs
.pArcs
= (xArc
*)xalloc(nArcs
*sizeof(xArc
));
157 memcpy(elm
->c
.arcs
.pArcs
, pArcs
, nArcs
*sizeof(xArc
));
167 if( PsUpdateDrawableGC(pGC
, pDrawable
, &psOut
, &cMap
)==FALSE
) return;
168 PsOut_Offset(psOut
, pDrawable
->x
, pDrawable
->y
);
169 PsSetFillColor(pDrawable
, pGC
, psOut
, cMap
);
170 PsLineAttrs(psOut
, pGC
, cMap
);
171 if( pGC
->arcMode
==ArcChord
) styl
= PsChord
;
172 else styl
= PsPieSlice
;
173 for( i
=0 ; i
<nArcs
; i
++ )
175 PsOut_FillArc(psOut
, (int)pArcs
[i
].x
, (int)pArcs
[i
].y
,
176 (int)pArcs
[i
].width
, (int)pArcs
[i
].height
,
177 (float)pArcs
[i
].angle1
/64.,
178 (float)pArcs
[i
].angle2
/64., styl
);