Re: drop shadow



Am 26.07.2008 09:37, Lars Clausen schrieb:

On Jul 26, 2008, at 1:27 AM, Abhijit Menon-Sen wrote:
[...]
I need drop shadows too, and although I'm not really familiar with Dia
or GTK, I would like to at least try to implement them, if anyone has
advice about how best to proceed.

Take a look at how highlighting is done, you may be able to adapt the method to drop shadows, i.e. have a round of drawing drop shadows for those objects that have them before the round of drawing the objects themselves.
I have added something conceptionally similiar to dia-renderer.dia. But IMO future enhancements in this direction should be encapsualted in dedicated renderers. One could think of a renderer chain of resposibilities [1] where the DropShadowRenderer modifies the calls from normal rendering to add the shadow and translates/modifies them to what the contained 'standard' renderer understand.

There is no code allowing this yet.

However, some exporters may have a different idea of how drop shadows are best represented. Since highlighting isn't exported, the highlight algorithm doesn't have that problem.

I think the that most of the highlightning could have been implemted by simple delegation, but for the special text editing highlighting it wouldn't have worked with existing interfaces.


Could it be done with a Python plugin, perhaps?

I'll leave that for Hans to answer.

It is possible to implement complete renderers in Python, see diasvg.py [3] for a complex example. It should be possible to implment a complete cairo renderer including drop shadow with pydia and pycairo [4]. First step would be to 'translate' the existing cairo renderer [5] to Python (basically just diacairo-renderer.c)

It is not yet possible to reuse existing DiaRenderers from pydia, but the above mentioned renderer chain is not implemented in C either.

        Hans

[1] http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern
[2] http://en.wikipedia.org/wiki/Decorator_pattern
[3] http://svn.gnome.org/viewvc/dia/trunk/plug-ins/python/diasvg.py?view=markup
[4] http://www.cairographics.org/pycairo/
[5] http://svn.gnome.org/viewvc/dia/trunk/plug-ins/cairo/

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]