O.P. RE: Colour Fade plugin
seeing as people seem to want the source and it only took like 10 mins to do, here is the code for the fade function i did, its not great, its very quick and nasty but for anyone who wants it...
oh and it will also go beyond maxtofill by a small amount of letters (which i get around by simply setting maxtofill to be well under the maximum msn plus limit (but still greater than the actual network send limit)
the rest of the plugin is just parameter parsing
void FillColourFade(char *sResult, int maxtofill, int colour1, int colour2, char *text)
{
int numlets = strlen(text)-1;
float r1,g1,b1;
float r2,g2,b2;
float rstep, gstep, bstep;
int letsdone = 0;
char buf[5];
r1 = (float)((colour1&0xff0000)>>16);
g1 = (float)((colour1&0x00ff00)>>8);
b1 = (float)(colour1&0x0000ff);
r2 = (float)((colour2&0xff0000)>>16);
g2 = (float)((colour2&0x00ff00)>>8);
b2 = (float)(colour2&0x0000ff);
rstep = (r2-r1)/(float)(numlets);
gstep = (g2-g1)/(float)(numlets);
bstep = (b2-b1)/(float)(numlets);
while (*text && maxtofill > 0)
{
*(sResult++) = 3;
maxtofill--;
*(sResult++) = '(';
maxtofill--;
sprintf(buf, "%03d",(int)r1);
strcpy(sResult, buf);
sResult += strlen(buf);
maxtofill -= strlen(buf);
*(sResult++) = ',';
sprintf(buf, "%03d",(int)g1);
strcpy(sResult, buf);
sResult += strlen(buf);
maxtofill -= strlen(buf);
*(sResult++) = ',';
sprintf(buf, "%03d",(int)b1);
strcpy(sResult, buf);
sResult += strlen(buf);
maxtofill -= strlen(buf);
*(sResult++) = ')';
maxtofill--;
*(sResult++) = *(text++);
maxtofill--;
r1 += rstep;
g1 += gstep;
b1 += bstep;
}
}
|