29 #include <libvisual/lvconfig.h>
30 #include <libvisual/lv_defines.h>
31 #include <libvisual/lv_palette.h>
32 #include <libvisual/lv_rectangle.h>
33 #include <libvisual/lv_buffer.h>
34 #include <libvisual/lv_gl.h>
116 VisGLAttrEntry gl_attrs[VISUAL_GL_ATTRIBUTE_LAST];
121 #include <libvisual/lv_intrusive_ptr.hpp>
129 typedef IntrusivePtr<Video> VideoPtr;
130 typedef IntrusivePtr<Video const> VideoConstPtr;
155 static VideoPtr wrap (
void* buffer,
bool owner,
int width,
int height,
VisVideoDepth depth,
int pitch = 0);
168 static VideoPtr create_from_file (std::string
const& path);
177 static VideoPtr create_from_stream (std::istream& input);
187 int get_width ()
const;
194 int get_height ()
const;
217 void set_pitch (
int pitch);
224 int get_pitch ()
const;
231 int get_bpp ()
const;
240 bool allocate_buffer ();
252 bool has_allocated_buffer ()
const;
269 void set_attrs (
int width,
int height,
int pitch,
VisVideoDepth depth);
294 bool compare_attrs_ignore_pitch (
VideoConstPtr const& src)
const;
301 std::size_t get_size ()
const;
308 void set_palette (
Palette const& palette);
315 void set_palette (
Palette&& palette);
322 Palette const& get_palette ()
const;
338 void* get_pixels ()
const;
347 void* get_pixel_ptr (
int x,
int y)
const;
354 Rect const& get_extents ()
const;
356 void set_extents(
Rect area);
359 void set_compose_colorkey (
Color const& color);
360 void set_compose_surface (uint8_t alpha);
373 void blit (
VideoConstPtr const& src,
int x,
int y,
bool alpha);
398 void fill_alpha (uint8_t alpha);
400 void fill_alpha (uint8_t alpha,
Rect const& area);
407 void fill_color (
Color const& color);
409 void fill_color (
Color const& color,
Rect const& area);
454 friend class VideoConvert;
455 friend class VideoTransform;
456 friend class VideoFill;
457 friend class VideoBlit;
459 friend void intrusive_ptr_add_ref (
Video const* video);
460 friend void intrusive_ptr_release (
Video const* video);
463 const std::unique_ptr<Impl> m_impl;
465 mutable unsigned int m_ref_count;
469 void set_dimension (
int width,
int height,
int pitch = 0);
472 inline void intrusive_ptr_add_ref (
Video const* video)
474 video->m_ref_count++;
477 inline void intrusive_ptr_release (Video
const* video)
479 if (--video->m_ref_count == 0) {
490 LV_API
VisVideo *visual_video_new (
void);
492 LV_API
VisVideo *visual_video_new_wrap_buffer (
void *buffer,
int owner,
int width,
int height,
VisVideoDepth depth,
int pitch);
493 LV_API
VisVideo *visual_video_load_from_file (
const char *path);
495 LV_API
void visual_video_ref (
VisVideo *video);
496 LV_API
void visual_video_unref (
VisVideo *video);
498 LV_API
int visual_video_allocate_buffer (
VisVideo *video);
499 LV_API
void visual_video_free_buffer (
VisVideo *video);
500 LV_API
int visual_video_has_allocated_buffer (
VisVideo *video);
505 LV_API
int visual_video_compare_attrs_ignore_pitch (
VisVideo *src1,
VisVideo *src2);
510 LV_API
void visual_video_set_attrs (
VisVideo *video,
int width,
int height,
int pitch,
VisVideoDepth depth);
512 LV_API
int visual_video_get_width (
VisVideo *video);
513 LV_API
int visual_video_get_height (
VisVideo *video);
515 LV_API
void visual_video_set_pitch (
VisVideo *video,
int pitch);
516 LV_API
int visual_video_get_pitch (
VisVideo *video);
521 LV_API
int visual_video_get_bpp (
VisVideo *video);
523 LV_API visual_size_t visual_video_get_size (
VisVideo *video);
525 LV_API
void *visual_video_get_pixels (
VisVideo *video);
526 LV_API
void *visual_video_get_pixel_ptr (
VisVideo *video,
int x,
int y);
533 LV_API
VisVideo *visual_video_new_sub_by_values (
VisVideo *src,
int x,
int y,
int width,
int height);
538 LV_API
void visual_video_set_compose_colorkey (
VisVideo *video,
VisColor *color);
539 LV_API
void visual_video_set_compose_surface (
VisVideo *video, uint8_t alpha);
549 LV_API
void visual_video_blit (
VisVideo *dest,
VisVideo *src,
int x,
int y,
int alpha);
552 LV_API
void visual_video_fill_alpha (
VisVideo *video, uint8_t density);
553 LV_API
void visual_video_fill_alpha_area (
VisVideo *video, uint8_t density,
VisRectangle *rect);
572 LV_API
const char *visual_video_depth_name (
VisVideoDepth depth);