Menu

#1521 [Patch] SurfaceGDI::DrawRGBAImage round instead of truncate

Won't_Implement
closed
nobody
5
2024-08-21
2024-06-19
No

Here's patch which changes SurfaceGDI::DrawRGBAImage to round the rectangle corners instead of truncating them to improve alignment. Does not apply to SurfaceD2D::DrawRGBAImage because it doesn't truncate.

https://patch-diff.githubusercontent.com/raw/jrsoftware/scintilla/pull/4.diff
https://patch-diff.githubusercontent.com/raw/jrsoftware/scintilla/pull/4.patch
https://github.com/jrsoftware/scintilla/pull/4/files

Discussion

  • Neil Hodgson

    Neil Hodgson - 2024-06-22

    An image of before and after could help motivate this change.

    It may be better to change alignment in the caller where there is more context. Calling round on the width and height should have no impact and these expressions could be replaced with width and height so it's just the top-left point that may be aligned.

    Its likely the only caller of interest is LineMarker::Draw as other calls use bitmaps that should already match their destinations. Has a bitmap scale been set with SCI_RGBAIMAGESETSCALE?

     
    • Martijn Laan

      Martijn Laan - 2024-06-22

      Thanks for looking into it.

      Attached is a before (top) and after (bottom) image.

      The caller is LineMarker::Draw indeed. There's no SCI_RGBAIMAGESETSCALE call.

      The bitmap sizes are 12x12. In LineMarker::Draw the height of rcWhole is 17 (using Consolas 10pt). This gives top and bottom values in SurfaceGDI::DrawRGBAImage of "half-integer" values like 0.5, 1.5, etc.

       

      Last edit: Martijn Laan 2024-06-22
  • Neil Hodgson

    Neil Hodgson - 2024-06-24
    • labels: scintilla --> scintilla, marker
    • Group: Initial --> Won't_Implement
     
  • Neil Hodgson

    Neil Hodgson - 2024-06-24

    While the changed position suits your design, I do not think that it will be better with all font and image choices. Perhaps not even a majority. This may worsen the appearance of other applications which may have tweaked their images to work well.

    It is possible to achieve your preferred outcome with the current implementation, possibly by editing the images, but definitely in code. For example, a transparent line of pixels could be added at the top of each image for odd line heights. The image format is very simple and can be manipulated easily.

    With the possibility of worsening the appearance of applications, this change shouldn't be committed.

     
    • Martijn Laan

      Martijn Laan - 2024-06-24

      Ok, I understand and should have thought of backward compatibility myself, sorry.

       
  • Neil Hodgson

    Neil Hodgson - 2024-08-21
    • status: open --> closed
     

Log in to post a comment.