dslinux/user/pixil/packages/dvdview/dvdview/oldlibgfx/libvideogfx/x11 .cvsignore Makefile.am dispimg.cc dispimg.hh imgwin.cc imgwin.hh server.cc server.hh

amadeus dslinux_amadeus at user.in-berlin.de
Tue Oct 3 13:25:57 CEST 2006


Update of /cvsroot/dslinux/dslinux/user/pixil/packages/dvdview/dvdview/oldlibgfx/libvideogfx/x11
In directory antilope:/tmp/cvs-serv11916/packages/dvdview/dvdview/oldlibgfx/libvideogfx/x11

Added Files:
	.cvsignore Makefile.am dispimg.cc dispimg.hh imgwin.cc 
	imgwin.hh server.cc server.hh 
Log Message:
adding pristine copy of pixil to HEAD so I can branch from it

--- NEW FILE: .cvsignore ---
Makefile
Makefile.in
*.lo
_libs
.libs
.deps
libvideogfx-x11.la

--- NEW FILE: imgwin.cc ---
/*
 *  imgwin.cc
 */

#include "config.h"

#include <time.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <errno.h>
#include <stdlib.h>

#include <iostream.h>
#include <iomanip.h>

#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include <X11/Xutil.h>

#include "libvideogfx/init.hh"

#include "server.hh"
#include "imgwin.hh"

#include "libvideogfx/graphics/color/colorspace.hh"


struct X11SpecificData
{
  Display*  d_display;
  Window    d_win;
};


ImageWindow_X11::ImageWindow_X11()
  : d_initialized(false),
    d_xpos(-1),d_ypos(-1)
{
  d_x11data = new X11SpecificData;
}


ImageWindow_X11::~ImageWindow_X11()
{
  //printf("ImageWindow_X11::~ImageWindow_X11()\n");
  Close();

  if (d_x11data) { delete d_x11data; d_x11data=NULL; }
}

void ImageWindow_X11::Close()
{
  if (!d_initialized)
    return;

  XUnmapWindow(d_x11data->d_display , d_x11data->d_win);
  XFlush(d_x11data->d_display);
  d_initialized=false;
}


Window   ImageWindow_X11::AskWindow()  { assert(d_initialized); return d_x11data->d_win; }
Display* ImageWindow_X11::AskDisplay() { return d_x11data->d_display; }


void ImageWindow_X11::Create(int w,int h,const char* title,const X11Server* server,Window parent)
{
  assert(!d_initialized);

  // Get X11 server.

  if (server)
    d_x11data->d_display = server->AskDisplay();
  else
    d_x11data->d_display = default_x11server.AskDisplay();

  int screen = DefaultScreen(d_x11data->d_display);
  Window rootwin = RootWindow(d_x11data->d_display,screen);


  // Choose VisualInfo

  XVisualInfo vinfo;
  //bool use_cmap8=false;

  if (XMatchVisualInfo(d_x11data->d_display, screen, 16, TrueColor, &vinfo))
    {
    }
  else
  if (XMatchVisualInfo(d_x11data->d_display, screen, 15, TrueColor, &vinfo))
    {
    }
  else
  if (XMatchVisualInfo(d_x11data->d_display, screen, 24, TrueColor, &vinfo))
    {
    }
  else
  if (XMatchVisualInfo(d_x11data->d_display, screen, 32, TrueColor, &vinfo))
    {
    }
  else
  if (XMatchVisualInfo(d_x11data->d_display, screen,  8, PseudoColor, &vinfo))
    {
      // use_cmap8=true;
    }
#if 0
  else
  if (XMatchVisualInfo(d_x11data->d_display, screen,  8, GrayScale, &vinfo))
    {
    }
#endif
  else
    {
      // TODO
      cerr << "no matching visual found\n";
      exit(10);
      // throw Excpt_Base(ErrSev_Error,"I'm sorry, no matching visual info found.");
    }

  //cout << "VISUAL-ID used for window: 0x" << hex << vinfo.visualid << dec << endl;

  // Create window

  Colormap theCmap = XCreateColormap(d_x11data->d_display, rootwin, vinfo.visual, AllocNone);

  XSetWindowAttributes attr;
  attr.colormap = theCmap;
  attr.background_pixel = 0;
  attr.border_pixel     = 1;

  Window parent_window;

#if 1
  if (parent)
    parent_window = parent;
  else
#endif
    parent_window = RootWindow(d_x11data->d_display,screen);

  //printf("WINID: %d %p\n",parent,parent);

  d_x11data->d_win = XCreateWindow(d_x11data->d_display, parent_window,
				   d_xpos,d_ypos,w,h, 2, vinfo.depth, InputOutput, vinfo.visual,
				   CWBackPixel|CWBorderPixel|CWColormap,&attr);
  
#if 1
  XSizeHints sizeh;
  sizeh.flags  = PSize; //|PMinSize|PMaxSize;
  if (d_xpos>=0 && d_ypos>=0) sizeh.flags |= PPosition;
  sizeh.width  = w;
  sizeh.height = h;
  sizeh.min_width  = w;
  sizeh.min_height = h;
  sizeh.max_width  = w;
  sizeh.max_height = h;
#endif

  XSetStandardProperties(d_x11data->d_display,d_x11data->d_win,
			 title,
			 title,
			 None,
                         glob_argv,glob_argc,&sizeh);
  
  XSelectInput(d_x11data->d_display, d_x11data->d_win, ExposureMask|KeyPressMask);
  XMapWindow(d_x11data->d_display,d_x11data->d_win);
  XFlush(d_x11data->d_display);

  while (1)
    {
      XEvent xev;
      XNextEvent(d_x11data->d_display,&xev);

      if (xev.type == Expose)
        break;
    }

  // Set Colormap

  // TODO

  d_initialized = true; 
}


ImageWindow_Autorefresh_X11::ImageWindow_Autorefresh_X11()
  : d_lastimg_was_RGB(false),
    d_lastimg_was_YUV(false)
{
}

ImageWindow_Autorefresh_X11::~ImageWindow_Autorefresh_X11()
{
  //printf("ImageWindow_Autorefresh_X11::~ImageWindow_Autorefresh_X11()\n");
}

void ImageWindow_Autorefresh_X11::Create(int w,int h,const char*title,const X11Server* server,Window win)
{
  ImageWindow_X11::Create(w,h,title,server,win);
  DisplayImage_X11::Create(w,h,AskWindow(),server);
}

void ImageWindow_Autorefresh_X11::Close()
{
  ImageWindow_X11::Close();
}

void ImageWindow_Autorefresh_X11::Display_const(const Image_RGB<Pixel>& img)
{
  if (!d_lastimg_was_RGB)
    {
      XImage& ximg = AskXImage();

      RawImageSpec_RGB spec;
      spec.bytes_per_line = ximg.bytes_per_line;
      spec.bits_per_pixel = ximg.bits_per_pixel;
      spec.little_endian  = (ximg.byte_order==LSBFirst);
      spec.SetRGBMasks(ximg.red_mask,ximg.green_mask,ximg.blue_mask);

      SetOutputSpec(spec);

      d_lastimg_was_RGB = true;
      d_lastimg_was_YUV = false;
    }
  
  TransformRGB(img,(uint8*)(AskXImage().data));
  PutImage();
}

void ImageWindow_Autorefresh_X11::Display_const(const Image_YUV<Pixel>& img)
{
  if (!d_lastimg_was_YUV)
    {
      XImage& ximg = AskXImage();

      RawImageSpec_RGB spec;
      spec.bytes_per_line = ximg.bytes_per_line;
      spec.bits_per_pixel = ximg.bits_per_pixel;
      spec.little_endian  = (ximg.byte_order==LSBFirst);
      spec.SetRGBMasks(ximg.red_mask,ximg.green_mask,ximg.blue_mask);

      SetOutputSpec(spec);

      d_lastimg_was_RGB = false;
      d_lastimg_was_YUV = true;
    }
  
  TransformYUV(img,(uint8*)(AskXImage().data));
  PutImage();
}

void ImageWindow_Autorefresh_X11::Display(Image_YUV<Pixel>& img)
{
  if (!d_lastimg_was_YUV)
    {
      XImage& ximg = AskXImage();

      RawImageSpec_RGB spec;
      spec.bytes_per_line = ximg.bytes_per_line;
      spec.bits_per_pixel = ximg.bits_per_pixel;
      spec.little_endian  = (ximg.byte_order==LSBFirst);
      spec.SetRGBMasks(ximg.red_mask,ximg.green_mask,ximg.blue_mask);

      SetOutputSpec(spec);

      d_lastimg_was_RGB = false;
      d_lastimg_was_YUV = true;
    }
  
  TransformYUV(img,(uint8*)(AskXImage().data));
  PutImage();
}

void ImageWindow_Autorefresh_X11::CheckForRedraw()
{
  XEvent event;
  while (XCheckWindowEvent(AskDisplay(),AskWindow(),ExposureMask,&event))
    {
      Redraw(event.xexpose);
    }
}


void ImageWindow_Autorefresh_X11::RedrawForever()
{
  XEvent event;
  for (;;)
    {
      XWindowEvent(AskDisplay(),AskWindow(),ExposureMask,&event);
      Redraw(event.xexpose);
    }
}


char ImageWindow_Autorefresh_X11::CheckForKeypress()
{
  XEvent event;
  if (XCheckWindowEvent(AskDisplay(),AskWindow(),KeyPressMask,&event))
    {
      char buf;

      if (XLookupString(&event.xkey,&buf,1,NULL,NULL) > 0)
	return buf;
      else
	return 0;
    }
  else
    return 0;
}


char ImageWindow_Autorefresh_X11::WaitForKeypress()
{
  XEvent event;

  for (;;)
    {
      XWindowEvent(AskDisplay(),AskWindow(),KeyPressMask|ExposureMask,&event);

      if (event.type == Expose)
	{
	  Redraw(event.xexpose);
	}
      else
	{
	  char buf;

	  if (XLookupString(&event.xkey,&buf,1,NULL,NULL) > 0)
	    return buf;
	  else
	    return 0;
	}
    }
}


void ImageWindow_Autorefresh_X11::Redraw(XExposeEvent& ev)
{
  PutImage(ev.x     , ev.y,
	   ev.width , ev.height,
	   ev.x     , ev.y);
}


/* All windows have to be on the same X-server.
 */
int MultiWindowRefresh(ImageWindow_Autorefresh_X11*const* windows,int nWindows)
{
  XEvent ev;
  bool refresh_occured=false;

  while (!refresh_occured)
    {
      XMaskEvent(windows[0]->AskDisplay(),ExposureMask|KeyPressMask,&ev);
      for (int i=0;i<nWindows;i++)
	{
	  if (ev.xany.window == windows[i]->AskWindow())
	    {
	      if (ev.type == Expose)
		{
		  windows[i]->Redraw(ev.xexpose);
		  refresh_occured=true;
		}
	      else if (ev.type == KeyPress)
		return i;
	    }
	}
    }

  return -1;
}

--- NEW FILE: Makefile.am ---
## Makefile.am for libvideogfx/libvideogfx/x11

noinst_LTLIBRARIES = libvideogfx-x11.la

libvideogfx_x11_la_SOURCES = \
	dispimg.cc	\
	dispimg.hh	\
	imgwin.cc	\
	imgwin.hh	\
	server.cc	\
	server.hh

INCLUDES = \
	-I$(top_srcdir)

.PHONY: files

files:
	@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
	  echo $$p; \
	done

--- NEW FILE: server.hh ---
/*********************************************************************
  libvideogfx/x11/server.hh

  purpose:

  notes:

  to do:

  author(s):
   - Dirk Farin, farin at ti.uni-mannheim.de

  modifications:
 *********************************************************************/

#ifndef LIBVIDEOGFX_X11_SERVER_HH
#define LIBVIDEOGFX_X11_SERVER_HH

#include <X11/Xlib.h>

class X11Server
{
public:
  virtual ~X11Server() { }

  virtual Display* AskDisplay() const = 0;
};

extern const X11Server& default_x11server;

#endif

--- NEW FILE: dispimg.cc ---
/*
 *  dispimg.cc
 */

#include "config.h"

#include <time.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <errno.h>

#include <iostream.h>
#include <iomanip.h>

#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include <X11/Xutil.h>

extern "C" {
#include <stdio.h>
extern int XShmGetEventBase(Display*);   // TODO: where can this function declaration be found ?
}

#include "libvideogfx/types.hh"

#include "server.hh"
#include "dispimg.hh"


struct DisplayImage_Data
{
  DisplayImage_Data()
    : mayUseMITSHM(true),
      d_initialized(false),
      d_data(NULL)
    {
    }

  ~DisplayImage_Data()
    {
      if (d_initialized)
	{
	  if (d_UseShmExt)
	    {
	      XShmDetach(d_display,&d_ShmSegInfo);
	      XDestroyImage(d_ximg);
	      shmdt(d_ShmSegInfo.shmaddr);
	      shmctl(d_ShmSegInfo.shmid,IPC_RMID,0);
	    }
	  else
	    {
	      d_ximg->data = NULL;
	      XDestroyImage(d_ximg);
	      if (d_data) delete[] d_data;
	    }

	  XFreeGC(d_display, d_gc);
	}
    }

  // user parameters

  bool mayUseMITSHM;

  // internal parameters

  bool        d_initialized;
  Display*    d_display;

  bool        d_UseShmExt;

  Window   d_win;
  GC       d_gc;

  XImage*  d_ximg;
  uint8*   d_data;
  XShmSegmentInfo d_ShmSegInfo;
  bool     d_WaitForCompletion;
  int      d_CompletionType;

  int d_width,d_height;
};


static int shmmajor;

static bool shmfailed;
static int shmhandler(Display* display,XErrorEvent* err)
{
  if (err->request_code == shmmajor &&
      err->minor_code == X_ShmAttach)
    shmfailed=true;

  return 0;
}


DisplayImage_X11::DisplayImage_X11()
{
  d_data = new DisplayImage_Data;
}


void DisplayImage_X11::UseMITSHM(bool flag=true) { d_data->mayUseMITSHM=flag; }

XImage& DisplayImage_X11::AskXImage() { assert(d_data->d_ximg); return *d_data->d_ximg; }


void DisplayImage_X11::Create(int w,int h,Window win,const X11Server* server)
{
  if (d_data->d_initialized)
    return;

  d_data->d_width  = w;
  d_data->d_height = h;
  int roundedwidth  = (w+15); roundedwidth  -= roundedwidth %16;
  //int roundedheight = (h+15); roundedheight -= roundedheight%16;


  // Connect to X11 server

  if (server)
    d_data->d_display = server->AskDisplay();
  else
    d_data->d_display = default_x11server.AskDisplay();

  int screen = DefaultScreen(d_data->d_display);
  d_data->d_win = win;


  // Choose VisualInfo

  XWindowAttributes winattr;
  XGetWindowAttributes(d_data->d_display,win,&winattr);

  VisualID visualid = XVisualIDFromVisual(winattr.visual);
  XVisualInfo vinfo_template;
  vinfo_template.visualid   = visualid;

  XVisualInfo* vinfo;
  int nvinfos;
  vinfo=XGetVisualInfo(d_data->d_display,VisualIDMask,&vinfo_template,&nvinfos);
  assert(vinfo != NULL);
  assert(nvinfos==1);

  //cout << "VISUAL-ID used for image: 0x" << hex << visualid << dec << endl;

  XGCValues gcvals;
  d_data->d_gc = XCreateGC(d_data->d_display,win,0,&gcvals);


  // Set Colormap

  // TODO

  // Create XImage structure

  if (d_data->mayUseMITSHM && XShmQueryExtension(d_data->d_display))
    {
      int dummy;
      int major_version,minor_version,pixmap_flag;

      if (!XShmQueryVersion(d_data->d_display, &major_version, &minor_version,&pixmap_flag)
	  || !XQueryExtension(d_data->d_display, "MIT-SHM", &dummy, &dummy, &dummy))
	{
	  // ShowNote(ErrSev_Note,"X11 shared memory (MITSHM) extension not supported");
	  d_data->d_UseShmExt=false;
        }
      else
	{
	  //char buffer[1000];
	  //sprintf(buffer,"X11 shared memory (MITSHM) extensions version %d.%d detected.",major_version, minor_version);
	  //ShowNote(ErrSev_Note,buffer);
	  d_data->d_UseShmExt = true;
        }
    }
  else
    {
      /*
      if (mayUseMITSHM)
	ShowNote(ErrSev_Note,"X11 shared memory (MITSHM) extension not supported");
      else
	ShowNote(ErrSev_Note,"X11 shared memory (MITSHM) extension disabled");
      */

      d_data->d_UseShmExt=false;
    }

tryagain:
  if (d_data->d_UseShmExt)
    {
      d_data->d_ximg = XShmCreateImage(d_data->d_display,winattr.visual,vinfo->depth,ZPixmap,(char*)0,
				       &d_data->d_ShmSegInfo,roundedwidth,h);
      if (!d_data->d_ximg)
        { 
	  //TODO
	  assert(0);
	  //throw Excpt_Base(ErrSev_Error,"XShmCreateImage failed");
	}

      d_data->d_ShmSegInfo.shmid    = shmget(IPC_PRIVATE,d_data->d_ximg->bytes_per_line*h, IPC_CREAT|0604);
      if (d_data->d_ShmSegInfo.shmid==-1)
	{ perror("shmget failed: "); assert(0); } // throw Excpt_Base(ErrSev_Error,"shmget failed"); }
      d_data->d_ShmSegInfo.shmaddr  = d_data->d_ximg->data = (char*)shmat(d_data->d_ShmSegInfo.shmid,0,0);
      if (d_data->d_ShmSegInfo.shmaddr==((char *)-1))
        { perror("shmat failed: "); assert(0); } // throw Excpt_Base(ErrSev_Error,"shmat failed"); }
      d_data->d_ShmSegInfo.readOnly = True;

      int dummy;
      XQueryExtension(d_data->d_display,"MIT-SHM",&shmmajor,&dummy,&dummy);

      shmfailed=false;
      XSetErrorHandler(shmhandler);

      Status xshma;
      xshma=XShmAttach(d_data->d_display,&d_data->d_ShmSegInfo);
      XSync(d_data->d_display,False);

      XSetErrorHandler(NULL);

      shmctl(d_data->d_ShmSegInfo.shmid, IPC_RMID, 0);

      if (!xshma)
	{ assert(0); } // throw Excpt_Base(ErrSev_Error,"XShmAttach failed");

      if (shmfailed)
	{
	  cout << "MIT-SHM failed, falling back to network mode.\n";
          XDestroyImage(d_data->d_ximg);
          shmdt(d_data->d_ShmSegInfo.shmaddr);
          shmctl(d_data->d_ShmSegInfo.shmid,IPC_RMID,0);
	  d_data->d_UseShmExt = false;
	  goto tryagain;
	}
      
      d_data->d_data = (uint8*)d_data->d_ximg->data;
      d_data->d_CompletionType = XShmGetEventBase(d_data->d_display) + ShmCompletion;
    }
  else
    {
      d_data->d_ximg = XCreateImage(d_data->d_display,vinfo->visual,vinfo->depth,
				    ZPixmap,0,NULL,roundedwidth,h,32,0);
      d_data->d_data = new uint8[d_data->d_ximg->bytes_per_line*h];
      d_data->d_ximg->data = (char*)d_data->d_data;
    }

  d_data->d_WaitForCompletion=false;

  XSync(d_data->d_display,False);

  XFree(vinfo);

  d_data->d_initialized = true; 
}


DisplayImage_X11::~DisplayImage_X11()
{
  delete d_data;
}


void DisplayImage_X11::PutImage(int srcx0,int srcy0,int w,int h, int dstx0,int dsty0)
{
  if (w==0) w=d_data->d_width;
  if (h==0) h=d_data->d_height;

  if (d_data->d_WaitForCompletion)
    while (1)
      {
        XEvent xev;
        
        XNextEvent(d_data->d_display, &xev);
        if (xev.type == d_data->d_CompletionType)
          break;
      }

  if (d_data->d_UseShmExt)
    {
      XShmPutImage(d_data->d_display, d_data->d_win, d_data->d_gc, d_data->d_ximg, srcx0, srcy0, dstx0, dsty0, w,h, True);

      XFlush(d_data->d_display);
      d_data->d_WaitForCompletion=true;
    }
  else
    {
      XPutImage(d_data->d_display, d_data->d_win, d_data->d_gc, d_data->d_ximg, srcx0, srcy0, dstx0, dsty0, w,h);
      XFlush(d_data->d_display);
    }
}


--- NEW FILE: imgwin.hh ---
/*********************************************************************
  libvideogfx/x11/imgwin.hh

  purpose:
    X11-wrapper classes that simplify window creation and
    displaying true color images in them.

  notes:

  to do:
    - There seems to be a problem with MultiWindowRefresh. Some
      parts of the image sometimes don't get updated. At the moment
      everything seems to work, though.

  author(s):
   - Dirk Farin, farin at ti.uni-mannheim.de

  modifications:
   31/Jul/2000 - Dirk Farin - new function: MultiWindowRefresh
   03/Aug/1999 - Dirk Farin - new class: ImageWindow_Autorefresh_X11
   29/Jul/1999 - Dirk Farin - first implementation
 *********************************************************************/

#ifndef LIBVIDEOGFX_X11_IMGWIN_HH
#define LIBVIDEOGFX_X11_IMGWIN_HH

#include "dispimg.hh"

#include "libvideogfx/graphics/lowlevel/img2raw.hh"


/* Wrapper class for creating one X11 window with the highest color depth possible.
 */
class ImageWindow_X11
{
public:
  ImageWindow_X11();
  ~ImageWindow_X11(); // Window will be closed in destructor.

  void SetPosition(int x,int y) { d_xpos=x; d_ypos=y; }

  void Create(int w,int h,const char* title,const X11Server* server=NULL,Window parent=0);
  void Close();

  Window   AskWindow();
  Display* AskDisplay();

private:
  bool        d_initialized;

  struct X11SpecificData* d_x11data; // This hides X11 datatypes from global namespace.

  int d_xpos,d_ypos;
};


/* Enhanced ImageWindow_X11-class that can accept an image and that watches
   X11 events to automatically redraw itself.
   To get fully automatic redrawing you have to create a new thread that
   calls RedrawForever() which will never return.
*/
class ImageWindow_Autorefresh_X11 : public ImageWindow_X11,     // the window itself
				    private DisplayImage_X11,   // the image to be displayed
				    private Image2Raw           // the transformation for image representation convertion
{
public:
   ImageWindow_Autorefresh_X11();
  ~ImageWindow_Autorefresh_X11();

  void Create(int w,int h,const char* title,const X11Server* server=NULL,Window parent=0);
  void Close();

  void Display_const(const Image_YUV<Pixel>&);
  void Display_const(const Image_RGB<Pixel>&);
  void Display      (      Image_YUV<Pixel>&);  // Input image contents may be destroyed
  void Display      (      Image_RGB<Pixel>& i) { Display_const(i); }


  // --- user interaction ---

  char CheckForKeypress();
  char WaitForKeypress();    // Image will be refreshed while waiting for the keypress.

  void CheckForRedraw();
  void RedrawForever();

private:
  bool d_lastimg_was_RGB;
  bool d_lastimg_was_YUV;

  void Redraw(XExposeEvent& ev);

  friend int MultiWindowRefresh(ImageWindow_Autorefresh_X11*const*,int nWindows);
};

/* MultiWindowRefresh also checks for keypresses. The window index of the window,
   in which the keypress has occured, is returned. Otherwise -1 is returned.
 */
int MultiWindowRefresh(ImageWindow_Autorefresh_X11*const*,int nWindows);

#endif

--- NEW FILE: server.cc ---
/*
 *  server.cc
 */

#include "config.h"

#include "server.hh"


class X11Server_Default : public X11Server
{
public:
  X11Server_Default()
    {
      display = XOpenDisplay(NULL);
    }
  
  ~X11Server_Default()
    {
      /* NOTE: eigentlich sollte der server schon wieder zugemacht werden,
	 aber wenn globale Windows erstellt werden kann es passieren, dass
	 der Server vor den Windows zugemacht wird, was dann schiefgeht. */
      // XCloseDisplay(display);
    }
    
  Display* AskDisplay() const { return display; }

private:
  Display* display;
};

static X11Server_Default default_x11server_OBJECT;
const X11Server& default_x11server = default_x11server_OBJECT;




--- NEW FILE: dispimg.hh ---
/*********************************************************************
  libvideogfx/x11/dispimg.hh

  purpose:
   Wrapper class around X11 XImage. Whenever possible the MIT-SHM
   extension is used for storing the images.

  notes:
   - Create() is not multi-threading save as X11-errors are caught

  to do:
   - Check that different endian schemes on client and server are working.
   - Try to redefine interface so that hardward YUV2RGB convertion is possible.
   - Support for other display depths.

  author(s):
   - Dirk Farin, farin at ti.uni-mannheim.de

  modifications:
   21/Jan/2000 - Dirk Farin - X11 specific data is now hidden to circumvent
                              global namespace pollution by definitions in
                              X11-header files.
   20/Oct/1999 - Dirk Farin - Bugfix. mayUseMITSHM was uninitialized
   29/Jul/1999 - Dirk Farin - Integration into ULib, changes in user interface.
   07/Jul/1999 - Dirk Farin - robust handling of MIT-SHM failures
   25/Jan/1999 - Dirk Farin - support 8bit displays
   14/Jan/1999 - Dirk Farin - Bugfix: 24 and 32bit display code now working
   07/Jan/1999 - Dirk Farin - support for 24 and 32bit deep displays
   03/Jan/1999 - Dirk Farin - support for X11 shared memory extension
   30/Dec/1998 - Dirk Farin - first implementation (16 bit deep displays only, 5:6:5 format)
 *********************************************************************/

#ifndef LIBVIDEOGFX_X11_DISPIMG_HH
#define LIBVIDEOGFX_X11_DISPIMG_HH

#include "libvideogfx/x11/server.hh"


class DisplayImage_X11
{
public:
  DisplayImage_X11();
  ~DisplayImage_X11();

  void UseMITSHM(bool flag=true);

  void Create(int w,int h,Window win,const X11Server* server=NULL);

  XImage& AskXImage();

  void PutImage(int srcx0=0,int srcy0=0,int w=0,int h=0, int dstx0=0,int dsty0=0);

private:
  struct DisplayImage_Data* d_data;
};

#endif




More information about the dslinux-commit mailing list