summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/tkWinDraw.c6
-rw-r--r--win/tkWinFont.c38
-rw-r--r--win/tkWinInt.h5
3 files changed, 42 insertions, 7 deletions
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