[webkit-dev] Transparency on GTK/DirectFB

Iulian iliescu.iulian at gmail.com
Mon Feb 23 03:07:30 PST 2009


I tried with background transparent to the body, but nothing changed.
I found out that the white background came from an image that i put into
page.
If i don't use any images i get a transparent background. But i soon as i
put an image (which alpha bleding) i got the white background.

I made some tests with two webkit versions:
r30726 and r38068 with the following page:

<html>
<head> 
<title> Empty page </title>
<body style="background-color: transparent">
<div style="position:absolute; top:300px;left:300px;width:600px;
height:200px; filter: alpha(opacity=50);
background-color:rgba(0, 255, 0, 0.5)" >
<!--
elipse.png 
-->
</div>
</body>
</html>

On both of them i got similar behaviours:

Without the image i got the transparent background that i want as follows:

r30726 clears the previous image that was on the screen and puts my new
image (the transparent one)
r38068 doesn't clear the previous image from the screen and just draw the
part of the page that isn't full transparent.

When i put the image all changes. With both versions i got a white
background (full opaque).
Image is a 200x100 png


Nicholas Beck wrote:
> 
> Hi Iulian,
> 
> Have you tried explicitly setting the background color to transparent in
> the HTML body?
> Regards,
> Nick
> 
> Iulian wrote:
>> Hi guys!
>>
>> I'm trying to do something similar.
>> I have webkit (r30726 - because of this -
>> https://bugs.webkit.org/show_bug.cgi?id=19941)
>> with GTK over DirectFB.
>>
>> I created the main page and browser page (as in GtkLauncher).
>> I successfully setted the ARGB color map for main window (made tests with
>> WebKit window too).
>> I called webkit_web_view_set_transparent() to set transparency to true.
>> I load a page with no background, just some divs on top of the page.
>>
>> The problem is that i always have the white background (no matter what
>> background color i set to the FrameView).
>>
>> If I create only the main window (without webkit) and i use expose-event
>> to
>> draw a transparent background it works fine, so transparency support has
>> no
>> problem.
>>
>> Please help me!
>> Someone explain me how drawing are done in webkit, so i can have a clue
>> where to dig.
>>
>> Iulian
>>
>>
>> Weber, Bernd wrote:
>>   
>>> Thanks Christian, great pointers!
>>>
>>> I got it working! Very cool!
>>>
>>> -Bernd
>>>
>>>
>>> For reference, here the changes I did in GtkLauncher:
>>>
>>> static void
>>> make_transparent(WebKitWebView* l_web_view)
>>> {
>>>     GValue val = {0,};
>>>     g_value_init (&val, G_TYPE_BOOLEAN);
>>>     g_value_set_boolean (&val, 1);
>>>     g_object_set_property (G_OBJECT (l_web_view), "transparent", &val);
>>> }
>>>
>>> static void
>>> make_transparent_cb (GtkWidget* widget, gpointer data)
>>> {
>>>     make_transparent (web_view);
>>> }
>>>
>>> static void
>>> set_colormap(GtkWidget* window)
>>> {
>>>     GdkScreen* screen = gtk_widget_get_screen (window);
>>>     GdkColormap* colormap = gdk_screen_get_rgba_colormap (screen);
>>>     if (!colormap) {
>>>     	g_warning ("No ARGB colormap available! Using RGB colormap!\n");
>>> 	colormap = gdk_screen_get_rgb_colormap (screen);
>>>     } else {
>>>     	g_print ("Using ARGB colormap now! :-)\n");
>>>     }
>>>     gtk_widget_set_colormap (window, colormap);
>>> }
>>>
>>> In main.c:
>>>  main_window = create_window ();
>>>  set_colormap(main_window);
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: webkit-dev-bounces at lists.webkit.org
>>> [mailto:webkit-dev-bounces at lists.webkit.org] On Behalf Of Christian
>>> Dywan
>>> Sent: Wednesday, September 24, 2008 3:48 PM
>>> To: webkit-dev at lists.webkit.org
>>> Subject: Re: [webkit-dev] Transparency on GTK/DirectFB
>>>
>>> Am Wed, 24 Sep 2008 15:16:24 -0700
>>> schrieb Darin Adler <darin at apple.com>:
>>>
>>>     
>>>> On Sep 24, 2008, at 3:10 PM, Weber, Bernd wrote:
>>>>
>>>>       
>>>>> The holy grail however would be to achieve transparency to the  
>>>>> underlying desktop, by defining "transparent" as the background
>>>>> color.
>>>>>         
>>>> WebKit definitely supports this. It's used this way in the Mac OS X  
>>>> Dashboard.
>>>>
>>>>       
>>>>> I'm not sure whether Webkit, especially with GTK/DirectFB,
>>>>> supports this right now.
>>>>>         
>>>> I don't know if the GTK/DirectFB port supports it. That's a question  
>>>> for someone else.
>>>>       
>>> Take a look at the headers. There's no other documentation at this
>>> point but it should be intuitive enough for most of what we have.
>>>
>>> webkit_web_view_set_transparent
>>>
>>> You will want that. And make sure you have an ARGB colour map on your
>>> window, ie. when you create your toplevel window.
>>>
>>> ciao,
>>>     Christian
>>> _______________________________________________
>>> webkit-dev mailing list
>>> webkit-dev at lists.webkit.org
>>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>>
>>> -----------------------------------------
>>> This message (including any attachments) may contain confidential
>>> information intended for a specific individual and purpose.  If you
>>> are not the intended recipient, delete this message.  If you are
>>> not the intended recipient, disclosing, copying, distributing, or
>>> taking any action based on this message is strictly prohibited.
>>> _______________________________________________
>>> webkit-dev mailing list
>>> webkit-dev at lists.webkit.org
>>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>>
>>>
>>>     
>>
>>   
> 
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
> 
> 

-- 
View this message in context: http://www.nabble.com/Transparency-on-GTK-DirectFB-tp19659125p22159458.html
Sent from the Webkit mailing list archive at Nabble.com.



More information about the webkit-dev mailing list