nanogui: XOR not working for strings in FLTK


Previous by date: 9 Feb 2011 21:08:02 -0000 Re: XOR not working for strings in FLTK, Martin Kajdas
Next by date: 9 Feb 2011 21:08:02 -0000 NXlib does not handle GR_UPDATE_ACTIVATE, Martin Kajdas
Previous in thread: 9 Feb 2011 21:08:02 -0000 Re: XOR not working for strings in FLTK, Martin Kajdas
Next in thread:

Subject: Re: [nanogui] XOR not working for strings in FLTK
From: "Greg Haerr" ####@####.####
Date: 9 Feb 2011 21:08:02 -0000
Message-Id: <120c01cbc89d$5c589140$0300a8c0@RDP>

> 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())

Yes, there is more work required in the lower level driver.

> 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'

I won't be including that patch in 0.92, but will add a fix to
the new architecture in the git repo.  The new architecture
uses a raster ops library that allows for any raster op to
be performed, without having a lot of duplicated code, and
runs at high speed.

Thanks for pointing this out, and I'm glad you were able
to get it working for your needs in 0.92!

Regards,

Greg





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: 9 Feb 2011 21:08:02 -0000 Re: XOR not working for strings in FLTK, Martin Kajdas
Next by date: 9 Feb 2011 21:08:02 -0000 NXlib does not handle GR_UPDATE_ACTIVATE, Martin Kajdas
Previous in thread: 9 Feb 2011 21:08:02 -0000 Re: XOR not working for strings in FLTK, Martin Kajdas
Next in thread:


Powered by ezmlm-browse 0.20.