libvisual  0.5.0
Public Member Functions | Static Public Member Functions | Friends | List of all members
LV::Video Class Reference

Canvas class for drawing operations. More...

#include <libvisual/lv_video.h>

Public Member Functions

 Video (Video const &)=delete
 
Videooperator= (Video const &)=delete
 
 ~Video ()
 Destructor.
 
int get_width () const
 Returns the video width. More...
 
int get_height () const
 Returns the video height. More...
 
void set_depth (VisVideoDepth depth)
 Sets the video depth. More...
 
VisVideoDepth get_depth () const
 Returns the video depth. More...
 
void set_pitch (int pitch)
 Sets the pixel pitch (or row stride). More...
 
int get_pitch () const
 Returns the pitch. More...
 
int get_bpp () const
 Returns the byte size of each pixel. More...
 
bool allocate_buffer ()
 Allocates a buffer based on the assigned dimensions and depth. More...
 
void free_buffer ()
 Frees the underlying pixel buffer.
 
bool has_allocated_buffer () const
 Checks if this object has a private allocated buffer. More...
 
BufferPtr get_buffer () const
 Retrieves the Buffer object. More...
 
void set_attrs (int width, int height, int pitch, VisVideoDepth depth)
 Sets all attributes. More...
 
void copy_attrs (VideoConstPtr const &src)
 Copies the attributes from another Video. More...
 
bool compare_attrs (VideoConstPtr const &src) const
 Checks if this Video has the same attributes as another Video. More...
 
bool compare_attrs_ignore_pitch (VideoConstPtr const &src) const
 Checks if this Video has the same attributes as another Video, ignoring pitch comparisons. More...
 
std::size_t get_size () const
 Returns the size of the pixel buffer. More...
 
void set_palette (Palette const &palette)
 Sets the color palette. More...
 
void set_palette (Palette &&palette)
 Sets the color palette. More...
 
Palette const & get_palette () const
 Returns the color palette. More...
 
Paletteget_palette ()
 Returns the color palette. More...
 
void * get_pixels () const
 Returns a pointer to the pixel buffer. More...
 
void * get_pixel_ptr (int x, int y) const
 Returns a pointer to a specific location in the pixel buffer. More...
 
Rect const & get_extents () const
 Returns the extents of this Video. More...
 
void set_extents (Rect area)
 
void set_compose_type (VisVideoComposeType type)
 
void set_compose_colorkey (Color const &color)
 
void set_compose_surface (uint8_t alpha)
 
void set_compose_function (VisVideoComposeFunc func)
 
VisVideoComposeFunc get_compose_function (VideoConstPtr const &src, bool alpha)
 
void blit (VideoConstPtr const &src, int x, int y, bool alpha)
 Draws a Video. More...
 
void blit (Rect const &drect, VideoConstPtr const &src, Rect const &srect, bool alpha)
 Draws a Video. More...
 
void compose (VideoConstPtr const &src, int x, int y, VisVideoComposeFunc func)
 
void compose (Rect const &drect, VideoConstPtr const &src, Rect const &srect, VisVideoComposeFunc func)
 
void blit_scale (Rect const &drect, VideoConstPtr const &src, Rect const &srect, bool alpha, VisVideoScaleMethod scale_method)
 
void compose_scale (Rect const &drect, VideoConstPtr const &src, Rect const &srect, VisVideoScaleMethod scale_method, VisVideoComposeFunc func)
 
void fill_alpha (uint8_t alpha)
 Fills the entire pixel buffer with a constant alpha value. More...
 
void fill_alpha (uint8_t alpha, Rect const &area)
 
void fill_color (Color const &color)
 Performs a color fill. More...
 
void fill_color (Color const &color, Rect const &area)
 
void flip_pixel_bytes (VideoConstPtr const &src)
 Flips the pixel byte ordering of a video. More...
 
void rotate (VideoConstPtr const &src, VisVideoRotateDegrees degrees)
 
void mirror (VideoConstPtr const &src, VisVideoMirrorOrient orient)
 
void convert_depth (VideoConstPtr const &src)
 Performs a depth conversion of a video. More...
 
void scale (VideoConstPtr const &src, VisVideoScaleMethod method)
 Scales a video. More...
 
void scale_depth (VideoConstPtr const &src, VisVideoScaleMethod method)
 Scales a video and performs a depth conversion where necessary. More...
 

Static Public Member Functions

static VideoPtr create ()
 Creates a new empty Video object.
 
static VideoPtr create (int width, int height, VisVideoDepth depth)
 Creates a new Video object with an allocated buffer. More...
 
static VideoPtr wrap (void *buffer, bool owner, int width, int height, VisVideoDepth depth, int pitch=0)
 
static VideoPtr create_sub (VideoConstPtr const &src, Rect const &srect)
 
static VideoPtr create_sub (Rect const &drect, VideoConstPtr const &src, Rect const &srect)
 
static VideoPtr create_from_file (std::string const &path)
 Creates a new Video object from an image file. More...
 
static VideoPtr create_from_stream (std::istream &input)
 Creates a new Video object from a input data stream. More...
 
static VideoPtr create_scale_depth (VideoConstPtr const &src, int width, int height, VisVideoDepth depth, VisVideoScaleMethod scale_method)
 

Friends

void intrusive_ptr_add_ref (Video const *video)
 
void intrusive_ptr_release (Video const *video)
 

Detailed Description

Canvas class for drawing operations.

Definition at line 133 of file lv_video.h.

Member Function Documentation

bool LV::Video::allocate_buffer ( )

Allocates a buffer based on the assigned dimensions and depth.

Returns
true if successful, false otherwise
See Also
set_depth(), set_pitch().

Definition at line 230 of file lv_video.cpp.

void LV::Video::blit ( VideoConstPtr const &  src,
int  x,
int  y,
bool  alpha 
)

Draws a Video.

Parameters
srcVideo to draw
xx-coordinate of draw position
yy-coordinate of draw position
alphaset to true if alpha channel is to be checked

Definition at line 513 of file lv_video.cpp.

void LV::Video::blit ( Rect const &  drect,
VideoConstPtr const &  src,
Rect const &  srect,
bool  alpha 
)

Draws a Video.

Parameters
drectArea to draw to
srcVideo to draw
srectArea of Video to draw
alphaset to true if alpha channel is to be checked

Definition at line 453 of file lv_video.cpp.

bool LV::Video::compare_attrs ( VideoConstPtr const &  src) const

Checks if this Video has the same attributes as another Video.

Parameters
srcVideo to compare against
Returns
true if both videos have the same attributes, false otherwise

Definition at line 269 of file lv_video.cpp.

bool LV::Video::compare_attrs_ignore_pitch ( VideoConstPtr const &  src) const

Checks if this Video has the same attributes as another Video, ignoring pitch comparisons.

Parameters
srcVideo to compare against
Returns
true if both videos have the same attributes, false otherwise

Definition at line 280 of file lv_video.cpp.

void LV::Video::convert_depth ( VideoConstPtr const &  src)

Performs a depth conversion of a video.

Parameters
srcsource Video

Definition at line 697 of file lv_video.cpp.

void LV::Video::copy_attrs ( VideoConstPtr const &  src)

Copies the attributes from another Video.

Parameters
srcVideo object to copy attributes from

Definition at line 262 of file lv_video.cpp.

VideoPtr LV::Video::create ( int  width,
int  height,
VisVideoDepth  depth 
)
static

Creates a new Video object with an allocated buffer.

Parameters
widthThe width for the new buffer.
heightThe height for the new buffer.
depthThe depth being used.

Definition at line 109 of file lv_video.cpp.

VideoPtr LV::Video::create_from_file ( std::string const &  path)
static

Creates a new Video object from an image file.

Parameters
pathpath to file to load
Returns
a Video object containing the image, or nullptr on failure

Definition at line 181 of file lv_video.cpp.

VideoPtr LV::Video::create_from_stream ( std::istream &  input)
static

Creates a new Video object from a input data stream.

Parameters
inputinput stream
Returns
a Video object containing the image, or nullptr on failure

Definition at line 191 of file lv_video.cpp.

void LV::Video::fill_alpha ( uint8_t  alpha)

Fills the entire pixel buffer with a constant alpha value.

Note
Only applicable for pixel formats with an alpha channel
Parameters
alphaalpha value for filling

Definition at line 571 of file lv_video.cpp.

void LV::Video::fill_color ( Color const &  color)

Performs a color fill.

Parameters
colorfill color

Definition at line 594 of file lv_video.cpp.

void LV::Video::flip_pixel_bytes ( VideoConstPtr const &  src)

Flips the pixel byte ordering of a video.

Parameters
srcsource Video

Definition at line 628 of file lv_video.cpp.

int LV::Video::get_bpp ( ) const

Returns the byte size of each pixel.

Returns
pixel byte size

Definition at line 362 of file lv_video.cpp.

BufferPtr LV::Video::get_buffer ( ) const

Retrieves the Buffer object.

Returns
the Buffer object

Definition at line 379 of file lv_video.cpp.

VisVideoDepth LV::Video::get_depth ( ) const

Returns the video depth.

Returns
video depth

Definition at line 357 of file lv_video.cpp.

Rect const & LV::Video::get_extents ( ) const

Returns the extents of this Video.

Returns
the extents

Definition at line 394 of file lv_video.cpp.

int LV::Video::get_height ( ) const

Returns the video height.

Returns
height in pixels

Definition at line 331 of file lv_video.cpp.

Palette const & LV::Video::get_palette ( ) const

Returns the color palette.

Returns
palette

Definition at line 305 of file lv_video.cpp.

Referenced by LV::Morph::run().

Palette & LV::Video::get_palette ( )

Returns the color palette.

Returns
palette

Definition at line 310 of file lv_video.cpp.

int LV::Video::get_pitch ( ) const

Returns the pitch.

Returns
pitch in bytes

Definition at line 346 of file lv_video.cpp.

void * LV::Video::get_pixel_ptr ( int  x,
int  y 
) const

Returns a pointer to a specific location in the pixel buffer.

See Also
get_pixels
Returns
pointer to pixel in buffer

Definition at line 389 of file lv_video.cpp.

void * LV::Video::get_pixels ( ) const

Returns a pointer to the pixel buffer.

See Also
get_pixel_ptr
Returns
pointer to pixel buffer

Definition at line 384 of file lv_video.cpp.

std::size_t LV::Video::get_size ( ) const

Returns the size of the pixel buffer.

Returns
size in bytes

Definition at line 374 of file lv_video.cpp.

int LV::Video::get_width ( ) const

Returns the video width.

Returns
width in pixels

Definition at line 326 of file lv_video.cpp.

bool LV::Video::has_allocated_buffer ( ) const

Checks if this object has a private allocated buffer.

Returns
true if this has an allocated buffer, false otherwise

Definition at line 257 of file lv_video.cpp.

void LV::Video::scale ( VideoConstPtr const &  src,
VisVideoScaleMethod  method 
)

Scales a video.

Parameters
srcsource Video
methodscaling method to use

Definition at line 795 of file lv_video.cpp.

void LV::Video::scale_depth ( VideoConstPtr const &  src,
VisVideoScaleMethod  method 
)

Scales a video and performs a depth conversion where necessary.

See Also
scale
Parameters
srcsource Video
methodscaling method to use

Definition at line 847 of file lv_video.cpp.

void LV::Video::set_attrs ( int  width,
int  height,
int  pitch,
VisVideoDepth  depth 
)

Sets all attributes.

Parameters
widthwidth in pixels
heightheight in pixels
pitchpitch (row stride)
depthcolour depth

Definition at line 367 of file lv_video.cpp.

void LV::Video::set_depth ( VisVideoDepth  depth)

Sets the video depth.

Parameters
depthvideo depth

Definition at line 351 of file lv_video.cpp.

Referenced by create().

void LV::Video::set_palette ( Palette const &  palette)

Sets the color palette.

Parameters
palettepalette

Definition at line 295 of file lv_video.cpp.

void LV::Video::set_palette ( Palette &&  palette)

Sets the color palette.

Parameters
palettepalette

Definition at line 300 of file lv_video.cpp.

void LV::Video::set_pitch ( int  pitch)

Sets the pixel pitch (or row stride).

Note
Use this only when the desired pitch is not equal to width * bytes per pixel.
Parameters
pitchpitch in bytes

Definition at line 336 of file lv_video.cpp.


The documentation for this class was generated from the following files: