home *** CD-ROM | disk | FTP | other *** search
/ Geek 6 / Geek-006.iso / linux / video / xmovie-1.5.3.tar.gz / xmovie-1.5.3.tar / xmovie-1.5.3 / guicast / bccapture.h < prev    next >
C/C++ Source or Header  |  2000-11-29  |  1KB  |  79 lines

  1. #ifndef BCCAPTURE_H
  2. #define BCCAPTURE_H
  3.  
  4. #include <sys/ipc.h>
  5. #include <sys/shm.h>
  6. #include <X11/Xlib.h>
  7. #include <X11/extensions/XShm.h>
  8.  
  9. #include "sizes.h"
  10. #include "vframe.inc"
  11.  
  12.  
  13. class BC_Capture
  14. {
  15. public:
  16.     BC_Capture(int w, int h, char *display_path = "");
  17.     virtual ~BC_Capture();
  18.  
  19.     int init_window(char *display_path);
  20. // x1 and y1 are automatically adjusted if out of bounds
  21.     int capture_frame(VFrame *frame, int &x1, int &y1);
  22.     int get_w();
  23.     int get_h();
  24.  
  25.     int w, h, default_depth;
  26.     unsigned char **row_data;
  27.  
  28. private:
  29.     int allocate_data();
  30.     int delete_data();
  31.     int get_top_w();
  32.     int get_top_h();
  33.     
  34.     inline void import_RGB565_to_RGB888(unsigned char* &output, unsigned char* &input)
  35.     {
  36.         *output++ = (*input & 0xf800) >> 8;
  37.         *output++ = (*input & 0x7e0) >> 3;
  38.         *output++ = (*input & 0x1f) << 3;
  39.  
  40.         input += 2;
  41.         output += 3;
  42.     };
  43.  
  44.     inline void import_BGR888_to_RGB888(unsigned char* &output, unsigned char* &input)
  45.     {
  46.         *output++ = input[2];
  47.         *output++ = input[1];
  48.         *output++ = input[0];
  49.  
  50.         input += 3;
  51.         output += 3;
  52.     };
  53.  
  54.     inline void import_BGR8888_to_RGB888(unsigned char* &output, unsigned char* &input)
  55.     {
  56.         *output++ = input[2];
  57.         *output++ = input[1];
  58.         *output++ = input[0];
  59.  
  60.         input += 4;
  61.         output += 3;
  62.     };
  63.  
  64.     int use_shm;
  65.     int bitmap_color_model;
  66.     unsigned char *data;
  67.     XImage *ximage;
  68.     XShmSegmentInfo shm_info;
  69.     Display* display;
  70.     Window rootwin;
  71.     Visual *vis;
  72.     int bits_per_pixel;
  73.     int screen;
  74.     long shm_event_type;
  75.     int client_byte_order, server_byte_order;
  76. };
  77.  
  78. #endif
  79.