IM7 Creating User Channels with Channel FX
Posted: 2014-01-09T04:57:35-07:00
I would like to give the user of my program a chance to add user channels to an image by specifying the number they need. So I am building a Channel FX command string in C++ and I have discovered an oddity, am I doing something wrong, is this by design or is it a bug? My code looks like this:-
char s[256]="",s1[16];
strcpy_s(s,256,"r|g|b|a");
int i;
if(user_channels>24) user_channels=24;
for(i=0; i<user_channels; i++)
{
if(i==0) sprintf_s(s1,16,"|a=>%d",i+8);
else {
if(i<5) continue;
sprintf_s(s1,16,"|a=>%d",i+4);
}
strcat_s(s,s1);
}
This is more complex than it needs to be because adding one extra channel with "...|a=>8" always adds five. Adding one more using "...|a=>8|a>9" adds one more channel making six in all. This means I can not add 1, 2, 3 or 4 user channels, 5 is the minimum.
Also is there a simple way of creating thes user channels initialized to a constant "...|8=0" does not add a new channel.
Alan Hadley
char s[256]="",s1[16];
strcpy_s(s,256,"r|g|b|a");
int i;
if(user_channels>24) user_channels=24;
for(i=0; i<user_channels; i++)
{
if(i==0) sprintf_s(s1,16,"|a=>%d",i+8);
else {
if(i<5) continue;
sprintf_s(s1,16,"|a=>%d",i+4);
}
strcat_s(s,s1);
}
This is more complex than it needs to be because adding one extra channel with "...|a=>8" always adds five. Adding one more using "...|a=>8|a>9" adds one more channel making six in all. This means I can not add 1, 2, 3 or 4 user channels, 5 is the minimum.
Also is there a simple way of creating thes user channels initialized to a constant "...|8=0" does not add a new channel.
Alan Hadley