PaintLab / PixelFarm

From Vectors to (sub) Pixels, C# 2D Rendering Library
Other
156 stars 21 forks source link

About subpixel rendering #36

Closed Happypig375 closed 6 years ago

Happypig375 commented 6 years ago

Do I need to use the agg-sharp backend for subpixel rendering? Is any other backend unable to do this? Is the agg-sharp backend inside the Backend.Paintfx project?

prepare commented 6 years ago

Subpixel rendering may be implemented by various techniques.

This feature is not found in original agg-sharp. so I implement this with the Maxim's agg technique (https://github.com/PaintLab/PixelFarm/issues/3#issuecomment-287991561).

so my technique is based on Maxim's agg technique

Do I need to use the agg-sharp backend for subpixel rendering?

Yes,

Is any other backend unable to do this?

Is the agg-sharp backend inside the Backend.Paintfx project?

I provide 2 examples

1) Pure software subpixel rendering
(I call it SubPixelLcdEffect , follow the detail here => https://github.com/PaintLab/PixelFarm/blob/dev/src/PixelFarm/PixelFarm.Drawing/7_CpuBlitPainter/RenderSurface/AggRenderSurface.cs#L281)

2) Texture-based hardware-accelerated GLES (see https://github.com/PaintLab/PixelFarm/issues/3) (by create 'inverted RGBA' subpixel-rendering glyph texture, and rendering 3 times in different color channels, follow the detail here => https://github.com/PaintLab/PixelFarm/blob/dev/src/PixelFarm/PixelFarm.DrawingGL/DrawingGL/RenderSuface/GLRenderSurface.cs#L507 )

prepare commented 6 years ago

How to draw a 'crisp' glyph is not depend on 'subpixel Lcd-Effect' only.

It is also depend on the 'pixel-position' of a glyph too. => this is important.

please see https://github.com/PaintLab/PixelFarm/issues/16#issue-284363097 and follow the detail. ( you can see that pic 1, is not rendered with subpixel rendering tech, it is rendered with blue color fill over grey-scale stencil glyph, but in minor different position (x,y) )

prepare commented 6 years ago

What is Backend.Paintfx project ?

It is a (copy of) core of an old open source version of Paint.NET (Pdn) project. I try to integrate its features to the agg canvas surface

No subpixel rendering here.