[haiku-development] Re: Disable BView antialiasing

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 22 Sep 2009 12:34:18 +0200

On 2009-09-22 at 10:33:34 [+0200], Caitlin Shaw <rogueeve@xxxxxxxxxxxxx> 
wrote:
> I am porting an old app over from Windows, and during one part it is 
> supposed to draw a line and then erase it by drawing over it in the 
> background color. This doesn't work under Haiku because non-straight 
> calls to StrokeLine are antialiased, so the line is not completely 
> erased. There is really no other good way to handle this, so I need to 
> disable the antialiasing feature of StrokeLine. I can do it by using my 
> own line drawing routine and pushing pixels manually, but that is 
> horribly slow. I know how to disable _font_ antialiasing, but how to 
> disable it for other sorts of drawing?

Uh, I am afraid that's not currently possible. The code in 
src/servers/app/drawing/Painter/Painter.cpp would need to be adopted to 
support non-anti-aliased drawing. Messing with the "rasterizer gamma" would 
be the quickest solution. It is possible to define a gamma curve with a 
cut-off in the middle, effectively disabling anti-aliasing, but without any 
speed improvement. It would still use the same line rendering algorithm, 
which is not Bresenham-based and therefor not perfect for aliased lines. To 
integrate this, one would have to introduce another BView flag, and set the 
rasterizer gamma in the Painter class according to this flag (but only when 
it changes).

What software are you currently porting? :-)

Best regards,
-Stephan

Other related posts: