added placement modes to photoplay,videowall and magic photo #48, #42

This commit is contained in:
niels
2015-11-15 22:56:21 +01:00
parent 2c605b979e
commit 5a7fec2155
5 changed files with 65 additions and 12 deletions

View File

@@ -98,17 +98,71 @@ matrix_t matrix_placementD(int photoindex, int size, int w , int h)
return m;
}
matrix_t matrix_placementE(int photoindex, int size, int w , int h)
{
matrix_t m;
int n = size*size-1;
m.w = ((photoindex) % size) * (w/size);
m.h = ((n-photoindex) / size) * (h/size);
return m;
}
matrix_t matrix_placementF(int photoindex, int size, int w , int h)
{
matrix_t m;
int n = size*size-1;
m.w = ((n-photoindex) / size) * (w/size);
m.h = ((photoindex) % size) * (h/size);
return m;
}
matrix_t matrix_placementG(int photoindex, int size, int w , int h)
{
matrix_t m;
int n = size*size-1;
m.w = ((n-photoindex) % size) * (w/size);
m.h = ((photoindex) / size) * (h/size);
return m;
}
matrix_t matrix_placementH(int photoindex, int size, int w , int h)
{
matrix_t m;
int n = size*size-1;
m.w = ((photoindex) / size) * (w/size);
m.h = ((n-photoindex) % size) * (h/size);
return m;
}
matrix_f get_matrix_func(int type)
{
if(type==0)
switch(type) {
case 0:
return &matrix_placementA;
if(type==1)
case 1:
return &matrix_placementB;
if(type==2)
case 2:
return &matrix_placementC;
case 3:
return &matrix_placementD;
case 4:
return &matrix_placementE;
case 5:
return &matrix_placementF;
case 6:
return &matrix_placementG;
case 7:
return &matrix_placementH;
default:
break;
}
return &matrix_placementD;
}
int get_matrix_func_n()
{
return 7;
}
int power_of(int size)
{

View File

@@ -232,6 +232,7 @@ typedef matrix_t (*matrix_f)(int i, int s, int w, int h);
matrix_t matrix_placementA(int photoindex, int size, int w , int h);
matrix_t matrix_placementB(int photoindex, int size, int w , int h);
matrix_f get_matrix_func(int type);
int get_matrix_func_n();
int power_of(int size);
int max_power(int w);

View File

@@ -34,7 +34,7 @@ vj_effect *photoplay_init(int w, int h)
ve->limits[0][1] = 0;
ve->limits[1][1] = 1; // waterfall
ve->limits[0][2] = 0;
ve->limits[1][2] = 3; // mode
ve->limits[1][2] = get_matrix_func_n(); // mode
ve->defaults[0] = 2;
ve->defaults[1] = 0;
ve->defaults[2] = 1;

View File

@@ -36,7 +36,7 @@ vj_effect *photoplay_init(int w, int h)
ve->limits[0][1] = 1;
ve->limits[1][1] = 250; // waterfall
ve->limits[0][2] = 0;
ve->limits[1][2] = 3; // mode
ve->limits[1][2] = get_matrix_func_n(); // mode
ve->defaults[0] = 2;
ve->defaults[1] = 2; // higher value takes less cpu
ve->defaults[2] = 1;
@@ -216,16 +216,14 @@ void photoplay_apply( VJFrame *frame, int width, int height, int size, int delay
}
for ( i = 0; i < num_photos; i ++ )
for( i = 0; i < num_photos; i ++ )
{
matrix_t m = matrix_placement(i, size,width,height );
put_photo( dstY, photo_list[i]->data[0],width,height,i, m);
put_photo( dstU, photo_list[i]->data[1],width,height,i, m);
put_photo( dstV, photo_list[i]->data[2],width,height,i, m);
put_photo( dstY, photo_list[i]->data[0],width,height,i,m);
put_photo( dstU, photo_list[i]->data[1],width,height,i,m);
put_photo( dstV, photo_list[i]->data[2],width,height,i,m);
}
if(frame_delay == delay)
frame_counter ++;
}

View File

@@ -37,7 +37,7 @@ vj_effect *videoplay_init(int w, int h)
ve->limits[0][1] = 1;
ve->limits[1][1] = 250; // waterfall
ve->limits[0][2] = 0;
ve->limits[1][2] = 3; // mode
ve->limits[1][2] = get_matrix_func_n(); // mode
ve->defaults[0] = 2;
ve->defaults[1] = 1;
ve->defaults[2] = 1;