4 #include "colormodels.h"
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
,
17 int color_model
= BC_RGBA8888
,
18 long bytes_per_line
= -1);
19 VFrame(unsigned char *data
,
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.
35 friend class PngReadFunction
;
37 // Reallocate a frame without deleting the class
38 int reallocate(unsigned char *data
,
47 void set_memory(unsigned char *data
,
52 // Read a PNG into the frame with alpha
53 int read_png(unsigned char *data
);
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
);
60 long set_shm_offset(long offset
);
61 long get_shm_offset();
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
, float alpha
);
68 int apply_fade(float alpha
);
71 int allocate_compressed_data(long bytes
);
73 // Sequence number. -1 means invalid. Passing frames to the encoder is
74 // asynchronous. The sequence number must be preserved in the image itself
75 // to encode discontinuous frames.
77 void set_number(long number
);
79 long get_compressed_allocated();
80 long get_compressed_size();
81 long set_compressed_size(long size
);
82 int get_color_model();
83 // Get the data pointer
84 unsigned char* get_data();
85 // return an array of pointers to rows
86 unsigned char** get_rows();
88 unsigned char* get_y();
89 unsigned char* get_u();
90 unsigned char* get_v();
95 static int get_scale_tables(int *column_table
, int *row_table
,
96 int in_x1
, int in_y1
, int in_x2
, int in_y2
,
97 int out_x1
, int out_y1
, int out_x2
, int out_y2
);
98 int get_bytes_per_pixel();
99 long get_bytes_per_line();
100 static int calculate_bytes_per_pixel(int colormodel
);
101 static long calculate_data_size(int w
,
103 int bytes_per_line
= -1,
104 int color_model
= BC_RGB888
);
105 long get_data_size();
110 // Convenience storage.
111 // Returns -1 if not set.
112 int get_field2_offset();
113 int set_field2_offset(int value
);
114 // Overlay src onto this with blending and translation of input.
115 // Source and this must have alpha
116 void overlay(VFrame
*src
,
122 int reset_parameters();
123 void create_row_pointers();
124 int allocate_data(unsigned char *data
,
131 long bytes_per_line
);
133 // Convenience storage
135 // Data is pointing to someone else's buffer.
138 // If not set by user, is calculated from color_model
143 // Pointers to the start of each row
144 unsigned char **rows
;
145 // One of the #defines
147 // Allocated space for compressed data
148 long compressed_allocated
;
149 // Size of stored compressed image
150 long compressed_size
;
151 // Pointers to yuv planes
152 unsigned char *y
, *u
, *v
;
156 // Dimensions of frame
158 // Info for reading png images
159 unsigned char *image
;
162 // For writing discontinuous frames in background rendering
163 long sequence_number
;