[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: draw to a Raster....
From: |
Marcus G. Daniels |
Subject: |
Re: draw to a Raster.... |
Date: |
02 Apr 1998 15:17:10 -0800 |
>>>>> "GB" == Ginger Booth <address@hidden> writes:
GB> I need to draw circles to a Raster on an NT machine. How do I do that?
Please give this a try.
Index: ChangeLog
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/tkobjc/ChangeLog,v
retrieving revision 1.93
diff -c -r1.93 ChangeLog
*** ChangeLog 1998/04/02 19:52:08 1.93
--- ChangeLog 1998/04/02 23:10:07
***************
*** 1,5 ****
--- 1,12 ----
1998-04-02 Marcus G. Daniels <address@hidden>
+ * win32dib.[ch] (dib_fill): Make width and height arguments unsigned.
+ (dib_ellipse): New function.
+
+ * internal.[hm]: New function tkobjc_raster_ellipse.
+
+ * Raster.[hm]: New method ellipseX0:Y0:X1:Y1:Width:Color:.
+
* TkExtra.m (ensureBltSupportFiles): Cope with the inability
to find the Swarm source tree; use the current directory.
([TkExtra -preInitWithArgc:argv:]): Load bltGraph.tcl instead
Index: Raster.h
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/tkobjc/Raster.h,v
retrieving revision 1.15
diff -c -r1.15 Raster.h
*** Raster.h 1998/03/30 00:50:58 1.15
--- Raster.h 1998/04/02 23:10:07
***************
*** 32,37 ****
--- 32,38 ----
- setColormap: (id <Colormap>)colormap;
- drawPointX: (int)x Y: (int)y Color: (Color)c;
- fillRectangleX0: (int)x0 Y0: (int)y0 X1: (int)x1 Y1: (int)y1 Color:
(Color)c;
+ - ellipseX0: (int)x0 Y0: (int)y0 X1: (int)x1 Y1: (int)y1 Width:
(unsigned)width Color: (Color)c;
#ifndef _WIN32
- draw: (id <XDrawer>)xd X: (int)x Y: (int)y;
#endif
Index: Raster.m
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/tkobjc/Raster.m,v
retrieving revision 1.18
diff -c -r1.18 Raster.m
*** Raster.m 1998/03/30 00:50:58 1.18
--- Raster.m 1998/04/02 23:10:07
***************
*** 134,139 ****
--- 134,146 ----
return self;
}
+ - ellipseX0: (int)x0 Y0: (int)y0 X1: (int)x1 Y1: (int)y1
+ Width: (unsigned)penWidth Color: (Color)c
+ {
+ tkobjc_raster_ellipse (self, x0, y0, x1 - x0, y1 - y0, penWidth, c);
+ return self;
+ }
+
// copy the pixmap onto the X window.
- drawSelf
{
Index: internal.h
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/tkobjc/internal.h,v
retrieving revision 1.9
diff -c -r1.9 internal.h
*** internal.h 1998/03/30 00:50:59 1.9
--- internal.h 1998/04/02 23:10:07
***************
*** 37,42 ****
--- 37,47 ----
int x, int y,
unsigned width, unsigned height,
Color color);
+ void tkobjc_raster_ellipse (Raster *raster,
+ int x, int y,
+ unsigned width, unsigned height,
+ unsigned pixels,
+ Color color);
void tkobjc_raster_drawPoint (Raster *raster, int x, int y, Color color);
void tkobjc_raster_createContext (Raster *raster);
Index: internal.m
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/tkobjc/internal.m,v
retrieving revision 1.19
diff -c -r1.19 internal.m
*** internal.m 1998/03/30 01:20:43 1.19
--- internal.m 1998/04/02 23:10:07
***************
*** 169,174 ****
--- 169,193 ----
}
void
+ tkobjc_raster_ellipse (Raster *raster,
+ int x, int y,
+ unsigned width, unsigned height,
+ unsigned pixels,
+ Color color)
+ {
+ #ifndef _WIN32
+ PixelValue *map = ((Colormap *)raster->colormap)->map;
+ Display *display = Tk_Display (raster->tkwin);
+ GC gc = raster->gc;
+
+ XSetForeground (display, gc, map[color]);
+ XDrawArc (display, raster->pm, gc, x, y, width, height, 0, 23040);
+ #else
+ dib_ellipse ((dib_t *)raster->pm, x, y, width, height, pixels, color);
+ #endif
+ }
+
+ void
tkobjc_raster_drawPoint (Raster *raster, int x, int y, Color c)
{
Pixmap pm = raster->pm;
Index: win32dib.c
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/tkobjc/win32dib.c,v
retrieving revision 1.4
diff -c -r1.4 win32dib.c
*** win32dib.c 1998/03/30 01:00:12 1.4
--- win32dib.c 1998/04/02 23:10:07
***************
*** 178,184 ****
void
dib_fill (dib_t *dib,
int x, int y,
! int width, int height,
unsigned char color)
{
int frameWidth = dib->dibInfo->bmiHead.biWidth;
--- 178,184 ----
void
dib_fill (dib_t *dib,
int x, int y,
! unsigned width, unsigned height,
unsigned char color)
{
int frameWidth = dib->dibInfo->bmiHead.biWidth;
***************
*** 202,207 ****
--- 202,236 ----
ybase[xoff] = color;
}
}
+
+ void
+ dib_ellipse (dib_t *dib,
+ int x, int y,
+ unsigned width, unsigned height,
+ unsigned pixels,
+ unsigned char color)
+ {
+ HPEN oldPen, pen;
+ HBRUSH oldBrush;
+ RGBQUAD *rgb = &dib->dibInfo->rgb[color];
+
+ pen = CreatePen (PS_SOLID,
+ pixels,
+ RGB (rgb->rgbRed, rgb->rgbGreen, rgb->rgbBlue));
+
+ dib_lock (dib);
+
+ oldPen = SelectObject (dib->sourceDC, pen);
+ oldBrush = SelectObject (dib->sourceDC, GetStockObject (NULL_BRUSH));
+
+ Ellipse (dib->sourceDC, x, y, x + width, y + height);
+
+ DeleteObject (SelectObject (dib->sourceDC, oldPen));
+ SelectObject (dib->sourceDC, oldBrush);
+
+ dib_unlock (dib);
+ }
+
BOOL
dib_paintBlit (dib_t *dib,
Index: win32dib.h
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/tkobjc/win32dib.h,v
retrieving revision 1.2
diff -c -r1.2 win32dib.h
*** win32dib.h 1998/03/15 22:10:45 1.2
--- win32dib.h 1998/04/02 23:10:07
***************
*** 66,72 ****
int sourceX, int sourceY,
int sourceWidth, int sourceHeight);
! void dib_fill (dib_t *dib, int x, int y, int width, int height, unsigned char
color);
BOOL dib_copy (dib_t *source, dib_t *dest, int width, int height);
--- 66,73 ----
int sourceX, int sourceY,
int sourceWidth, int sourceHeight);
! void dib_fill (dib_t *dib, int x, int y, unsigned width, unsigned height,
unsigned char color);
! void dib_ellipse (dib_t *dib, int x, int y, unsigned width, unsigned height,
unsigned pixels, unsigned char color);
BOOL dib_copy (dib_t *source, dib_t *dest, int width, int height);
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
==================================