summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-02-26 02:47:03 (GMT)
committerhobbs <hobbs>2003-02-26 02:47:03 (GMT)
commit068b4d37aa8b1004f70c6ed479cd310b291c16f1 (patch)
tree07a34ff2fec532c96eb7d5eb54524c19b49c6e91
parent545636f30356c3701dab3eac90deaf3a87d88c47 (diff)
downloadtk-068b4d37aa8b1004f70c6ed479cd310b291c16f1.zip
tk-068b4d37aa8b1004f70c6ed479cd310b291c16f1.tar.gz
tk-068b4d37aa8b1004f70c6ed479cd310b291c16f1.tar.bz2
* win/tkWinInt.h:
* win/tkWinDraw.c: * win/tkWinFont.c (Tk_DrawChars): add support for simple XOR text drawing on Windows. [Patch #685388] (martin)
-rw-r--r--ChangeLog5
-rw-r--r--win/tkWinDraw.c6
-rw-r--r--win/tkWinFont.c38
-rw-r--r--win/tkWinInt.h5
4 files changed, 47 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 8b6887c..fcd12e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2003-02-25 Jeff Hobbs <jeffh@ActiveState.com>
+ * win/tkWinInt.h:
+ * win/tkWinDraw.c:
+ * win/tkWinFont.c (Tk_DrawChars): add support for simple XOR text
+ drawing on Windows. [Patch #685388] (martin)
+
* generic/tkMenu.c (TkMenuCleanup): make sure to reset static
menusInitialized on finalize. [Bug #548729]
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index 27ce4ca..39a3d9c 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinDraw.c,v 1.11 2001/12/07 05:20:52 chengyemao Exp $
+ * RCS: @(#) $Id: tkWinDraw.c,v 1.12 2003/02/26 02:47:04 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -57,7 +57,7 @@ int tkpWinRopModes[] = {
#define SRCORREVERSE (DWORD)0x00DD0228 /* dest = source OR (NOT dest) */
#define SRCNAND (DWORD)0x007700E6 /* dest = NOT (source AND dest) */
-static int bltModes[] = {
+int tkpWinBltModes[] = {
BLACKNESS, /* GXclear */
SRCAND, /* GXand */
SRCERASE, /* GXandReverse */
@@ -328,7 +328,7 @@ XCopyArea(display, src, dest, gc, src_x, src_y, width, height, dest_x, dest_y)
}
BitBlt(destDC, dest_x, dest_y, width, height, srcDC, src_x, src_y,
- bltModes[gc->function]);
+ tkpWinBltModes[gc->function]);
SelectClipRgn(destDC, NULL);
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 87a7e82..acdd28f 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinFont.c,v 1.16 2002/08/05 14:01:15 dgp Exp $
+ * RCS: @(#) $Id: tkWinFont.c,v 1.17 2003/02/26 02:47:05 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -895,11 +895,45 @@ Tk_DrawChars(
DeleteDC(dcMem);
SelectObject(dc, oldBrush);
DeleteObject(stipple);
- } else {
+ } else if (gc->function == GXcopy) {
SetTextAlign(dc, TA_LEFT | TA_BASELINE);
SetTextColor(dc, gc->foreground);
SetBkMode(dc, TRANSPARENT);
MultiFontTextOut(dc, fontPtr, source, numBytes, x, y);
+ } else {
+ HBITMAP oldBitmap, bitmap;
+ HDC dcMem;
+ TEXTMETRIC tm;
+ SIZE size;
+
+ dcMem = CreateCompatibleDC(dc);
+
+ SetTextAlign(dcMem, TA_LEFT | TA_BASELINE);
+ SetTextColor(dcMem, gc->foreground);
+ SetBkMode(dcMem, TRANSPARENT);
+ SetBkColor(dcMem, RGB(0, 0, 0));
+
+ /*
+ * Compute the bounding box and create a compatible bitmap.
+ */
+
+ GetTextExtentPoint(dcMem, source, numBytes, &size);
+ GetTextMetrics(dcMem, &tm);
+ size.cx -= tm.tmOverhang;
+ bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
+ oldBitmap = SelectObject(dcMem, bitmap);
+
+ MultiFontTextOut(dcMem, fontPtr, source, numBytes, 0, tm.tmAscent);
+ BitBlt(dc, x, y - tm.tmAscent, size.cx, size.cy, dcMem,
+ 0, 0, tkpWinBltModes[gc->function]);
+
+ /*
+ * Destroy the temporary bitmap and restore the device context.
+ */
+
+ SelectObject(dcMem, oldBitmap);
+ DeleteObject(bitmap);
+ DeleteDC(dcMem);
}
TkWinReleaseDrawableDC(drawable, dc, &state);
}
diff --git a/win/tkWinInt.h b/win/tkWinInt.h
index ca4916a..cbe2290 100644
--- a/win/tkWinInt.h
+++ b/win/tkWinInt.h
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinInt.h,v 1.13 2002/04/12 07:18:49 hobbs Exp $
+ * RCS: @(#) $Id: tkWinInt.h,v 1.14 2003/02/26 02:47:05 hobbs Exp $
*/
#ifndef _TKWININT
@@ -127,10 +127,11 @@ typedef struct {
/*
* The following variable is a translation table between X gc functions and
- * Win32 raster op modes.
+ * Win32 raster and BitBlt op modes.
*/
extern int tkpWinRopModes[];
+extern int tkpWinBltModes[];
/*
* The following defines are used with TkWinGetBorderPixels to get the