Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pixelated drawing mode #99

Closed
expenses opened this issue Apr 13, 2020 · 2 comments
Closed

Pixelated drawing mode #99

expenses opened this issue Apr 13, 2020 · 2 comments

Comments

@expenses
Copy link

This is somewhat related to #17, but not entirely. Basically, what I want is a way to render and cache text in a pixelated fashion for pixel art games. The main difference between this and the normal drawing mode is that instead of using a range of alpha values, you round the value to either 0 or 255..

An API for this would involve creating a Mode enum:

pub enum Mode {
    Normal,
    Pixelated { upscale: f32 }
}

that goes inside Section and VariedSection. When it comes to cache the glyphs for this sections, you divide the font size by the upscale value, and round the alpha coverage values. The when rendering, you upscale the font again.

I'm interesting in adding this feature myself, but I'm not entirely sure where to put the caching and rendering code.

@alexheretic
Copy link
Owner

I would implement this in the fragment shader. You have an 8-bit coverage alpha there, it can be rounded without any modification to glyph-brush.

@expenses
Copy link
Author

@alexheretic .... Oh yeah.. :P Closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants