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: Sat, 4 May 2024 21:43:51 -0600 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000b3ba1e0617acc33a" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12921"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 05 05:44:59 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 1s3So7-0003A8-7f for ged-emacs-devel@m.gmane-mx.org; Sun, 05 May 2024 05:44:59 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3SnR-0002xk-EI; Sat, 04 May 2024 23:44:17 -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 1s3SnL-0002ws-Ny for emacs-devel@gnu.org; Sat, 04 May 2024 23:44:13 -0400 Original-Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3SnG-00021K-V5 for emacs-devel@gnu.org; Sat, 04 May 2024 23:44:09 -0400 Original-Received: by mail-qt1-x842.google.com with SMTP id d75a77b69052e-43ad398f164so4429231cf.2 for ; Sat, 04 May 2024 20:44:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714880645; x=1715485445; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0RH1f66pacuuthUiBlmm0uPwKHTTSFPxxQbv7dfUFfs=; b=cqjfgXq8QzWKv0D7pLJLWe8gCQJY1xyV/KyNzDZFMBl6flSXMFd7WFll+DXKwL9Zup JJuUTCEgatTJI1OOOCmbAAdVRrB4VRh5Z1rMD2tEK9jr0mZXc05YZNo/Mf5LvV+KaI1H BLkyU9by9qzZVm+Qhqo1pOPJbK+DhCwDziDkUrO0c4lDBZmYn1N+94H1jcBL9iKp+PPo 5Kk1iVpnGIoNZMNfqmQOXb3m/V75xfdNyIRKV4DQVWNomONjMkqDScTKXgswAzmwZC20 QRTtqDivfYcd6XK6wapl8T9ly9xWcEC//dmWjXivXUDcUKECSFC2rW81TqLW5CDsMdpE 1+cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714880645; x=1715485445; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0RH1f66pacuuthUiBlmm0uPwKHTTSFPxxQbv7dfUFfs=; b=vPSXVDKf/p8K9w0Ko9nIFS17KLvgglmjZ/bKqGlglAXRKRIDUskTWfm0rWU8RpCFgM zPzJgb5G6PPdNBJR+h6WGnMiFUZgiTcqw3U34OnpJf5FLdq8XCEBJV/D5UOCFtLnknHo Wvys5aZmuO4L1oduueOoH0wQ+aedAm5OnCvPdNJ7y6lAoYGUvhcbCt0fePzy277DNAA1 R71KRdHFlQnofl3oZ3SghDRkVw9XeleVkJumIyCynIqiNEm08YVjziWVc5EPGNmoXuAS 69ixvWBYyXC5DDUhcUAg16dkYh69HpwKPn5nFj1ghSSDco85SPz2exIPYbh46exhUDTy X5Xg== X-Gm-Message-State: AOJu0YwdgrcIA/U8wyk9isMr8y+vMig7wZ4EInm5qTDYM72tcC1fSQVY n88To8o+dfuBn6VE/HEzocN0108uKcNDz85KUHoYrsA/qIfJZayH2skHfdgfM+6k0Wk6lh7wcUN xa4wAjFU+oxrWQ7nE2dpoLlNdTdpMZ7d4 X-Google-Smtp-Source: AGHT+IERSYc7lkeUDBRo5ZZg6Kem7s0S7yJILaWUFK9hejN7RChfRMFIqW903dDCKOLlh3FNF+56XumIHtaMfpdyats= X-Received: by 2002:a05:622a:409:b0:43a:67c2:d2ed with SMTP id n9-20020a05622a040900b0043a67c2d2edmr7794011qtx.12.1714880645395; Sat, 04 May 2024 20:44:05 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::842; envelope-from=eg642616@gmail.com; helo=mail-qt1-x842.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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:318761 Archived-At: --000000000000b3ba1e0617acc33a Content-Type: multipart/alternative; boundary="000000000000b3ba1d0617acc338" --000000000000b3ba1d0617acc338 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, May 3, 2024 at 1:30=E2=80=AFAM Po Lu wrote: > > The closest thing i got was using w32_draw_rectangle > > inside w32_draw_glyph_string_background > > but for some reason it freezes and crashes after evaling > > the snippet, I'm not sure if it is related to the way I did it or is > > anything related to GC. > > You appear to fundamentally misunderstand the nature of stipples and > which component bears the burden of its implementation. A stipple > pattern is a repeating bitmap pattern that replaces the solid background > color of a face, in which pattern "on" pixels are tinted the foreground > color of the face, and off pixels the background, and whose repetition > is such that its tiles (instances of its bitmap) extend from a > conceptual "origin" defined by the position of the drawable. In X, > stipples are natively supported by graphics primitives, being simply > properties of the GC (graphics context), to wit, the fill style, the > stipple bitmap, and the tile/stipple origin offset, which three > properties are direct determinants of the imagery produced by > polygon-filling or stroking operations, and are configured some time > before x_draw_glyph_string_background is invoked, relieving the latter > of all responsibility, with respect to stipples, but enabling the > prepared stipple pattern when appropriate. This is the reason that the > disabled code in the related W32 function is no more than a few calls to > XDrawRectangle, but as the supporting infrastructure, both in Emacs and > the display server, is not present on MS Windows, enabling just this > code, even if it does not crash, serves little purpose. Thank you for explain me, I was a little confused in how stipples works. > Your task is not to uncomment this handful of lines, but to establish > how best to express these X concepts in terms of primitives available on > MS Windows, and implement them in a manner appropriate for _Windows_, > without regard to the specifics of the X implementation. Thanks, as far as i understood then should not i touch or even edit those lines? I was thinking in define them (since them are only available in X) inside the same file, similar in how pgtkterm.c or androidterm.c does, i think i should check again `image_create_bitmap_from_data' and `prepare_face_for_display' definitions. > > Below this mail can you get the patch for test it > > (Also i'm sorry if the patch is too long i accidentally > > formatted it with clang-format) > > I suggest reverting the portions of the patch that are the work of > clang-format, as we cannot accept such drastic whitespace changes, and > the substantive changes simply vanish in their midst. Thank you, i've reverted the changes done by clang-format, reviewing the test that i made i got notice it works a bit similar to `box' property and not to a stipple, but anyways i'm sending it here if it can be useful. > > Also can i ask what is the purpose of this line? > > ``` > > # include "bitmaps/gray.xbm" > > ``` > > It includes the bitmap image, bitmap/gray.xbm, which is a C header > defining an array and several parameters. This is not relevant on > Windows. Thank you for the help, I wasn't familiar with X.org stuffs (since I'm in Windows and most of them are not available) and with C (specially in a big project such as emacs). But I have faith that I can help in this. --000000000000b3ba1d0617acc338 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, May 3, 2024 at 1:30=E2=80=AFAM Po Lu <luangruo@yahoo.com> wrote:
> > The closest thing i got was using w32_draw_rectangle
> > inside w32_draw_glyph_string_background
> > but for some reason it freezes and crashes after evaling
> > the snippet, I'm not sure if it is related to the way I did i= t or is
> > anything related to GC.
>
> You appear to fundamentally misunderstand the nature of stipples and > which component bears the burden of its implementation.=C2=A0 A stippl= e
> pattern is a repeating bitmap pattern that replaces the solid backgrou= nd
> color of a face, in which pattern "on" pixels are tinted the= foreground
> color of the face, and off pixels the background, and whose repetition=
> is such that its tiles (instances of its bitmap) extend from a
> conceptual "origin" defined by the position of the drawable.= =C2=A0 In X,
> stipples are natively supported by graphics primitives, being simply > properties of the GC (graphics context), to wit, the fill style, the > stipple bitmap, and the tile/stipple origin offset, which three
> properties are direct determinants of the imagery produced by
> polygon-filling or stroking operations, and are configured some time > before x_draw_glyph_string_background is invoked, relieving the latter=
> of all responsibility, with respect to stipples, but enabling the
> prepared stipple pattern when appropriate.=C2=A0 This is the reason th= at the
> disabled code in the related W32 function is no more than a few calls = to
> XDrawRectangle, but as the supporting infrastructure, both in Emacs an= d
> the display server, is not present on MS Windows, enabling just this > code, even if it does not crash, serves little purpose.

Thank you for explain me, I was a little confused in how stipples works.

> Your task is not to uncomment this handful of lines, but to establish<= br> > how best to express these X concepts in terms of primitives available = on
> MS Windows, and implement them in a manner appropriate for _Windows_,<= br> > without regard to the specifics of the X implementation.

Thanks, as far as i understood then should = not i touch or even edit those lines?
I was thinking= in define them (since them are only available in X) inside the same file, = similar in how pgtkterm.c or androidterm.c does, i think i should check aga= in `image_create_bitmap_from_data' and `prepare_face_for_display' d= efinitions.

> > Below this mail can you get the patch for test it
> > (Also i'm sorry if the patch is too long i accidentally
> > formatted it with clang-format)
>
> I suggest reverting the portions of the patch that are the work of
> clang-format, as we cannot accept such drastic whitespace changes, and=
> the substantive changes simply vanish in their midst.

Thank you= , i've reverted the changes done by clang-format, reviewing the test th= at i made i got notice it works a bit similar to `box' property and not= to a stipple, but anyways i'm sending it here if it can be useful.
=
> > Also can i ask what is the purpose of this line?
> > ```
> > # include "bitmaps/gray.xbm"
> > ```
>
> It includes the bitmap image, bitmap/gray.xbm, which is a C header
> defining an array and several parameters.=C2=A0 This is not relevant o= n
> Windows.

Thank = you for the help, I wasn't familiar with X.org stuffs (since I'm in= Windows and most of them are not available) and with C (specially in a big= project such as emacs).
But I have faith that I can= help in this.
--000000000000b3ba1d0617acc338-- --000000000000b3ba1e0617acc33a Content-Type: application/x-patch; name="0001-Test-stipples-in-W32.patch" Content-Disposition: attachment; filename="0001-Test-stipples-in-W32.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lvsxhi9m0 RnJvbSBjZTI5OTM3NmZjNTZjOTA4MDM5ZmRkYzQ0Y2RlNDJkMWUwNWY4OWM4IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiAiRWxpYXMgRy4gUGVyZXoiIDxlZzY0MjYxNkBnbWFpbC5jb20+ CkRhdGU6IFRodSwgMiBNYXkgMjAyNCAyMDozODo0OCAtMDYwMApTdWJqZWN0OiBbUEFUQ0hdIFRl c3Qgc3RpcHBsZXMgaW4gVzMyCgotLS0KIHNyYy93MzJ0ZXJtLmMgfCAxNiArKysrKysrKystLS0t LS0tCiAxIGZpbGUgY2hhbmdlZCwgOSBpbnNlcnRpb25zKCspLCA3IGRlbGV0aW9ucygtKQoKZGlm ZiAtLWdpdCBhL3NyYy93MzJ0ZXJtLmMgYi9zcmMvdzMydGVybS5jCmluZGV4IDdhZmQxMzAzYjRk Li42ZDczMzQ5YTE1YSAxMDA2NDQKLS0tIGEvc3JjL3czMnRlcm0uYworKysgYi9zcmMvdzMydGVy bS5jCkBAIC0xMjY0LDE2ICsxMjY0LDE4IEBA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