nanogui: XOR not working for strings in FLTK


Previous by date: 8 Feb 2011 22:02:34 -0000 Re: How to draw a rounded rectangle using nano-X API?, Greg Haerr
Next by date: 8 Feb 2011 22:02:34 -0000 Re: XOR not working for strings in FLTK, Greg Haerr
Previous in thread: 8 Feb 2011 22:02:34 -0000 Re: XOR not working for strings in FLTK, Greg Haerr
Next in thread: 8 Feb 2011 22:02:34 -0000 Re: XOR not working for strings in FLTK, Greg Haerr

Subject: RE: [nanogui] XOR not working for strings in FLTK
From: "Martin Kajdas" ####@####.####
Date: 8 Feb 2011 22:02:34 -0000
Message-Id: <22F1610BD82AD74D9C745FA543161959DC7C94@mkmail.MKPROD.COM>

I followed the code and hacked it to make it work.

The change "parms.op = MWROP_COPY" to "parms.op = gr_mode;" in
font_freetype2.c
will not work because it gets overwritten/ignored in devblit.c (in
GdConversionBlit())

So I modified the linear16_drawarea_bitmap_bytes_msb_first() in
fblin16.c.
I added 'else if (gr_mode == MWROP_XOR)' to the main 'if' 
and copied code from 'else' but changed all '= fg' to '^= fg'

This one change fixed my problem.
I am not sure if this is a 'correct' way to implement it and I leave
that up to you to decide.
Similar changes should also be considered in other functions.
Thanks,
Martin


-----Original Message-----
From: Greg Haerr ####@####.#### 
Sent: Monday, February 07, 2011 7:41 PM
To: Martin Kajdas
Cc: ####@####.####
Subject: Re: [nanogui] XOR not working for strings in FLTK

Martin - 

In looking at this, there's a couple things that might have to 
change.  The initial specification for the blit output is in 
engine/font_freetype2.c::freetype2_drawtext().  There,
the blit rop is set in the parms structure as either
MWROP_BLENDFGBG for antialiased text, or 
MWROP_COPY for bitmapped text.

You will need to make sure that you've specified non-antialiased
text, as otherwise the SRCOVER (BLENDFGBG) compositing
operation will be performed.  

I will have to check the 0.92 code, but the new codebase
will end up calling GdConversionBlit which will call
engine/devblit.c::GdFindConvBlit() which will use the driver
entry point psd->BlitCopyMaskMonoByteMSB (this will
end up in linear16_drawarea in 0.92).

The  BlitCopyMaskMonoByteMSB blitter is in 
engine/convblit_mask.c::CONVBLIT_COPY_MASK_MONO()
which doesn't handle anything other than MWROP_COPY.  This will have
to case on rop != MWROP_SRCOPY and handle
the APPLYOP macro to as it is handled in
engine/convblit_frameb.c::frameblit_blit().
Kinda complicated.

I think you will have to change the parms.op = MWROP_COPY
to something like "parms.op = gr_mode;" in font_freetype2.c. This will
use the current raster ops mode when it finally gets to the
blitter.

It might be best to move to the repository code, as there
are many improvements, and the drawarea entry point in 
0.92 doesn't handle XOR either.  The new code
looks tricky using #defines and static  inline functions
for speed, but ultimately the code will be borrowed
where it's already implemented in convblit_frameb.c
and put into convblit_mask.c.

Hope this makes sense, let me know if you need more help.
I may be able to find some more time towards the end of this 
week to add this all in for you, as it looks like specialized 
font draw code isn't currently handling raster ops like the
general blit code.

Regards,

Greg

Previous by date: 8 Feb 2011 22:02:34 -0000 Re: How to draw a rounded rectangle using nano-X API?, Greg Haerr
Next by date: 8 Feb 2011 22:02:34 -0000 Re: XOR not working for strings in FLTK, Greg Haerr
Previous in thread: 8 Feb 2011 22:02:34 -0000 Re: XOR not working for strings in FLTK, Greg Haerr
Next in thread: 8 Feb 2011 22:02:34 -0000 Re: XOR not working for strings in FLTK, Greg Haerr


Powered by ezmlm-browse 0.20.