#define MAX_STACK_ELEMENTS 255
#define SHM_MIN_SIZE 2048
+#define ALIAS_OFF 0
+#define ALIAS_TOP 1
+#define ALIAS_CTR 2
+#define ALIAS_BOT 4
+#define ALIAS_DBL 5
+#define ALIAS_NRM 6
+
// Scene graph for 3D models
// Defined by the subclass
class VFrameScene
class VFrame
{
friend class VFramePng;
+ friend class VFrameJpeg;
friend class PngReadFunction;
public:
// Create new frame with shared data if *data is nonzero.
void copy_stacks(VFrame *src);
// Updates the params with values from src
void copy_params(VFrame *src);
-
// This clears the stacks and the param table
void clear_stacks();
- virtual int draw_pixel(int x, int y);
- int pixel_rgb, pixel_yuv, stipple;
+// pixel drawing
+ virtual int draw_pixel(float x, float y, float a=1.f);
+ virtual int draw_pixel(float x, float y, float frac, int axis);
+ void set_draw_alpha(float a);
+ void set_draw_flags(int flags);
+ int pixel_rgb, pixel_yuv, stipple, draw_flags;
+ float draw_alpha;
void set_pixel_color(int rgb, int a=0xff);
void set_stiple(int mask);
- void draw_line(int x1, int y1, int x2, int y2);
+ void draw_line(float x1, float y1, float x2, float y2);
void draw_smooth(int x1, int y1, int x2, int y2, int x3, int y3);
void smooth_draw(int x1, int y1, int x2, int y2, int x3, int y3);
void draw_rect(int x1, int y1, int x2, int y2);
static VFrame *vframe_png(const char *png_path, double xs=1, double ys=1);
};
+// Create a frame with the jpeg image
+// jpeg_model must be BC_RGB888, BC_YUV888, or BC_GREY8
+class VFrameJpeg : public VFrame
+{
+// Read a JPEG into the frame (no alpha)
+ int read_jpeg(const unsigned char *data, long sz,
+ double xscale, double yscale, int jpeg_model);
+public:
+ VFrameJpeg(const unsigned char *jpeg_data, double s=0);
+ VFrameJpeg(const unsigned char *jpeg_data, long image_size, double xs=0, double ys=0);
+ virtual ~VFrameJpeg();
+ static VFrame *vframe_jpeg(int fd,
+ double xs=1, double ys=1, int jpeg_model=BC_RGB888);
+ static VFrame *vframe_jpeg(const char *jpeg_path,
+ double xs=1, double ys=1, int jpeg_model=BC_RGB888);
+};
+
#endif