[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Stipples support in MS-Windows port
From: |
Elijah G. |
Subject: |
Re: Stipples support in MS-Windows port |
Date: |
Sun, 26 May 2024 20:05:38 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (windows-nt) |
Yuri Khan <yuri.v.khan@gmail.com> writes:
> If swapping the background and foreground colors to account for that
> mapping is not satisfactory for you, you could invert the bitmap
> before creating the brush.
>
> The steps to do that would be, if I have not completely forgotten the GDI API:
>
> 1. Use CreateCompatibleDC to create a memory DC.
> 2. Select the stipple bitmap into this memory DC using SelectObject.
> 3. Call InvertRect on that DC, passing (0, 0)–(w, h) as the target rectangle.
Thank you for the advises.
Can you explain why use (0, 0)-(w, h) instead the defined RECT from the
code please?
Here is the current function code with the advises applied (except the
third step that i had to use a defined RECT), but it doesn't seems work
neither, i don't know if i did something wrong when applying the steps:
--8<---------------cut here---------------start------------->8---
static void
w32_fill_stipple_pattern (HDC hdc, struct glyph_string *s, Emacs_GC *gc,
int x, int y, unsigned int width, unsigned int height)
{
SetTextColor (hdc, gc->foreground);
SetBkColor (hdc, gc->background);
RECT r;
r.left = x;
r.top = y;
r.right = x + width;
r.bottom = y + height;
Emacs_Pixmap bm;
bm = FRAME_DISPLAY_INFO (s->f)->bitmaps[s->face->stipple - 1].stipple;
HDC comp_dc = CreateCompatibleDC(hdc);
SelectObject (comp_dc, bm);
InvertRect (comp_dc, &r);
HBRUSH hb = CreatePatternBrush (bm);
FillRect (hdc, &r, hb);
DeleteObject (hb);
DeleteDC(comp_dc);
}
--8<---------------cut here---------------end--------------->8---
Also i'm wondering if BitBlt can be another solution too.
- Re: Stipples support in MS-Windows port, (continued)
- Re: Stipples support in MS-Windows port, Eli Zaretskii, 2024/05/25
- Re: Stipples support in MS-Windows port, Arash Esbati, 2024/05/25
- Re: Stipples support in MS-Windows port, Po Lu, 2024/05/25
- Re: Stipples support in MS-Windows port, Arash Esbati, 2024/05/27
- Re: Stipples support in MS-Windows port, Elijah G., 2024/05/25
- Re: Stipples support in MS-Windows port, Yuri Khan, 2024/05/26
- Re: Stipples support in MS-Windows port,
Elijah G. <=
- Re: Stipples support in MS-Windows port, Yuri Khan, 2024/05/27
- Re: Stipples support in MS-Windows port, Elijah G., 2024/05/27
- Re: Stipples support in MS-Windows port, Eli Zaretskii, 2024/05/26
- Re: Stipples support in MS-Windows port, Elijah G., 2024/05/27