1 #ifndef _resize__hpp__included__
2 #define _resize__hpp__included__
6 #include "newpacket.hpp"
12 virtual void operator()(uint8_t* target
, uint32_t twidth
, uint32_t theight
,
13 const uint8_t* source
, uint32_t swidth
, uint32_t sheight
) = 0;
19 resizer_factory(const std::string
& type
);
20 virtual ~resizer_factory();
21 static resizer
& make_by_type(const std::string
& type
);
22 virtual resizer
& make(const std::string
& type
) = 0;
24 static std::map
<std::string
, resizer_factory
*>* factories
;
25 friend std::string
get_resizer_list();
28 class simple_resizer
: public resizer_factory
31 simple_resizer(const std::string
& type
, void(*resize_fn
)(uint8_t* target
, uint32_t twidth
, uint32_t theight
,
32 const uint8_t* source
, uint32_t swidth
, uint32_t sheight
));
33 simple_resizer(const std::string
& type
, void(*resize_fn
)(uint8_t* target
, uint32_t twidth
, uint32_t theight
,
34 const uint8_t* source
, uint32_t swidth
, uint32_t sheight
, int algo
), int algo
);
35 resizer
& make(const std::string
& type
);
37 void(*resize_fn
)(uint8_t* target
, uint32_t twidth
, uint32_t theight
, const uint8_t* source
, uint32_t swidth
,
39 void(*resize_fn2
)(uint8_t* target
, uint32_t twidth
, uint32_t theight
, const uint8_t* source
, uint32_t swidth
,
40 uint32_t sheight
, int algo
);
45 struct image_frame_rgbx
48 image_frame_rgbx(uint32_t width
, uint32_t height
);
49 image_frame_rgbx(struct packet
& p
);
51 image_frame_rgbx(const image_frame_rgbx
& x
);
52 image_frame_rgbx
& operator=(const image_frame_rgbx
& x
);
53 uint32_t get_height() const;
54 uint32_t get_width() const;
55 unsigned char* get_pixels(); //RGBx data.
56 const unsigned char* get_pixels() const; //RGBx data.
57 size_t get_data_size() const; //Bytes.
58 //This returns the frame itself if it is already of suitable size.
59 image_frame_rgbx
& resize(uint32_t nwidth
, uint32_t nheight
, resizer
& using_resizer
);
63 unsigned char* imagedata
; //RGBx.
66 std::string
get_resizer_list();