aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2003-02-02 01:41:49 +0000
committernyamatongwe <unknown>2003-02-02 01:41:49 +0000
commit0b888c29a9668001142098b5f7743fe1135c204c (patch)
treef11f89a07219c1a1a8a2fb7052f3b0e7a9ec67b5
parent3f329e8a6b1c4735ab1cf4f43848292db8df3d3b (diff)
downloadscintilla-mirror-0b888c29a9668001142098b5f7743fe1135c204c.tar.gz
Transaprent text drawing.
-rw-r--r--win32/PlatWin.cxx22
1 files changed, 21 insertions, 1 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index aa1a4d656..9943471bd 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -133,7 +133,6 @@ static void SetLogFont(LOGFONT &lf, const char *faceName, int characterSet, int
lf.lfItalic = static_cast<BYTE>(italic ? 1 : 0);
lf.lfCharSet = static_cast<BYTE>(characterSet);
strncpy(lf.lfFaceName, faceName, sizeof(lf.lfFaceName));
- lf.lfQuality = NONANTIALIASED_QUALITY;
}
/**
@@ -308,6 +307,7 @@ public:
void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back);
void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back);
+ void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore);
void MeasureWidths(Font &font_, const char *s, int len, int *positions);
int WidthText(Font &font_, const char *s, int len);
int WidthChar(Font &font_, char ch);
@@ -547,6 +547,26 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const c
}
}
+void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len,
+ ColourAllocated fore) {
+ SetFont(font_);
+ ::SetTextColor(hdc, fore.AsLong());
+ ::SetBkMode(hdc, TRANSPARENT);
+ RECT rcw = RectFromPRectangle(rc);
+ if (unicodeMode) {
+ wchar_t tbuf[MAX_US_LEN];
+ int tlen = UCS2FromUTF8(s, len, tbuf, sizeof(tbuf)/sizeof(wchar_t)-1);
+ tbuf[tlen] = L'\0';
+ ::ExtTextOutW(hdc, rc.left, ybase, 0, &rcw, tbuf, tlen, NULL);
+ } else {
+ // There appears to be a 16 bit string length limit in GDI
+ if (len > 65535)
+ len = 65535;
+ ::ExtTextOut(hdc, rc.left, ybase, 0, &rcw, s, len, NULL);
+ }
+ ::SetBkMode(hdc, OPAQUE);
+}
+
int SurfaceImpl::WidthText(Font &font_, const char *s, int len) {
SetFont(font_);
SIZE sz={0,0};