I hope that someone out there knows alot more about graphics than i
do.
Im currently trying to "hit highlight" a document, given the image and
a set of coordinates of the rectangles to draw (the "hits"). Sounds
easy right?
My problem is this: on black and white images, it works well by using
the setXORmode() to only draw the highlights graphics onto the white
background - in this way it doesnt obscuse the black text (ie, the
color is only overlayed onto the white, not onto the black).
On greyscale images however, i can't figure out how to set a "range"
of color for "white" and a range of color for "black". Meaning i can
only draw translucent rectangles over the graphics object - partially
obscuring the black lettering and making "highlighted" words harder to
see.
Now im fine with having this very slight worry going on - just
changing the color makes things clearer but my boss isnt. after hours
of google searching and reading the API's i thought i would risk
asking you bunch of pro's.
Does anyone know a way i can accomplish this - even a clue as to where
to look would be really really greatly appreciated!
Graeme
Jeff Higgins - 11 Mar 2008 13:37 GMT
>I hope that someone out there knows alot more about graphics than i
> do.
[quoted text clipped - 21 lines]
> Does anyone know a way i can accomplish this - even a clue as to where
> to look would be really really greatly appreciated!
I have absolutely no idea, but a quick web search
produces these two, maybe they'll help. Good luck.
<http://www.webbasedprogramming.com/Tricks-of-the-Java-Programming-Gurus/ch12.htm>
<http://www.seismo.unr.edu/ftp/pub/ichinose/JavaWorm/ImageMap.java>
gwoodhouse@gmail.com - 11 Mar 2008 14:55 GMT
Hi Jeff,
Thanks for the reply - Went through those links and they only contain
information ove already got :( Although they did give me a curiousity
into Image Filtering - perhaps something along this avenue might help
me - although it seems i would have to do some pretty intensive image
proccessing to get the results i wanted.
Still up for more responses if anyone else has any similar experience!
The more help the better! :)
Thanks again!
Graeme
Jeff Higgins - 11 Mar 2008 16:52 GMT
gwoodhouse wrote:
> Hi Jeff,
>
[quoted text clipped - 5 lines]
>
> Still up for more responses if anyone else has any similar experience!
> The more help the better! :)
Maybe some idea of what your 'document' and 'image' are would help to
raise more replys. Is your 'image document' an image in the sense of
a java.awt.Image, or some type of text document, or an 'image' of a
text document, or .. Are you using somejavax.swing.Component to display
your image?
Knute Johnson - 11 Mar 2008 17:44 GMT
> I hope that someone out there knows alot more about graphics than i
> do.
[quoted text clipped - 23 lines]
>
> Graeme
XOR it with a bit mask. I used AFAFAF for something the other day but
you can play with that to make it work better for your particular image.

Signature
Knute Johnson
email s/nospam/linux/
------->>>>>>http://www.NewsDem
Mark Thornton - 11 Mar 2008 18:13 GMT
> I hope that someone out there knows alot more about graphics than i
> do.
[quoted text clipped - 23 lines]
>
> Graeme
My preference is to produce the effect of using a highlighter pen on a
paper document. This involves alpha compositing the highlight area on
top of the regular document. Pick a suitable highlight colour, and try
different transparency. XOR was a computationally cheap trick, but the
visual result was never ideal (except perhaps on two level monotone
displays where it was the best you could do). You should also consider
giving the user a selection of the usual iridescent highlight colours.
Mark Thornton
Michael Jung - 11 Mar 2008 19:13 GMT
> Im currently trying to "hit highlight" a document, given the image and
> a set of coordinates of the rectangles to draw (the "hits"). Sounds
> easy right?
[...]
> On greyscale images however, i can't figure out how to set a "range"
> of color for "white" and a range of color for "black". Meaning i can
> only draw translucent rectangles over the graphics object - partially
> obscuring the black lettering and making "highlighted" words harder to
> see.
Let "a" be the greyscale value in the range [0,1]. You can then set
the new pixel value b=a*a, making it darker, or b=(1-a)(1-a), making
it lighter. There are other transformations mapping [0,1] to [0,1]
(you could even do b=1-a, somewhat akin to XOR.) You may also prefer
to only highlight on the boundary.
Michael