29 #include "lv_common.h"
35 LV::intrusive_ptr_add_ref (
self.
get ());
45 LV::intrusive_ptr_add_ref (
self.
get ());
51 VisVideo *visual_video_new_wrap_buffer (
void *buffer,
int owner,
int width,
int height,
VisVideoDepth depth,
int pitch)
53 auto self = LV::Video::wrap (buffer, owner, width, height, depth, pitch);
55 LV::intrusive_ptr_add_ref (
self.
get ());
61 VisVideo *visual_video_load_from_file (
const char *path)
65 LV::intrusive_ptr_add_ref (
self.
get ());
71 void visual_video_free_buffer (
VisVideo *
self)
73 visual_return_if_fail (
self !=
nullptr);
78 int visual_video_allocate_buffer (
VisVideo *
self)
80 visual_return_val_if_fail (
self !=
nullptr, FALSE);
82 return self->allocate_buffer ();
85 int visual_video_has_allocated_buffer (
VisVideo *
self)
87 visual_return_val_if_fail (
self !=
nullptr, FALSE);
89 return self->has_allocated_buffer ();
94 visual_return_if_fail (
self !=
nullptr);
95 visual_return_if_fail (src !=
nullptr);
102 visual_return_val_if_fail (
self !=
nullptr, FALSE);
103 visual_return_val_if_fail (src !=
nullptr, FALSE);
110 visual_return_val_if_fail (
self !=
nullptr, FALSE);
111 visual_return_val_if_fail (src !=
nullptr, FALSE);
113 return self->compare_attrs_ignore_pitch (
LV::VideoPtr (src));
118 visual_return_if_fail (
self !=
nullptr);
121 self->set_palette (*pal);
129 visual_return_val_if_fail (
self !=
nullptr,
nullptr);
131 auto& palette =
self->get_palette ();
132 if (!palette.empty ()) {
139 int visual_video_get_width (
VisVideo *
self)
141 visual_return_val_if_fail (
self !=
nullptr, 0);
143 return self->get_width ();
146 int visual_video_get_height (
VisVideo *
self)
148 visual_return_val_if_fail (
self !=
nullptr, 0);
150 return self->get_height ();
153 void visual_video_set_pitch (
VisVideo *
self,
int pitch)
155 visual_return_if_fail (
self !=
nullptr);
157 self->set_pitch (pitch);
160 int visual_video_get_pitch (
VisVideo *
self)
162 visual_return_val_if_fail (
self !=
nullptr, 0);
164 return self->get_pitch ();
169 visual_return_if_fail (
self !=
nullptr);
171 self->set_depth (depth);
178 return self->get_depth ();
181 int visual_video_get_bpp (
VisVideo *
self)
183 visual_return_val_if_fail (
self !=
nullptr, 0);
185 return self->get_bpp ();
190 visual_return_if_fail (
self !=
nullptr);
192 self->set_attrs (width, height, pitch, depth);
195 visual_size_t visual_video_get_size (
VisVideo *
self)
197 visual_return_val_if_fail (
self !=
nullptr, 0);
199 return self->get_size ();
202 void *visual_video_get_pixels (
VisVideo *
self)
204 visual_return_val_if_fail (
self !=
nullptr,
nullptr);
206 return self->get_pixels ();
211 visual_return_val_if_fail (
self !=
nullptr,
nullptr);
215 LV::intrusive_ptr_add_ref (buffer.
get ());
218 return buffer.
get ();
223 visual_return_val_if_fail (
self !=
nullptr,
nullptr);
225 return new LV::Rect (self->get_extents ());
228 void *visual_video_get_pixel_ptr (
VisVideo *
self,
int x,
int y)
230 visual_return_val_if_fail (
self !=
nullptr,
nullptr);
232 return self->get_pixel_ptr (x, y);
237 visual_return_val_if_fail (src !=
nullptr,
nullptr);
238 visual_return_val_if_fail (area !=
nullptr,
nullptr);
242 LV::intrusive_ptr_add_ref (
self.
get ());
248 VisVideo* visual_video_new_sub_by_values (
VisVideo *src,
int x,
int y,
int width,
int height)
250 visual_return_val_if_fail (src !=
nullptr,
nullptr);
254 LV::intrusive_ptr_add_ref (
self.
get ());
262 visual_return_val_if_fail (src !=
nullptr,
nullptr);
263 visual_return_val_if_fail (drect !=
nullptr,
nullptr);
264 visual_return_val_if_fail (srect !=
nullptr,
nullptr);
268 LV::intrusive_ptr_add_ref (
self.
get ());
276 visual_return_if_fail (
self !=
nullptr);
278 self->set_compose_type (type);
283 visual_return_if_fail (
self !=
nullptr);
284 visual_return_if_fail (color !=
nullptr);
286 self->set_compose_colorkey (*color);
289 void visual_video_set_compose_surface (
VisVideo *
self, uint8_t alpha)
291 visual_return_if_fail (
self !=
nullptr);
293 self->set_compose_surface (alpha);
298 visual_return_if_fail (
self !=
nullptr);
299 visual_return_if_fail (compose_func !=
nullptr);
301 self->set_compose_function (compose_func);
306 visual_return_val_if_fail (
self !=
nullptr,
nullptr);
307 visual_return_val_if_fail (src !=
nullptr,
nullptr);
309 return self->get_compose_function (src, alpha);
312 void visual_video_blit_area (
VisVideo *
self,
318 visual_return_if_fail (
self !=
nullptr);
319 visual_return_if_fail (drect !=
nullptr);
320 visual_return_if_fail (src !=
nullptr);
321 visual_return_if_fail (srect !=
nullptr);
326 void visual_video_compose_area (
VisVideo *
self,
332 visual_return_if_fail (
self !=
nullptr);
333 visual_return_if_fail (drect !=
nullptr);
334 visual_return_if_fail (src !=
nullptr);
335 visual_return_if_fail (srect !=
nullptr);
336 visual_return_if_fail (compose_func !=
nullptr);
338 self->compose (*drect,
LV::VideoPtr (src), *srect, compose_func);
341 void visual_video_blit_scale_area (
VisVideo *
self,
348 visual_return_if_fail (
self !=
nullptr);
349 visual_return_if_fail (drect !=
nullptr);
350 visual_return_if_fail (src !=
nullptr);
351 visual_return_if_fail (srect !=
nullptr);
353 self->blit_scale (*drect,
LV::VideoPtr (src), *srect, alpha, scale_method);
356 void visual_video_compose_scale_area (
VisVideo *
self,
363 visual_return_if_fail (
self !=
nullptr);
364 visual_return_if_fail (drect !=
nullptr);
365 visual_return_if_fail (src !=
nullptr);
366 visual_return_if_fail (srect !=
nullptr);
367 visual_return_if_fail (compose_func !=
nullptr);
369 self->compose_scale (*drect,
LV::VideoPtr (src), *srect, scale_method, compose_func);
372 void visual_video_blit (
VisVideo *
self,
VisVideo *src,
int x,
int y,
int alpha)
374 visual_return_if_fail (
self !=
nullptr);
375 visual_return_if_fail (src !=
nullptr);
382 visual_return_if_fail (
self !=
nullptr);
383 visual_return_if_fail (src !=
nullptr);
384 visual_return_if_fail (compose_func !=
nullptr);
389 void visual_video_fill_alpha (
VisVideo *
self, uint8_t alpha)
391 visual_return_if_fail (
self !=
nullptr);
393 self->fill_alpha (alpha);
398 visual_return_if_fail (
self !=
nullptr);
399 visual_return_if_fail (area !=
nullptr);
401 self->fill_alpha (alpha, *area);
406 visual_return_if_fail (
self !=
nullptr);
409 self->fill_color (*color);
411 self->fill_color (LV::Color::black ());
417 visual_return_if_fail (
self !=
nullptr);
418 visual_return_if_fail (color !=
nullptr);
419 visual_return_if_fail (area !=
nullptr);
421 self->fill_color (*color, *area);
427 visual_return_if_fail (
self !=
nullptr);
428 visual_return_if_fail (src !=
nullptr);
435 visual_return_if_fail (
self !=
nullptr);
436 visual_return_if_fail (src !=
nullptr);
443 visual_return_if_fail (
self !=
nullptr);
444 visual_return_if_fail (src !=
nullptr);
451 visual_return_if_fail (
self !=
nullptr);
452 visual_return_if_fail (src !=
nullptr);
459 visual_return_if_fail (
self !=
nullptr);
460 visual_return_if_fail (src !=
nullptr);
467 visual_return_if_fail (
self !=
nullptr);
468 visual_return_if_fail (src !=
nullptr);
479 visual_return_val_if_fail (src !=
nullptr,
nullptr);
481 auto self = LV::Video::create_scale_depth (
LV::VideoPtr (src), width, height, depth, scale_method);
483 LV::intrusive_ptr_add_ref (
self.
get ());
489 void visual_video_ref (
VisVideo *
self)
491 visual_return_if_fail (
self !=
nullptr);
493 LV::intrusive_ptr_add_ref (
self);
496 void visual_video_unref (
VisVideo *
self)
498 visual_return_if_fail (
self !=
nullptr);
500 LV::intrusive_ptr_release (
self);