Skip to main content

LcdDistributionLut

Struct LcdDistributionLut 

Source
pub struct LcdDistributionLut { /* private fields */ }
Expand description

Lookup table for LCD subpixel coverage distribution.

Distributes each coverage value across primary (center), secondary (adjacent), and tertiary (2-away) positions. This implements the energy distribution described in Steve Gibson’s subpixel rendering guide.

Port of C++ lcd_distribution_lut from agg_pixfmt_rgb24_lcd.h.

Implementations§

Source§

impl LcdDistributionLut

Source

pub fn new(prim: f64, second: f64, tert: f64) -> Self

Create a new LCD distribution lookup table.

§Arguments
  • prim — Weight for the primary (center) subpixel
  • second — Weight for the secondary (adjacent) subpixels
  • tert — Weight for the tertiary (2-away) subpixels

Weights are normalized so that prim + 2*second + 2*tert = 1.0.

Source

pub fn primary(&self, v: u8) -> u8

Get the primary (center) distribution for a coverage value.

Source

pub fn secondary(&self, v: u8) -> u8

Get the secondary (adjacent) distribution for a coverage value.

Source

pub fn tertiary(&self, v: u8) -> u8

Get the tertiary (2-away) distribution for a coverage value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.