Browse Source

Set alpha on colored subpixels

I can't seem to find good info on what this should be.
master
Macoy Madson 9 months ago
parent
commit
ddc81263a1
  1. 14
      src/FreeType.cake

14
src/FreeType.cake

@ -404,12 +404,20 @@
(when pixel-set
(if (> num-components-per-freetype-pixel 1)
(scope
(var component-max-brightness (unsigned char) 0)
(each-in-range 3 component
(set (at component current-pixel-out) (at component current-pixel))))
(set (at component current-pixel-out) (at component current-pixel))
(when (> (at component current-pixel) component-max-brightness)
(set component-max-brightness (at component current-pixel))))
;; Set the alpha based on the brightest component, where components are likely max
;; brightness unless part of the color fringe for subpixel anti-aliasing. I'm not sure
;; what this value is actually supposed to be, partially because it depends on the
;; renderer's blending algorithm.
(set (at 3 current-pixel-out) component-max-brightness))
(scope
(each-in-range 3 component
(set (at component current-pixel-out) (deref current-pixel)))))
(set (at 3 current-pixel-out) 255))))
(set (at component current-pixel-out) (deref current-pixel)))
(set (at 3 current-pixel-out) 255))))))
;; Wrapping happens after we know what the next glyph's dimensions are
(set (path font > write-state . atlas-write-x) (+ (path font > write-state . atlas-write-x) num-columns))

Loading…
Cancel
Save