/* BlinkenLib
* version 0.6.1 date 2008-07-22
* Copyright 2004-2008 Stefan Schuermans <stefan@blinkenarea.org>
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
* a blinkenarea.org project
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <BlinkenLib/BlinkenLib.h>
static void gen_test_movie( stBlinkenMovie * * ppMovie, const char * str_format, const char * str_mode, const char * str_duration )
{
unsigned int height, width, channels, colors;
enum { ModeNone, ModeDots, ModeLines } mode = ModeNone;
int duration;
if( strcmp( str_mode, "dots" ) == 0 )
mode = ModeDots;
if( strcmp( str_mode, "lines" ) == 0 )
mode = ModeLines;
if( sscanf( str_format, "%ux%u-%u/%u", &width, &height, &channels, &colors ) != 4 )
printf( "invalid movie format \"%s\"\n", str_format );
else if( mode == ModeNone )
printf( "invalid test mode \"%s\"\n", str_mode );
else if( sscanf( str_duration, "%u", &duration ) != 1 )
printf( "invalid duration \"%s\"\n", str_duration );
else
{
if( *ppMovie != NULL )
BlinkenMovieFree( *ppMovie );
*ppMovie = BlinkenMovieNew( height, width, channels, colors - 1 );
if( *ppMovie == NULL )
printf( "could not create movie with format \"%ux%u-%x/%u\"\n", width, height, channels, colors );
else
{
unsigned int y, x, c, yy, xx, cc;
stBlinkenFrame * pFrame;
height = BlinkenMovieGetHeight( *ppMovie );
width = BlinkenMovieGetWidth( *ppMovie );
channels = BlinkenMovieGetChannels( *ppMovie );
colors = BlinkenMovieGetMaxval( *ppMovie ) + 1;
switch( mode ) {
case ModeNone:
break;