pow() Funktion



  • Hallo!

    Habe folgenden Code im Gimp Source gefunden, bin aber nicht in der Lage zu interpretieren was da genau passiert. Für Hilfe wäre ich sehr dankbar!

    int val;
    double p;
    int cnt;

    for (cnt=0;cnt < 256;cnt++)
    {
    if(contrast < 0)
    {
    val = (cnt > 127) ? (255 - cnt) : cnt;
    val = (int) (127.0 * pow ((double) (val ? val : 1) / 127.0,
    (double) (127 + contrast) / 127.0));
    mContrastArray[cnt] = (cnt > 127) ? (255 - val) : val;
    if(mContrastArray[cnt] > 255) mContrastArray[cnt] = 255;
    if(mContrastArray[cnt] < 0) mContrastArray[cnt] = 0;
    }
    else
    {
    val = (cnt > 127) ? (255 - cnt) : cnt;
    p = (contrast == 127) ? 127 : 127.0 / (127 - contrast);
    val = (int) (127.0 * pow ((double) val / 127.0, p));
    mContrastArray[cnt] = (cnt > 127) ? (255 - val) : val;
    if(mContrastArray[cnt] > 255) mContrastArray[cnt] = 255;
    if(mContrastArray[cnt] < 0) mContrastArray[cnt] = 0;
    }
    }



  • Bitte um mehr informationenn
    z.b. Funktions name



  • Vielleicht stören ihn ja die

    <Ausdruck> & <Wert1> : <Wert2>
    

    Konstrukte?

    Wenn ja, dann hier lesen



  • könnte zum bleistift diese sein_

    Function: void stp_set_contrast (stp_vars_t vv, float val)
        Get or set the contrast of the print job (valid range: 0.0-4.0; default: 1.0). Values less than 1.0 will result in pure white or black not being used (0.0 will 
    make the entire image 50% gray). Values greater than 1.0 do not hard clip; while 
    the contrast in the midtones increases, it only asymptotically approaches the 
    limits.
    

    und hundert andere gimpfunktionen auch *g*
    http://gimp-print.sourceforge.net/developer-html/gimpprint_17.html

    so ein unsinn. man kann doch nicht ein stückchen code ohne drumherum posten.
    na ja, so kann es alles sein zwischen mandelbrot und kontrastladida 😉


Anmelden zum Antworten