forked from tTh/FloatImg
adding new bugs ?
This commit is contained in:
parent
54ee71119d
commit
db7728bb10
|
@ -123,7 +123,7 @@ switch (idFx) {
|
|||
retval = trinarize(image, 0);
|
||||
break;
|
||||
case 24: /* experiment ! */
|
||||
retval = des_bords_sombres_a(image, 260);
|
||||
retval = des_bords_sombres_a(image, 160);
|
||||
break;
|
||||
case 25:
|
||||
/* please make this function more tweakable */
|
||||
|
|
|
@ -23,27 +23,29 @@ extern int verbosity;
|
|||
int des_bords_sombres_a(FloatImg *pimg, int offset)
|
||||
{
|
||||
float coef;
|
||||
int xpos, lidx, y;
|
||||
int xpos, xp2, lidx, y;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, offset);
|
||||
#endif
|
||||
|
||||
if (offset<0 || offset>pimg->width) {
|
||||
if (offset<0 || offset>=pimg->width) {
|
||||
fprintf(stderr, "%s offset %d is bad\n", __func__, offset);
|
||||
return -66;
|
||||
}
|
||||
|
||||
for (y=0; y<pimg->height; y++) {
|
||||
lidx = y * pimg->width;
|
||||
lidx = y * pimg->width; /* start of the
|
||||
'y' line */
|
||||
for (xpos=0; xpos<offset; xpos++) {
|
||||
coef = (float)xpos / (float)offset;
|
||||
pimg->R[xpos+lidx] *= coef;
|
||||
pimg->G[xpos+lidx] *= coef;
|
||||
pimg->B[xpos+lidx] *= coef;
|
||||
pimg->R[(pimg->width-xpos)+lidx] *= coef;
|
||||
pimg->G[(pimg->width-xpos)+lidx] *= coef;
|
||||
pimg->B[(pimg->width-xpos)+lidx] *= coef;
|
||||
xp2 = pimg->width-xpos;
|
||||
pimg->R[xp2+lidx] *= coef;
|
||||
pimg->G[xp2+lidx] *= coef;
|
||||
pimg->B[xp2+lidx] *= coef;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,6 +54,28 @@ return 0;
|
|||
/* -------------------------------------------------------------- */
|
||||
int trinarize(FloatImg *pimg, int notused)
|
||||
{
|
||||
float mm[6], mRa, mGa, mBa, mRb, mGb, mBb;
|
||||
int foo, size;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, notused);
|
||||
#endif
|
||||
|
||||
foo = fimg_get_minmax_rgb(pimg, mm);
|
||||
mRa = (mm[1] - mm[0]) * 0.33333;
|
||||
mGa = (mm[3] - mm[2]) * 0.33333;
|
||||
mBa = (mm[5] - mm[4]) * 0.33333;
|
||||
mRb = (mm[1] - mm[0]) * 0.66666;
|
||||
mGb = (mm[3] - mm[2]) * 0.66666;
|
||||
mBb = (mm[5] - mm[4]) * 0.66666;
|
||||
|
||||
size = pimg->width * pimg->height;
|
||||
|
||||
for (foo=0; foo<size; foo++) {
|
||||
|
||||
; // XXX
|
||||
|
||||
}
|
||||
|
||||
fprintf(stderr, "the function '%s' is not implemented\n", __func__);
|
||||
exit(2);
|
||||
|
|
Loading…
Reference in New Issue