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 / vframe.h < prev    next >
C/C++ Source or Header  |  2000-11-29  |  4KB  |  154 lines

  1. #ifndef VFRAME_H
  2. #define VFRAME_H
  3.  
  4. #include "colormodels.h"
  5. #include "vframe.inc"
  6.  
  7. class PngReadFunction;
  8.  
  9. class VFrame
  10. {
  11. public:
  12. // Create new frame with shared data if *data is nonzero.
  13. // Pass 0 to *data if private data is desired.
  14.     VFrame(unsigned char *data, 
  15.         int w, 
  16.         int h, 
  17.         int color_model = BC_RGBA8888, 
  18.         long bytes_per_line = -1);
  19.     VFrame(unsigned char *data, 
  20.         long y_offset,
  21.         long u_offset,
  22.         long v_offset,
  23.         int w, 
  24.         int h, 
  25.         int color_model = BC_RGBA8888, 
  26.         long bytes_per_line = -1);
  27. // Create a frame with the png image
  28.     VFrame(unsigned char *png_data);
  29.     VFrame(VFrame &vframe);
  30. // Create new frame for compressed data.
  31. // Can't share data because the data is dynamically allocated.
  32.     VFrame();
  33.     ~VFrame();
  34.  
  35.     friend PngReadFunction;
  36.     
  37. // Reallocate a frame without deleting the class
  38.     int reallocate(unsigned char *data, 
  39.         long y_offset,
  40.         long u_offset,
  41.         long v_offset,
  42.         int w, 
  43.         int h, 
  44.         int color_model, 
  45.         long bytes_per_line);
  46.  
  47.     void set_memory(unsigned char *data, 
  48.         long y_offset,
  49.         long u_offset,
  50.         long v_offset);
  51.  
  52. // Read a PNG into the frame with alpha
  53.     int read_png(unsigned char *data);
  54.  
  55. // if frame points to the same data as this return 1
  56.     int equals(VFrame *frame);
  57. // Test if frame already matches parameters
  58.     int params_match(int w, int h, int color_model);
  59.  
  60.     long set_shm_offset(long offset);
  61.     long get_shm_offset();
  62.  
  63. // direct copy with no alpha
  64.     int copy_from(VFrame *frame);
  65. // Direct copy with alpha from 0 to 1.
  66.     int replace_from(VFrame *frame, 
  67.         float alpha, 
  68.         int use_alpha, 
  69.         int use_float);
  70.  
  71.     int apply_fade(int factor);
  72.     int clear_frame();
  73.     int allocate_compressed_data(long bytes);
  74.  
  75.     long get_compressed_allocated();
  76.     long get_compressed_size();
  77.     long set_compressed_size(long size);
  78.     int get_color_model();
  79. // Get the data pointer
  80.     unsigned char* get_data();
  81. // return an array of pointers to rows
  82.     unsigned char** get_rows();       
  83. // return yuv planes
  84.     unsigned char* get_y(); 
  85.     unsigned char* get_u(); 
  86.     unsigned char* get_v(); 
  87.     int get_w();
  88.     int get_h();
  89.     int get_w_fixed();
  90.     int get_h_fixed();
  91.     static int clear_pixel(VPixel &pixel);
  92.     static int get_scale_tables(int *column_table, int *row_table, 
  93.             int in_x1, int in_y1, int in_x2, int in_y2,
  94.             int out_x1, int out_y1, int out_x2, int out_y2);
  95.     int get_bytes_per_pixel();
  96.     long get_bytes_per_line();
  97.     static int calculate_bytes_per_pixel(int colormodel);
  98.     static long calculate_data_size(int w, 
  99.         int h, 
  100.         int bytes_per_line = -1, 
  101.         int color_model = BC_RGB888);
  102.     long get_data_size();
  103.     void rotate270();
  104.     void rotate90();
  105.     void flip_vert();
  106.     int get_field2_offset();
  107.     int set_field2_offset(int value);
  108.  
  109. private:
  110.     int clear_objects();
  111.     int reset_parameters();
  112.     int allocate_data(unsigned char *data, 
  113.         long y_offset,
  114.         long u_offset,
  115.         long v_offset,
  116.         int w, 
  117.         int h, 
  118.         int color_model, 
  119.         long bytes_per_line);
  120.  
  121. // Convenience storage
  122.     int field2_offset;
  123. // Data is pointing to someone else's buffer.
  124.     int shared; 
  125.     long shm_offset;
  126. // If not set by user, is calculated from color_model
  127.     long bytes_per_line;
  128.     int bytes_per_pixel;
  129. // Image data
  130.     unsigned char *data;
  131. // Pointers to the start of each row
  132.     unsigned char **rows;
  133. // One of the #defines
  134.     int color_model;
  135. // Allocated space for compressed data
  136.     long compressed_allocated;
  137. // Size of stored compressed image
  138.     long compressed_size;   
  139. // Pointers to yuv planes
  140.     unsigned char *y, *u, *v;
  141.     long y_offset;
  142.     long u_offset;
  143.     long v_offset;
  144. // Dimensions of frame
  145.     int w, h;
  146. // Info for reading png images
  147.     unsigned char *image;
  148.     long image_offset;
  149.     long image_size;
  150. };
  151.  
  152.  
  153. #endif
  154.