GNOME Bugzilla – Bug 591525
Transparent objects by adding alpha to Color structure.
Last modified: 2011-04-03 16:54:19 UTC
Dia should allow for cairo transparency to be used by objects and also save in the native file format. Any import/export/renderer's that don't support transparency should use an alpha of 1.0 to default to normal behavior. Other information: Patch will be attached to this bug!
Created attachment 140517 [details] [review] Adds transparency to objects This closes out bug #402113... Cleanup patch to remove a couple printf's to follow...
Created attachment 140518 [details] [review] Cleans up some unnecessary printf's from the first patch
These changes can also be pulled from github : http://github.com/oblivian/dia/
Created attachment 140522 [details] Example dia file with new Color objects with alpha transparency!!!
Created attachment 140523 [details] Example cairo pdf export file with new Color objects with alpha transparency!!!
Created attachment 140524 [details] Example png file with new Color objects with alpha transparency!!!
Created attachment 140525 [details] Example svg file with new Color objects with alpha transparency!!!
Comment on attachment 140517 [details] [review] Adds transparency to objects the patch contains an unbearable amount of pure whitespace changes (I'd estimate about 80%).
Sorry about that Hans, I had eclipse on auto whitespace fix for another project and didn't turn it off. I'll fix it up and resubmit.
Created attachment 141203 [details] [review] Cleaned patch with no whitespace changes
Thanks for the patch an the cleanup. I now have a local branch testing it, with also some follow-up modification, e.g. regarding bug #591911 and (stroke|fill)-opacity. There are some more things I want to tackle, but the main reason I hesitate to push it to master is the lack of alpha support for the main display renderer: DiaGdkRenderer. With bug #568168 there is the idea of DiaRenderer::is_capable_to(RENDER_ALPHA) but I can't come up with a good fallback behaviour for alpha not being supported. Here are my notes of other things to check: bindings/dia-properties.cpp allow to set rgb(a?)? lib/dia_svg.c missing handling for opacity (roundtrip check!) also check shape-export with alpha and use of shapes with alpha lib/diasvgrenderer.c fill-opacity: %f; stroke-width: %s", colour->alpha use g_ascii_formatd and stroke-opacity => DONE lib/widgets.c(dia_color_selector_create_string_item) do we really want the alpha part in the string? gtk_color_selection_get_current_color superfluous printf() => REMOVED plug-ins/cairo/diacairo-renderer.c there was an if differening in alpha 0:1, now both get renderer->dia->bg_color.alpha plug-ins/python/pydia-property.c it should be possible to set from tuple of 3 or 4, currently no alpha possible to set? plug-ins/svg/svg-import.c should turn (stroke|fill)-opacity into alpha
Created attachment 141391 [details] [review] Opacity support for SVG import and custom shapes
Created attachment 141420 [details] [review] Emulate color.alpha with gdk_gc_set_stipple() Of course the emulation is far from perfect, but maybe it is good enough to dispel concerns ;)
Created attachment 141421 [details] DiaGdkRenderer on render-test-alpha.dia The emulation of two overlapping transparent objects is especially weak.
Created attachment 141434 [details] [review] PyDia_set_Color() allow 3 or 4 tuple to set color.alpha
I still hesitate to merge the 'alpha' stuff to master, but the recently rebased branch is now available at http://git.gnome.org/cgit/dia/log/?h=alpha Things stopping me to merge: - the selection of the diagram background color must not include transparency (see my comment in bug #402113 and http://bugzilla-attachments.gnome.org/attachment.cgi?id=141350 ) - there should be a way to tweak the opacity independent of the color and the recent color menu should not include the alpha part. This would allow to change the transparency of multiple different colored objects without destroying the color value. At least my playing with the opacity of the objects involved quite some changes to get the desired effect. Doing so did "pollute" the recent color menu
I've implmented the missing piece today and merged the resilt back to master branch. Thanks for the patches. http://git.gnome.org./browse/dia/commit/?id=782c60e0767203ac7ee502fec3a1dca29fdd8129