I have implemented a simpler version of the alpha drawing code from
SinkWorld into an experimental version of Scintilla. Unlike the
SinkWorld code that could draw translucent polygons, this code can
only draw translucent rectangles (but they can have their corners cut
off). This removed  the drawing on the server and then copying back to
the client and several messy and potentially wrong calls. Instead all
the drawing into the pixbuf is done by hand.

   There are two Scintilla features implemented with alpha. The caret
line can be given an optional alpha value as well as a colour. A new
RoundedBox indicator draws slightly rounded off boxes with a
translucent fill and more opaque border. Picture with both here:

http://scintilla.sourceforge.net/AlphaMarks.png

   The SciTE caret.line.back can now have either 6 or 8 digits with
the first two digits of an 8 digit number setting the alpha (01 is
almost transparent, FF is opaque) so the picture uses
caret.line.back=#20AFFF00. Best merging occurs with strong colours and
low alphas. A new (Windows only) SciTE property, find.mark, turns on
and sets the colour of boxes used to show each match when the Mark All
command is used from the Find dialog. The boxes disappear when the
text is edited or Clear All Bookmarks performed.

   My main problem with this code is how to integrate alpha into the
system. Should every colour variable contain an alpha component that
may be ignored in many situations? The current code uses explicit
alpha for the caret line and hard coded alphas for the boxes. I'm
worried that platform layers will require significant work to ignore
alphas if ColourDesired and ColourAllocated include alpha. Some
platforms may not be able to easily support alpha drawing: the
AlphaRectangle code just draws an outline on GTK+ 1.x.

   The code can be downloaded from
http://scintilla.sourceforge.net/xluce.zip  Source
http://scintilla.sourceforge.net/xscite.zip  Windows executable

   Neil

_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to