From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Elijah G." Newsgroups: gmane.emacs.devel Subject: Re: Stipples support in MS-Windows port Date: Sun, 26 May 2024 20:05:38 -0600 Message-ID: <86o78sm2kt.fsf@gmail.com> References: <87a5l49a53.fsf@yahoo.com> <87seyw7udp.fsf@yahoo.com> <87wmo0zzni.fsf@yahoo.com> <86r0e83gez.fsf@gnu.org> <861q661vgf.fsf@gmail.com> <86le4dvxx9.fsf@gmail.com> <87frulynby.fsf@yahoo.com> <86zfslctt8.fsf@gmail.com> <86r0dwag4n.fsf@gnu.org> <86r0dww9ne.fsf@gmail.com> <86le43x6ss.fsf@gmail.com> <86o78z8jw2.fsf@gnu.org> <86o78yr45t.fsf@gmail.com> <86h6em1hih.fsf@gnu.org> <86cyp9h0xq.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33105"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (windows-nt) Cc: Eli Zaretskii , luangruo@yahoo.com, emacs-devel@gnu.org To: Yuri Khan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon May 27 04:06:45 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sBPl7-0008Pe-8J for ged-emacs-devel@m.gmane-mx.org; Mon, 27 May 2024 04:06:45 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sBPkM-0003Nj-8P; Sun, 26 May 2024 22:05:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sBPkK-0003NJ-Af for emacs-devel@gnu.org; Sun, 26 May 2024 22:05:56 -0400 Original-Received: from mail-ot1-x344.google.com ([2607:f8b0:4864:20::344]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sBPkE-0000GQ-81; Sun, 26 May 2024 22:05:55 -0400 Original-Received: by mail-ot1-x344.google.com with SMTP id 46e09a7af769-6f662252c7eso2828576a34.3; Sun, 26 May 2024 19:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716775548; x=1717380348; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FaaeIrn5FXEL8vTMqKEK7aMZHb4K9vjQ9h7V+WI/P08=; b=K6UqJUAxIwREZAPTtOwEHCG2faK2vIdWPpWRsD2aI2aIS4Rct17KZfZBWbCb5f26tN tPgdg/pGCeQEoUEcQs5qKaz2dLJp4SIKropTG2b9PgGM5Lh9S0PEyjaybm1TZx1JAVD9 qQLlHTaiWsDPq9CMRRdXz+bXCCTUoKPO4vCGf1Zqk1EZEZ6L22ghtNGoOl6LqWRen9fU cpxwnY0SaIfTHYFP+qKYSPX+3/QL5V1T2Y7h/A3DXo2vircmIPDlJZlkm1Ffmkg43XtH wyZlozGUsYQlVRopfgYTv5cBArvA2KsZ9n61e4zauhEvx2CXc+oVjr3ffy8PQgtnD4Gd 7U5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716775548; x=1717380348; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FaaeIrn5FXEL8vTMqKEK7aMZHb4K9vjQ9h7V+WI/P08=; b=vuughEnTM450S1+71G3IGFfBgNu9aGzaRer95Sdlb1XAHlytP64lcl/fVpquyTg8b2 Ciq+qL9Uzw+8xw6mFwyictLFbxrjLUMcyKY+baPZK3Xt5HzRuOlsnqc4K4T97FG7oHuQ tTKQJmxFTaeKlHqmtDJs5NWh4VcctVIbRxzQKrqmLaDzlxJ829tSp1sNJ1+pqfksn79g 3PITOW4kbWaFZG/acwZKIAdyqbn2HmTTqTPiSxRDIS6XtrS2MigBPEFhZFUrbvQJ4WLY jCJFZzLUUGb/A3rfTnR8L1v1f2mqBW7QFdL9GHvRGcwx2r+YGLRwvVv4YpsKx/uo6Q7B Qtdw== X-Forwarded-Encrypted: i=1; AJvYcCUteSAWm97kopJDdbldfYWeZu2Pwl0fhy2BdqubWXj+2AbUhe6vMqRb+uOCkcp3PH9rMbf7skuVIaLi5YWboI3YiXdc X-Gm-Message-State: AOJu0YznxQBNTYHgxCQXO0hlBSeT7eThyu26wozXu1VNKh7o007Am2iI KBK9mOsLuPNl8leJOkMnHO8O7tqOuLiWqxMRsjzy/HHYTBdYjitQJeGCb2R6 X-Google-Smtp-Source: AGHT+IFvA49KcMOb/ZIKIAFmAEeUZE8P+FGaAXbW12lcJl1v16dl+LOzVmIgC/X8Iu2iRbuP5J7J3w== X-Received: by 2002:a9d:4804:0:b0:6f0:e870:6ad7 with SMTP id 46e09a7af769-6f8d0b924c1mr8353759a34.37.1716775548108; Sun, 26 May 2024 19:05:48 -0700 (PDT) Original-Received: from LIBERO ([187.184.24.187]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6f8d0e99dfdsm1416552a34.80.2024.05.26.19.05.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 19:05:47 -0700 (PDT) In-Reply-To: (Yuri Khan's message of "Sun, 26 May 2024 15:09:58 +0700") Received-SPF: pass client-ip=2607:f8b0:4864:20::344; envelope-from=eg642616@gmail.com; helo=mail-ot1-x344.google.com X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:319595 Archived-At: Yuri Khan 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)=E2=80=93(w, h) as the targe= t 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 =3D x; r.top =3D y; r.right =3D x + width; r.bottom =3D y + height; Emacs_Pixmap bm; bm =3D FRAME_DISPLAY_INFO (s->f)->bitmaps[s->face->stipple - 1].stipple; HDC comp_dc =3D CreateCompatibleDC(hdc); SelectObject (comp_dc, bm); InvertRect (comp_dc, &r); HBRUSH hb =3D 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.