On-Screen Display (OSD) Support in libxine-java

xine-lib provides support for dynamic On-Screen-Display interfaces. The xine hacker guide explains the underlying concepts. libxine-java (current SVN version only) provides the XineOSD class for this. To create an XineOSD instance call the createOSD method of the XineController.

Example: Draw some text and a cross over the video.

final int width  = 320;
final int height = 240;

// create OSD renderer
XineOSD osd = controller.createOSD(0, 0, width, height);

/* set sans serif 24 font */
osd.setFont("sans", 24);

/* copy pre-defined colors for white, black border, transparent background to
   starting at the index used by the first text palette */

/* copy pre-defined colors for white, no border, translucid background to
   starting at the index used by the second text palette */

osd.drawText( 0, 100, "white text, black border", XineLibConstants.XINE_OSD_TEXT1);
osd.drawText( 0, 130, "white text, no border", XineLibConstants.XINE_OSD_TEXT2);

osd.drawLine( 0, 0,  width-1, height-1, 10);
osd.drawLine(width-1, 0, 0 , height-1, 10);

osd.show(0); /* 0 stands for 'now' */