1 /****************************************************************************
2 Copyright (C) 1987-2015 by Jeffery P. Hansen
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 ****************************************************************************/
18 #include "tkgate.h"
19
20 #define Z TkGate.circuit->zoom_factor
21
ZDrawLine(Display * D,Drawable d,GC gc,int x1,int y1,int x2,int y2)22 void ZDrawLine(Display *D,Drawable d,GC gc,int x1,int y1,int x2,int y2)
23 {
24 XDrawLine(D,d,gc,Z*x1,Z*y1,Z*x2,Z*y2);
25 }
26
ZDrawLines(Display * D,Drawable d,GC gc,XPoint * points,int npoints,int mode)27 void ZDrawLines(Display *D,Drawable d,GC gc,XPoint *points,int npoints,int mode)
28 {
29 if (Z == 1)
30 XDrawLines(D,d,gc,points,npoints,mode);
31 else {
32 int i;
33 for (i = 0;i < npoints;i++) {
34 points[i].x *= Z;
35 points[i].y *= Z;
36 }
37 XDrawLines(D,d,gc,points,npoints,mode);
38 for (i = 0;i < npoints;i++) {
39 points[i].x /= Z;
40 points[i].y /= Z;
41 }
42 }
43 }
44
ZDrawRectangle(Display * D,Drawable d,GC gc,int x,int y,unsigned width,unsigned height)45 void ZDrawRectangle(Display *D, Drawable d,GC gc,int x,int y,unsigned width,unsigned height)
46 {
47 XDrawRectangle(D,d,gc,Z*x,Z*y,Z*width,Z*height);
48 }
49
ZFillRectangle(Display * D,Drawable d,GC gc,int x,int y,unsigned width,unsigned height)50 void ZFillRectangle(Display *D, Drawable d,GC gc,int x,int y,unsigned width,unsigned height)
51 {
52 XFillRectangle(D,d,gc,Z*x,Z*y,Z*width,Z*height);
53 }
54
ZDrawString(GatePainter * painter,GC gc,int x,int y,char * string,int length)55 void ZDrawString(GatePainter *painter,GC gc,int x,int y,char *string,int length)
56 {
57 GatePainter_drawString(painter, gc,Z*x,Z*y,string,length);
58 }
59
ZDrawString16(Display * D,Drawable d,GC gc,int x,int y,XChar2b * string,int length)60 void ZDrawString16(Display *D,Drawable d,GC gc,int x,int y,XChar2b *string,int length)
61 {
62 XDrawString16(D,d,gc,Z*x,Z*y,string,length);
63 }
64
ZCopyArea(Display * D,Drawable src,Drawable dest,GC gc,int src_x,int src_y,unsigned width,unsigned height,int dest_x,int dest_y)65 void ZCopyArea(Display *D,Drawable src,Drawable dest,GC gc,int src_x,int src_y,
66 unsigned width,unsigned height,int dest_x,int dest_y)
67 {
68 src = Pixmap_zoom(src,Z);
69 XCopyArea(D,src,dest,gc,Z*src_x,Z*src_y,Z*width,Z*height,Z*dest_x,Z*dest_y);
70
71 }
72
ZCopyPlane(Display * D,Drawable src,Drawable dest,GC gc,int src_x,int src_y,unsigned width,unsigned height,int dest_x,int dest_y,unsigned long plane)73 void ZCopyPlane(Display *D,Drawable src,Drawable dest,GC gc,int src_x,int src_y,
74 unsigned width,unsigned height,int dest_x,int dest_y,unsigned long plane)
75 {
76 src = Pixmap_zoom(src,Z);
77 XCopyPlane(D,src,dest,gc,Z*src_x,Z*src_y,Z*width,Z*height,Z*dest_x,Z*dest_y,plane);
78 }
79
80
unZoomMetrics(Tk_FontMetrics * metrics)81 void unZoomMetrics(Tk_FontMetrics *metrics)
82 {
83 metrics->linespace /= Z;
84 metrics->ascent /= Z;
85 metrics->descent /= Z;
86 }
87
88