Update of /cvsroot/freevo/freevo/WIP/RobShortt/lib/directfb
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17677

Added Files:
        testosd.py 
Log Message:
Another test.


--- NEW FILE: testosd.py ---
from directfb import *
import time

dfb = DirectFB()
caps = dfb.getCardCapabilities()
layer = dfb.getDisplayLayer(0)
layer.setCooperativeLevel( DLSCL_ADMINISTRATIVE )     
if ( not ((caps[2] & DSBLIT_BLEND_ALPHACHANNEL) and
      (caps[2] & DSBLIT_BLEND_COLORALPHA  ))):
    layer.setConfiguration( flags = DLCONF_BUFFERMODE, buffermode = DLBM_BACKSYSTEM )
layer_config = layer.getConfiguration()
layer.enableCursor ( 0 )
# font = dfb.createFont( "decker.ttf", height=layer_config['width']/30 )
font = dfb.createFont( "/opt/freevo/share/fonts/VeraBd.ttf", 
height=layer_config['width']/30 )
fontheight = font.getHeight()

# bgsurface.setFont( font )
# bgsurface.setColor(0xCF, 0xCF, 0xFF, 0xFF )
# bgsurface.drawString( "Move the mouse over a window to activate it.", 0, 0, 
DSTF_LEFT | DSTF_TOP );

# layer.setBackgroundImage( bgsurface );
# layer.setBackgroundMode( DLBM_IMAGE );

overscan_x = 80
overscan_y = 30
osd_width = layer_config['width'] - overscan_x
osd_height = layer_config['height'] - overscan_y

# osd_width = 300
# osd_height = 200

print 'osd_width: %s' % osd_width
print 'osd_height: %s' % osd_height

# osd = layer.createWindow( caps=DWCAPS_ALPHACHANNEL, width=800, height=600, posx=0, 
posy=0 )
# osd = layer.createWindow( caps=DWCAPS_ALPHACHANNEL, width=300, height=200, posx=20, 
posy=120 )
osd = layer.createWindow( caps=DWCAPS_ALPHACHANNEL, width=osd_width, 
                                                    height=osd_height, 
                                                    posx=overscan_x/2, 
                                                    posy=overscan_y/2 )
osd_surface = osd.getSurface()
osd.setOpacity( 0xFF )
buffer = osd.createEventBuffer()

# osd_surface.setColor( 0x00, 0x30, 0x10, 0xc0 )
# osd_surface.setColor( 0x00, 0x00, 0x00, 0x00 )
# osd_surface.drawRectangle( 0, 0, osd_width, osd_height )
# osd_surface.fillRectangle( 0, 0, osd_width, osd_height )
# osd_surface.setColor( 0x80, 0xa0, 0x00, 0x60 )
# osd_surface.fillRectangle( 1, 1, 298, 198 )
# osd_surface.setColor( 0x00, 0x00, 0x00, 0x00 )
# osd_surface.fillRectangle( 1, 1, 298, 198 )
osd_surface.setFont( font )
osd_surface.setColor(0xFF, 0xFF, 0xFF, 0xFF )
# osd_surface.drawString( "TEST OSD MESSAGE", 0, 0, DSTF_LEFT | DSTF_TOP );
osd_surface.drawString( "TEST OSD MESSAGE", osd_width/3, 2*osd_height/3);
osd_surface.flip( 0 )

# id1 = osd.getID()
osd.attachEventBuffer(buffer)
# osd.requestFocus()
# osd.raiseToTop()

upper = osd
quit = 0
while not quit:
    buffer.waitForEvent(10)
    evt = buffer.getEvent()
    while evt:
        if evt.__class__ is WindowEvent:
            print "Windowevent, ID: %d, Type %d" % (evt.window_id, evt.type)
        elif evt.__class__ is InputEvent:
            print "Inputevent, Device: %d" % evt.device_id
        else:
            print "Unknown Event"
        evt = buffer.getEvent()
    print "MainLoop."
print "finished."
time.sleep(1000)



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to