//----------------------------------------------------- void f0r_set_param_value(f0r_instance_t instance, f0r_param_t parm, int param_index) { inst *p; double tmpf; int tmpi,chg; p=(inst*)instance; chg=0; switch(param_index) { case 0: tmpf=*((double*)parm); if (tmpf!=p->poz) chg=1; p->poz=tmpf; break; case 1: tmpf=*((double*)parm); if (tmpf!=p->wdt) chg=1; p->wdt=tmpf; break; case 2: tmpf=map_value_forward(*((double*)parm), -3.15, 3.15); if (tmpf!=p->tilt) chg=1; p->tilt=tmpf; break; case 3: tmpf=*((double*)parm); if (tmpf!=p->min) chg=1; p->min=tmpf; break; case 4: tmpf=*((double*)parm); if (tmpf!=p->max) chg=1; p->max=tmpf; break; case 5: tmpi=map_value_forward(*((double*)parm), 0.0, 4.9999); if (p->op != tmpi) chg=1; p->op=tmpi; break; } if (chg==0) return; fill_grad(p); }
void f0ut_set_param_value(const videosize_t *videosize, const param0r_def *pdef, f0r_param_t paramVal, void *instanceVar) { switch (pdef->type) { case F0R_PARAM_BOOL: *(int*)instanceVar = (*(int*)paramVal); break; case F0R_PARAM_DOUBLE: *(double*)instanceVar = map_value_forward((*(double*)paramVal), pdef->range_min, pdef->range_max); break; case F0R_PARAM_COLOR: ((f0r_param_color_t*)instanceVar)->r = map_value_forward(((f0r_param_color_t*)paramVal)->r, 0, 255); ((f0r_param_color_t*)instanceVar)->g = map_value_forward(((f0r_param_color_t*)paramVal)->g, 0, 255); ((f0r_param_color_t*)instanceVar)->b = map_value_forward(((f0r_param_color_t*)paramVal)->b, 0, 255); break; case F0R_PARAM_POSITION: ((f0r_param_position_t*)instanceVar)->x = map_value_forward(((f0r_param_position_t*)paramVal)->x, 0, videosize->width); ((f0r_param_position_t*)instanceVar)->x = map_value_forward(((f0r_param_position_t*)paramVal)->y, 0, videosize->height); break; case F0R_PARAM_STRING: free (*(char**)instanceVar); *(char**)instanceVar= malloc(sizeof(char)*(strlen(*(char**)paramVal))+1); strcpy(*(char**)instanceVar, *(char**)paramVal); break; } }
//-------------------------------------------------- void f0r_set_param_value(f0r_instance_t instance, f0r_param_t param, int param_index) { tp_inst_t* inst = (tp_inst_t*)instance; f0r_param_double* p = (f0r_param_double*) param; int chg,tmpi; float tmpf; chg=0; switch (param_index) { case 0: //type tmpf=*((double*)p); if (tmpf>=1.0) tmpi=(int)tmpf; else tmpi = map_value_forward(tmpf, 0.0, 9.9999); if ((tmpi<0)||(tmpi>9.0)) break; if (inst->type != tmpi) chg=1; inst->type = tmpi; break; case 1: //channel tmpf=*((double*)p); if (tmpf>=1.0) tmpi=(int)tmpf; else tmpi = map_value_forward(tmpf, 0.0, 7.9999); if ((tmpi<0)||(tmpi>7.0)) break; if (inst->chan != tmpi) chg=1; inst->chan = tmpi; case 2: //amplitude tmpf = map_value_forward(*((double*)p), 0.0, 1.0); if (inst->amp != tmpf) chg=1; inst->amp = tmpf; break; case 3: //linear period sweep tmpi = map_value_forward(*((double*)p), 0.0, 1.0); if (inst->linp != tmpi) chg=1; inst->linp = tmpi; break; case 4: //frequency 1 tmpf = map_value_forward(*((double*)p), 0.0, 1.0); if (inst->f1 != tmpf) chg=1; inst->f1 = tmpf; break; case 5: //frequency 2 tmpf = map_value_forward(*((double*)p), 0.0, 1.0); if (inst->f2 != tmpf) chg=1; inst->f2 = tmpf; break; case 6: //aspect type tmpf=*((double*)p); if (tmpf>=1.0) tmpi=(int)tmpf; else tmpi = map_value_forward(tmpf, 0.0, 6.9999); if ((tmpi<0)||(tmpi>6.0)) break; if (inst->aspt != tmpi) chg=1; inst->aspt = tmpi; switch (inst->aspt) //pixel aspect ratio { case 0: inst->par=1.000; break; //square pixels case 1: inst->par=1.067; break; //PAL DV case 2: inst->par=1.455; break; //PAL wide case 3: inst->par=0.889; break; //NTSC DV case 4: inst->par=1.212; break; //NTSC wide case 5: inst->par=1.333; break; //HDV case 6: inst->par=inst->mpar; break; //manual } break; case 7: //manual aspect tmpf = map_value_forward_log(*((double*)p), 0.5, 2.0); if (inst->mpar != tmpf) chg=1; inst->mpar = tmpf; if (inst->aspt==6) inst->par=inst->mpar; break; } if (chg==0) return; switch (inst->type) { case 0: //hor freq ver sweep sweep_v(inst->sl, inst->w, inst->h, 0, inst->amp, inst->linp, inst->par, 0.05, 0.7); break; case 1: //hor freq hor sweep sweep_h(inst->sl, inst->w, inst->h, 0, inst->amp, inst->linp, inst->par, 0.05, 0.7); break; case 2: //ver freq ver sweep sweep_v(inst->sl, inst->w, inst->h, 1, inst->amp, inst->linp, inst->par, 0.05, 0.7); //ver f ver sw break; case 3: //ver freq hor sweep sweep_h(inst->sl, inst->w, inst->h, 1, inst->amp, inst->linp, inst->par, 0.05, 0.7); break; case 4: // "Siemens star" radials(inst->sl, inst->w, inst->h, inst->amp, inst->par, 60.0); break; case 5: //rings outwards rings(inst->sl, inst->w, inst->h, inst->amp, inst->par, inst->linp, 0.05, 0.7); break; case 6: //rings inwards rings(inst->sl, inst->w, inst->h, inst->amp, inst->par, inst->linp, 0.7, 0.05); break; case 7: //uniform 2D spatial frequency diags(inst->sl, inst->w, inst->h, inst->amp, inst->par, inst->f1, inst->f2); break; case 8: // "Nyquist blocks" nblocks(inst->sl, inst->w, inst->h, inst->amp); break; case 9: //square bars at integer Nyquist fractions sqbars(inst->sl, inst->w, inst->h, inst->amp); break; default: break; } }
//-------------------------------------------------- void f0r_set_param_value(f0r_instance_t instance, f0r_param_t param, int param_index) { tp_inst_t* inst = (tp_inst_t*)instance; f0r_param_double* p = (f0r_param_double*) param; int chg,tmpi,x0,y0,velx,vely; float tmpf; float_rgba c; chg=0; switch (param_index) { case 0: //color space tmpf=*((double*)p); if (tmpf>=1.0) tmpi=(int)tmpf; else tmpi = map_value_forward(tmpf, 0.0, 3.9999); if ((tmpi<0)||(tmpi>3.0)) break; if (inst->spc != tmpi) chg=1; inst->spc = tmpi; break; case 1: //cross section tmpf=*((double*)p); if (tmpf>=1.0) tmpi=(int)tmpf; else tmpi = map_value_forward(tmpf, 0.0, 2.9999); if ((tmpi<0)||(tmpi>2.0)) break; if (inst->cs != tmpi) chg=1; inst->cs = tmpi; break; case 2: //third axis value tmpf = map_value_forward(*((double*)p), 0.0, 1.0); if (inst->thav != tmpf) chg=1; inst->thav = tmpf; break; case 3: //fullscreen (BOOL) tmpi = map_value_forward(*((double*)p), 0.0, 1.0); if (inst->fs != tmpi) chg=1; inst->fs = tmpi; break; } if (chg==0) return; if (inst->fs==0) { x0=(inst->w-3*inst->h/4)/2; y0=inst->h/8; velx=3*inst->h/4; vely=3*inst->h/4; } else { x0=0; y0=0; velx=inst->w; vely=inst->h; } c.r=0.5;c.g=0.5;c.b=0.5;c.a=1.0; //gray background draw_rectangle(inst->sl, inst->w, inst->h, 0.0, 0.0, (float)inst->w, (float)inst->h, c); c.r=0.4;c.g=0.4;c.b=0.4;c.a=1.0; //darker gray background draw_rectangle(inst->sl, inst->w, inst->h, x0, y0, velx, vely, c); switch (inst->spc) { case 0: risi_presek_rgb(inst->sl, inst->w, inst->h, x0, y0, velx, vely, inst->cs, inst->thav); break; case 1: risi_presek_yprpb601(inst->sl, inst->w, inst->h, x0, y0, velx, vely, inst->cs, inst->thav); break; case 2: risi_presek_abi(inst->sl, inst->w, inst->h, x0, y0, velx, vely, inst->cs, inst->thav); break; case 3: risi_presek_hci(inst->sl, inst->w, inst->h, x0, y0, velx, vely, inst->cs, inst->thav); break; default: break; } }
//-------------------------------------------------- void f0r_set_param_value(f0r_instance_t instance, f0r_param_t param, int param_index) { tp_inst_t* inst = (tp_inst_t*)instance; f0r_param_double* p = (f0r_param_double*) param; int chg,tmpi; float tmpf; chg=0; switch (param_index) { case 0: //type tmpf=*((double*)p); if (tmpf>=1.0) tmpi=(int)tmpf; else tmpi = map_value_forward(tmpf, 0.0, 5.9999); if ((tmpi<0)||(tmpi>5.0)) break; if (inst->type != tmpi) chg=1; inst->type = tmpi; break; case 1: //channel tmpf=*((double*)p); if (tmpf>=1.0) tmpi=(int)tmpf; else tmpi = map_value_forward(tmpf, 0.0, 7.9999); if ((tmpi<0)||(tmpi>7.0)) break; if (inst->chan != tmpi) chg=1; inst->chan = tmpi; case 2: //amplitude tmpf = map_value_forward(*((double*)p), 0.0, 1.0); if (inst->amp != tmpf) chg=1; inst->amp = tmpf; break; case 3: //width tmpf = map_value_forward(*((double*)p), 1.0, 100.0); if (inst->pw != tmpf) chg=1; inst->pw = tmpf; break; case 4: //tilt tmpf = map_value_forward(*((double*)p), -PI/2.0, PI/2.0); if (inst->tilt != tmpf) chg=1; inst->tilt = tmpf; break; case 5: //negative tmpi = map_value_forward(*((double*)p), 0.0, 1.0); if (inst->neg != tmpi) chg=1; inst->neg = tmpi; break; } if (chg==0) return; switch (inst->type) { case 0: // pika_p(inst->sl, inst->w, inst->h, inst->pw, inst->amp); break; case 1: // pika_o(inst->sl, inst->w, inst->h, inst->pw, inst->amp); break; case 2: // crta_p(inst->sl, inst->w, inst->h, inst->pw, inst->amp, inst->tilt); break; case 3: // crta(inst->sl, inst->w, inst->h, inst->pw, inst->amp, inst->tilt); break; case 4: // crta_s(inst->sl, inst->w, inst->h, inst->pw, inst->amp, inst->tilt); break; case 5: // crta_r(inst->sl, inst->w, inst->h, inst->pw, inst->amp, inst->tilt); break; default: break; } }
//----------------------------------------------------- void f0r_set_param_value(f0r_instance_t instance, f0r_param_t parm, int param_index) { inst *p; double tmpf; int chg; p=(inst*)instance; chg=0; switch(param_index) { case 0: //X coordinate of corner 1 tmpf=*(double*)parm; if (tmpf!=p->x1) chg=1; p->x1=tmpf; break; case 1: //Y coordinate of corner 1 tmpf=*(double*)parm; if (tmpf!=p->y1) chg=1; p->y1=tmpf; break; case 2: //X coordinate of corner 2 tmpf=*(double*)parm; if (tmpf!=p->x2) chg=1; p->x2=tmpf; break; case 3: //Y coordinate of corner 2 tmpf=*(double*)parm; if (tmpf!=p->y2) chg=1; p->y2=tmpf; break; case 4: //X coordinate of corner 3 tmpf=*(double*)parm; if (tmpf!=p->x3) chg=1; p->x3=tmpf; break; case 5: //Y coordinate of corner 3 tmpf=*(double*)parm; if (tmpf!=p->y3) chg=1; p->y3=tmpf; break; case 6: //X coordinate of corner 4 tmpf=*(double*)parm; if (tmpf!=p->x4) chg=1; p->x4=tmpf; break; case 7: //Y coordinate of corner 4 tmpf=*(double*)parm; if (tmpf!=p->y4) chg=1; p->y4=tmpf; break; case 8: //Enable stretching tmpf=map_value_forward(*((double*)parm), 0.0, 1.0);//BOOL!! if (p->stretchON != tmpf) chg=1; p->stretchON = tmpf; break; case 9: //Stretch X tmpf=*(double*)parm; if (tmpf!=p->stretchx) chg=1; p->stretchx=tmpf; break; case 10: //Stretch Y tmpf=*(double*)parm; if (tmpf!=p->stretchy) chg=1; p->stretchy=tmpf; break; case 11: //Interpolation tmpf=map_value_forward(*((double*)parm), 0.0, 6.999); if (p->intp != tmpf) chg=1; p->intp=tmpf; break; case 12: //Transparent Background tmpf=map_value_forward(*((double*)parm), 0.0, 1.0);//BOOL!! // if (p->transb != tmpf) chg=1; p->transb = tmpf; break; case 13: //Feather Alpha tmpf=map_value_forward(*((double*)parm), 0.0, 100.0); if (tmpf!=p->feath) chg=1; p->feath=tmpf; break; case 14: //Alpha operation p->op=map_value_forward(*((double*)parm), 0.0, 4.9999); break; } if (chg!=0) { p->interp=set_intp(*p); p->mapIsDirty = 1; } }
//-------------------------------------------------- void f0r_set_param_value(f0r_instance_t instance, f0r_param_t param, int param_index) { tp_inst_t* inst = (tp_inst_t*)instance; f0r_param_double* p = (f0r_param_double*) param; int chg,tmpi; float tmpf; chg=0; switch (param_index) { case 0: //type tmpf=*((double*)p); if (tmpf>=1.0) tmpi=(int)tmpf; else tmpi = map_value_forward(tmpf, 0.0, 12.9999); if ((tmpi<0)||(tmpi>12.0)) break; if (inst->type != tmpi) chg=1; inst->type = tmpi; break; case 1: //size 1 tmpi = map_value_forward(*((double*)p), 0.0, 256.0); if (inst->size1 != tmpi) chg=1; inst->size1 = tmpi; break; case 2: //size 2 tmpi = map_value_forward(*((double*)p), 0.0, 64.0); if (inst->size2 != tmpi) chg=1; inst->size2 = tmpi; break; case 3: //negative tmpi = map_value_forward(*((double*)p), 0.0, 1.0); if (inst->neg != tmpi) chg=1; inst->neg = tmpi; make_char2color_table(inst->c2c,inst->neg); break; case 4: //aspect type tmpf=*((double*)p); if (tmpf>=1.0) tmpi=(int)tmpf; else tmpi = map_value_forward(*((double*)p), 0.0, 6.9999); if ((tmpi<0)||(tmpi>6.0)) break; if (inst->aspt != tmpi) chg=1; inst->aspt = tmpi; switch (inst->aspt) //pixel aspect ratio { case 0: inst->par=1.000;break; //square pixels case 1: inst->par=1.067;break; //PAL DV case 2: inst->par=1.455;break; //PAL wide case 3: inst->par=0.889;break; //NTSC DV case 4: inst->par=1.212;break; //NTSC wide case 5: inst->par=1.333;break; //HDV case 6: inst->par=inst->mpar;break; //manual } break; case 5: //manual aspect tmpf = map_value_forward_log(*((double*)p), 0.5, 2.0); if (inst->mpar !=tmpf) chg=1; inst->mpar = tmpf; if (inst->aspt==4) inst->par=inst->mpar; break; } if (chg==0) return; switch (inst->type) { case 0: //checkerboard sah1(inst->sl, inst->w, inst->h, inst->size1, inst->par, 0); break; case 1: //checkerboard with border sah1(inst->sl, inst->w, inst->h, inst->size1, inst->par, 1); break; case 2: //horizontal lines hlines(inst->sl, inst->w, inst->h, inst->size1, inst->size2, inst->par, 1); break; case 3: //vertical lines vlines(inst->sl, inst->w, inst->h, inst->size1, inst->size2, inst->par, 1); break; case 4: //grid mreza(inst->sl, inst->w, inst->h, inst->size1, inst->size2, inst->par); break; case 5: //points pike(inst->sl, inst->w, inst->h, inst->size1, inst->size2, inst->par); break; case 6: //bullseye tarca(inst->sl, inst->w, inst->h, inst->size1, inst->size2+1, inst->par); break; case 7: //edge marks robovi(inst->sl, inst->w, inst->h); break; case 8: //color quadrants are drawn in update() break; case 9: //pixel rulers case 11: rulers(inst->sl, inst->w, inst->h, inst->alpha); break; case 10: //measurement grid case 12: grid(inst->sl, inst->w, inst->h, inst->alpha); break; default: break; } }