From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Stipples support in MS-Windows port Date: Fri, 03 May 2024 15:30:56 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1433"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Elijah G Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 03 09:31:56 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 1s2nOd-0000DC-5T for ged-emacs-devel@m.gmane-mx.org; Fri, 03 May 2024 09:31:55 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2nNz-0003uy-98; Fri, 03 May 2024 03:31:15 -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 1s2nNi-0003jp-MD for emacs-devel@gnu.org; Fri, 03 May 2024 03:31:08 -0400 Original-Received: from sonic313-9.consmr.mail.ne1.yahoo.com ([66.163.185.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2nNg-0002xn-Ou for emacs-devel@gnu.org; Fri, 03 May 2024 03:30:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1714721452; bh=GHtAl0JnxtlDBgpIGVyGTPJpB26D50QTH6ztj7N7kWo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=HlfrKi3IMWODfnRxwCboLnHIXq6XozoXaZboBZ5WdEMWMsU1S38Wt75NP5hReev6p+nlfVq+Dg2aVd3J2sf8kQwtvTQSDHRUaJ93M4ooyK8nFnNt0Czr5bgFNj2b+bkXqhlv2Y4cWZ6QfdIWQppW//e1Oi8+z7JPTGa2dYMlFgQxpgdw4QvdB0UpXtV0dP2fn/wwAwFXMjBrmKGimnLuswdcuqctMJP9hwslMAL3SFwIQdoTZM9Ree6G1HZJXXawxUQTi9q0R7zo0vEoBRYxJF1SJb82oScS76lVbPINNgeMQLozfFoWKHhUgejP5Og9SFkoYDox4Sj1ghykajijdQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1714721452; bh=l7Ejj613cKf9jYLojD3w9AXyfgr55t0XHj5m9VvFF7d=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=bdDwsdluIvnCzVPoGKywvWUUksTh6MJU4j0cwVs3bNb3mLQQfZJq3eRucaN3xm/U1/uFHEMwzcluhuhFjLS4l9arST1lJ608/HhUHdKdhAftnkVxSVMAQtMNUAHvMBruiytvwsHIgqlN1G7e22ei5YHtBy5qjzZ92J9mu3NaYoQHYvo/9KR0ICOUVrRRxqmq4D7c0yEBdif1Wg1yEx9tr7iGfAQ1gdsyRLyARLW3CcFA65YwlZBHSNRSiLl4wXFm6jHa+G5rxw93xCCN8QvYnvKyQKgazSnMVV8+wdsbKCi/UzIKuSXtYp5dMHIFJ2x3Yykd17KyXZc4g7D3dXxRfQ== X-YMail-OSG: OUP.wrsVM1kXI5VR0k0FalSBFrEKH8eRk_Gub7xGFoY_4DRMJd.eCSxdWsmkUJ0 JxciUw2uhKozBGo._ELK50J26vR8VHFZPf8gqrdaA4JMr6BA_Y2PTxu7niw2HaE6rTZp_aa0mso. vtYybmgynhsm670bNMX_shUogz8qZwlKZya4cRJu8GHLolZIjS.tNp5heiPCJ66S1vpQ2J2VIDil txXTBTQv5X8LhI_Cv2pE6UzVrGHhNNrhFNVRh5YlSmjjkGWY7jxwnPTfgKYNk3Tic9B9cJJezekX 5Q5HGf0_vpsfRXsEXrewUe.58Rxf01STrcFIl2VH_EL4G5I9DKXgenQU2E736QUNqTAkq4clfwdt emx_XAfvrjt8ZrK9MWpFUizFkuxHDxOXHgMcaCQo710kqunu88yw3Ludn1ewhqMmFjVDumnEQxRa Bp1ULPpMhtSjbEujFm3sDDxUe0weBW96UzIhgh3Mr3AqLPzihhd2oPQMHWysPxpId48.xo0usndP 4aKxKvo9e4aKe0XuCJW8V3DFDaydfmZkzf.k_fZTPWM2yhfYF7Pj3CFESjNITxAb0AQh2yeCY.g1 cJ1qN1j_iXwKyQoNPhUdtNfUfrIZ2sefUAgKzjWIWwnmEhjbhuhQLdFaKvbTOCWVZ4xg7msf6ab2 j7tfKSwm3dykk36jeHjZGPcbDK0QVG9H1XAoVM.8ArXo0qEPDV67HVkdgquMqbRvWSzfQEGqGAHn SE2KhX_b1gslZZtc11VMKz.2VOmoWftC.i1b3it5EDOn.UCQzLTjjGjEMkkXXiF.HjwnBIf3SLkR IHhxK90gX7Ljr0Vp8kCETarsvI1rotWI5nrbQDQkKV X-Sonic-MF: X-Sonic-ID: 839a757a-417e-4c90-94bf-ec58ba0a6f7d Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ne1.yahoo.com with HTTP; Fri, 3 May 2024 07:30:52 +0000 Original-Received: by hermes--production-gq1-59c575df44-n6ttj (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID df0c424af818d542ca573a8af2a9d401; Fri, 03 May 2024 07:30:49 +0000 (UTC) In-Reply-To: (Elijah G.'s message of "Thu, 2 May 2024 20:53:17 -0600") X-Mailer: WebService/1.1.22256 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.185.32; envelope-from=luangruo@yahoo.com; helo=sonic313-9.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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:318648 Archived-At: [Resending as the first copy wasn't addressed to the list.] Elijah G writes: > Hi, i'm starting this thread to discuss the > support for stipples in windows port. > My ideas in how this can be done is using > the w32term.c functions for drawing rects, > i tested using w32_fill_rect but it doesn't > work, i don't know how it works. > > The elisp snippet that i'm using for test this is this: > > ``` > (let* ((w (window-font-width)) > (stipple `(,w 1 ,(apply #'unibyte-string > (append (make-list (1- (/ (+ w 7) 8)) ?\0) > '(1)))))) > (insert "\n" (propertize " " 'face `(:background "red" > :foreground "blue" :stipple ,stipple)))) > ``` > > 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. 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. > 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. > 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. HTH.