Commit bf9d145f authored by Cyril Deguet's avatar Cyril Deguet

* at last, transpareny WORKS !!!!!

parent c708c8fe
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_api.cpp: Various gtk2-specific functions * gtk2_api.cpp: Various gtk2-specific functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_api.cpp,v 1.8 2003/04/15 20:54:58 karibu Exp $ * $Id: gtk2_api.cpp,v 1.9 2003/04/16 14:38:04 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -67,7 +67,7 @@ void OSAPI_PostMessage( Window *win, unsigned int message, unsigned int param1, ...@@ -67,7 +67,7 @@ void OSAPI_PostMessage( Window *win, unsigned int message, unsigned int param1,
if( message == VLC_HIDE ) if( message == VLC_HIDE )
{ {
fprintf( stderr, "======= message %i\n", message ); fprintf( stderr, "======= message %i %x\n", message, event );
} }
gdk_event_put( (GdkEvent *)event ); gdk_event_put( (GdkEvent *)event );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_bitmap.cpp: GTK2 implementation of the Bitmap class * gtk2_bitmap.cpp: GTK2 implementation of the Bitmap class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_bitmap.cpp,v 1.10 2003/04/15 22:16:05 asmax Exp $ * $Id: gtk2_bitmap.cpp,v 1.11 2003/04/16 14:38:04 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -111,7 +111,7 @@ GTK2Bitmap::GTK2Bitmap( intf_thread_t *p_intf, string FileName, int AColor ) ...@@ -111,7 +111,7 @@ GTK2Bitmap::GTK2Bitmap( intf_thread_t *p_intf, string FileName, int AColor )
} }
Bmp = gdk_pixbuf_add_alpha( Bmp, TRUE, AColor & 0xff, (AColor>>8) & 0xff, Bmp = gdk_pixbuf_add_alpha( Bmp, TRUE, AColor & 0xff, (AColor>>8) & 0xff,
AColor>>16 ); (AColor>>16) & 0xff );
Width = gdk_pixbuf_get_width( Bmp ); Width = gdk_pixbuf_get_width( Bmp );
Height = gdk_pixbuf_get_height( Bmp ); Height = gdk_pixbuf_get_height( Bmp );
} }
...@@ -161,10 +161,10 @@ void GTK2Bitmap::DrawBitmap( int x, int y, int w, int h, int xRef, int yRef, ...@@ -161,10 +161,10 @@ void GTK2Bitmap::DrawBitmap( int x, int y, int w, int h, int xRef, int yRef,
Graphics *dest ) Graphics *dest )
{ {
GdkDrawable *destImg = ( (GTK2Graphics *)dest )->GetImage(); GdkDrawable *destImg = ( (GTK2Graphics *)dest )->GetImage();
// GdkGC *destGC = ( (GTK2Graphics *)dest )->GetGC(); GdkGC *destGC = ( (GTK2Graphics *)dest )->GetGC();
gdk_pixbuf_render_to_drawable_alpha( Bmp, destImg, x, y, xRef, yRef, gdk_pixbuf_render_to_drawable( Bmp, destImg, destGC, x, y, xRef, yRef,
w, h, GDK_PIXBUF_ALPHA_BILEVEL, 128, GDK_RGB_DITHER_NORMAL, 0, 0); w, h, GDK_RGB_DITHER_NORMAL, 0, 0);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool GTK2Bitmap::Hit( int x, int y) bool GTK2Bitmap::Hit( int x, int y)
...@@ -172,6 +172,7 @@ bool GTK2Bitmap::Hit( int x, int y) ...@@ -172,6 +172,7 @@ bool GTK2Bitmap::Hit( int x, int y)
if( x < 0 || x >= Width || y < 0 || y >= Height ) if( x < 0 || x >= Width || y < 0 || y >= Height )
return false; return false;
/* FIXME */
guchar *pixels; guchar *pixels;
int rowstride, offset; int rowstride, offset;
gboolean has_alpha; gboolean has_alpha;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_graphics.cpp: GTK2 implementation of the Graphics and Region classes * gtk2_graphics.cpp: GTK2 implementation of the Graphics and Region classes
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_graphics.cpp,v 1.7 2003/04/15 01:19:11 ipkiss Exp $ * $Id: gtk2_graphics.cpp,v 1.8 2003/04/16 14:38:04 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -67,6 +67,9 @@ GTK2Graphics::GTK2Graphics( int w, int h, Window *from ) : Graphics( w, h ) ...@@ -67,6 +67,9 @@ GTK2Graphics::GTK2Graphics( int w, int h, Window *from ) : Graphics( w, h )
gdk_drawable_set_colormap( Image, gdk_colormap_get_system() ); gdk_drawable_set_colormap( Image, gdk_colormap_get_system() );
Gc = gdk_gc_new( Image ); Gc = gdk_gc_new( Image );
} }
// Set the background color to black
gdk_draw_rectangle( Image, Gc, TRUE, 0, 0, w, h );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
GTK2Graphics::~GTK2Graphics() GTK2Graphics::~GTK2Graphics()
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_theme.cpp: GTK2 implementation of the Theme class * gtk2_theme.cpp: GTK2 implementation of the Theme class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_theme.cpp,v 1.12 2003/04/15 20:33:58 karibu Exp $ * $Id: gtk2_theme.cpp,v 1.13 2003/04/16 14:38:04 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -260,6 +260,8 @@ void GTK2Theme::AddWindow( string name, int x, int y, bool visible, ...@@ -260,6 +260,8 @@ void GTK2Theme::AddWindow( string name, int x, int y, bool visible,
return; return;
} }
GdkColor black = {0, 0, 0, 0};
gdk_window_show( gwnd ); gdk_window_show( gwnd );
WindowList.push_back( (Window *)new OSWindow( p_intf, gwnd, x, y, visible, WindowList.push_back( (Window *)new OSWindow( p_intf, gwnd, x, y, visible,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_window.cpp: GTK2 implementation of the Window class * gtk2_window.cpp: GTK2 implementation of the Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_window.cpp,v 1.15 2003/04/15 20:33:58 karibu Exp $ * $Id: gtk2_window.cpp,v 1.16 2003/04/16 14:38:04 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -263,9 +263,36 @@ void GTK2Window::RefreshFromImage( int x, int y, int w, int h ) ...@@ -263,9 +263,36 @@ void GTK2Window::RefreshFromImage( int x, int y, int w, int h )
ReleaseDC( hWnd, DC ); ReleaseDC( hWnd, DC );
*/ */
GdkDrawable *drawable = (( GTK2Graphics* )Image )->GetImage();
GdkImage *image = gdk_drawable_get_image( drawable, 0, 0, Width, Height );
gdk_draw_drawable( gWnd, gc, (( GTK2Graphics* )Image )->GetImage(), gdk_draw_drawable( gWnd, gc, drawable, x, y, x, y, w, h );
x, y, x, y, w, h );
// Mask for transparency
GdkRegion *region = gdk_region_new();
for( int line = 0; line < Height; line++ )
{
int start = 0;
while( gdk_image_get_pixel( image, start, line ) == 0 && start < Width-1)
{
start++;
}
int end = Width - 1;
while( end >=0 && gdk_image_get_pixel( image, end, line ) == 0)
{
end--;
}
GdkRectangle rect;
rect.x = start;
rect.y = line;
rect.width = end - start + 1;
rect.height = 1;
GdkRegion *rectReg = gdk_region_rectangle( &rect );
gdk_region_union( region, rectReg );
gdk_region_destroy( rectReg );
}
gdk_window_shape_combine_region( gWnd, region, 0, 0 );
gdk_region_destroy( region );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void GTK2Window::WindowManualMove() void GTK2Window::WindowManualMove()
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* event.cpp: Event class * event.cpp: Event class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: event.cpp,v 1.8 2003/04/14 22:29:06 gbazin Exp $ * $Id: event.cpp,v 1.9 2003/04/16 14:38:04 asmax Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -103,7 +103,9 @@ void Event::PostTextMessage( string text ) ...@@ -103,7 +103,9 @@ void Event::PostTextMessage( string text )
{ {
char *txt = new char[text.size()+1]; char *txt = new char[text.size()+1];
strcpy( txt, text.c_str() ); strcpy( txt, text.c_str() );
OSAPI_PostMessage( NULL, CTRL_SET_TEXT, (unsigned int)this, (long)txt ); // OSAPI_PostMessage( NULL, CTRL_SET_TEXT, (unsigned int)this, (long)txt );
/* FIXME */
fprintf(stderr, "posttext %s\n", text.c_str());
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
unsigned int Event::GetMessageType( string Desc ) unsigned int Event::GetMessageType( string Desc )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment