Back to index

kdeartwork  4.3.2
Classes | Defines | Functions | Variables
Flux.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <qtimer.h>
#include "Flux.h"
#include "Flux.moc"
#include <klocale.h>
#include <kglobal.h>
#include <kconfig.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qcombobox.h>
#include <kmessagebox.h>

Go to the source code of this file.

Classes

class  particle
class  flux
class  KFluxSaverInterface

Defines

#define NUMCONSTS   8
#define PIx2   6.28318530718f
#define DEG2RAD   0.0174532925f

Functions

void hsl2rgb (float h, float s, float l, float &r, float &g, float &b)
int myRandi (int x)
float myRandf (float x)
int main (int argc, char *argv[])
static int filterRandom (int n)

Variables

static FluxWidget_fc = 0
static int whichparticle
static const char * defaultText []

Define Documentation

#define DEG2RAD   0.0174532925f

Definition at line 42 of file Flux.cpp.

#define NUMCONSTS   8

Definition at line 40 of file Flux.cpp.

#define PIx2   6.28318530718f

Definition at line 41 of file Flux.cpp.


Function Documentation

static int filterRandom ( int  n) [static]

Definition at line 826 of file Flux.cpp.

{
    if( (n < 0) || (n >= FluxWidget::DefaultModes) )
    {
        srand((unsigned)time(NULL));
        n = rand() % FluxWidget::DefaultModes;
    }
    return n;
}

Here is the caller graph for this function:

void hsl2rgb ( float  h,
float  s,
float  l,
float &  r,
float &  g,
float &  b 
)

Definition at line 45 of file Flux.cpp.

{
    // hue influence
    if(h < 0.166667){  // full red, some green
        r = 1.0;
        g = h * 6.0f;
        b = 0.0;
    }
    else {
        if(h < 0.5){  // full green
            g = 1.0;
            if(h < 0.333333){  // some red
                r = 1.0f - ((h - 0.166667f) * 6.0f);
                b = 0.0;
            }
            else{  // some blue
                b = (h - 0.333333f) * 6.0f;
                r = 0.0;
            }
        }
        else{
            if(h < 0.833333){  // full blue
                b = 1.0;
                if(h < 0.666667){  // some green
                    g = 1.0f - ((h - 0.5f) * 6.0f);
                    r = 0.0;
                }
                else{  // some red
                    r = (h - 0.666667f) * 6.0f;
                    g = 0.0;
                }
            }
            else{  // full red, some blue
                r = 1.0;
                b = 1.0f - ((h - 0.833333f) * 6.0f);
                g = 0.0;
            }
        }
    }

    // saturation influence
    r = 1.0f - (s * (1.0f - r));
    g = 1.0f - (s * (1.0f - g));
    b = 1.0f - (s * (1.0f - b));

    // luminosity influence
    r *= l;
    g *= l;
    b *= l;
}
int main ( int  argc,
char *  argv[] 
)

Definition at line 799 of file Flux.cpp.

{
    KFluxSaverInterface kss;
    return kScreenSaverMain( argc, argv, kss );
}
float myRandf ( float  x) [inline]

Definition at line 102 of file Flux.cpp.

                             {
    return(float(rand() * x) / float(RAND_MAX));
}
int myRandi ( int  x) [inline]

Definition at line 99 of file Flux.cpp.

                         {
    return((rand() * x) / RAND_MAX);
}

Variable Documentation

FluxWidget* _fc = 0 [static]

Definition at line 111 of file Flux.cpp.

const char* defaultText[] [static]
Initial value:
{
    I18N_NOOP( "Regular" ),
    I18N_NOOP( "Hypnotic" ),
    I18N_NOOP( "Insane" ),
    I18N_NOOP( "Sparklers" ),
    I18N_NOOP( "Paradigm" ),
    I18N_NOOP( "Galactic" ),
    I18N_NOOP( "(Random)" ),
    0
}

Definition at line 867 of file Flux.cpp.

int whichparticle [static]

Definition at line 113 of file Flux.cpp.