Ejemplo n.º 1
0
void RgbEffects::RenderColorWash(bool HorizFade, bool VertFade, int RepeatCount)
{
    static int SpeedFactor=200;
    int x,y;
    wxColour color;
    wxImage::HSVValue hsv,hsv2;
    size_t colorcnt=GetColorCount();
    int CycleLen=colorcnt*SpeedFactor;
    if (state > (colorcnt-1)*SpeedFactor*RepeatCount && RepeatCount < 10)
    {
        GetMultiColorBlend(double(RepeatCount%2), false, color);
    }
    else
    {
        GetMultiColorBlend(double(state % CycleLen) / double(CycleLen), true, color);
    }
    Color2HSV(color,hsv);
    double HalfHt=double(BufferHt-1)/2.0;
    double HalfWi=double(BufferWi-1)/2.0;
    for (x=0; x<BufferWi; x++)
    {
        for (y=0; y<BufferHt; y++)
        {
            hsv2=hsv;
            if (HorizFade) hsv2.value*=1.0-abs(HalfWi-x)/HalfWi;
            if (VertFade) hsv2.value*=1.0-abs(HalfHt-y)/HalfHt;
            SetPixel(x,y,hsv2);
        }
    }
}
Ejemplo n.º 2
0
void RgbEffects::RenderSpirals(int PaletteRepeat, int Direction, int Rotation, int Thickness, bool Blend, bool Show3D)
{
    int strand_base,strand,thick,x,y,ColorIdx;
    size_t colorcnt=GetColorCount();
    int SpiralCount=colorcnt * PaletteRepeat;
    int deltaStrands=BufferWi / SpiralCount;
    int SpiralThickness=(deltaStrands * Thickness / 100) + 1;
    long SpiralState=state*Direction;
    wxImage::HSVValue hsv;
    wxColour color;
    for(int ns=0; ns < SpiralCount; ns++)
    {
        strand_base=ns * deltaStrands;
        ColorIdx=ns % colorcnt;
        palette.GetColor(ColorIdx,color);
        for(thick=0; thick < SpiralThickness; thick++)
        {
            strand = (strand_base + thick) % BufferWi;
            for(y=0; y < BufferHt; y++)
            {
                x=(strand + SpiralState/10 + y*Rotation/BufferHt) % BufferWi;
                if (x < 0) x += BufferWi;
                if (Blend)
                {
                    GetMultiColorBlend(double(BufferHt-y-1)/double(BufferHt), false, color);
                }
                if (Show3D)
                {
                    Color2HSV(color,hsv);
                    if (Rotation < 0)
                    {
                        hsv.value*=double(thick+1)/SpiralThickness;
                    }
                    else
                    {
                        hsv.value*=double(SpiralThickness-thick)/SpiralThickness;
                    }
                    SetPixel(x,y,hsv);
                }
                else
                {
                    SetPixel(x,y,color);
                }
            }
        }
    }
}
Ejemplo n.º 3
0
void PixelBufferClass::RenderColorWash(int layer, bool HorizFade, bool VertFade)
{
    int x,y;
    wxColour color;
    wxImage::HSVValue hsv,hsv2;
    size_t colorcnt=GetColorCount(layer);
    int CycleLen=colorcnt*100;
    ColorWashState[layer]+=Speed;
    double ratio= double(ColorWashState[layer]/4 % CycleLen) / double(CycleLen);
    GetMultiColorBlend(layer, ratio, true, color);
    Color2HSV(color,hsv);
    double HalfHt=double(BufferHt-1)/2.0;
    double HalfWi=double(BufferWi-1)/2.0;
    for (x=0; x<BufferWi; x++) {
        for (y=0; y<BufferHt; y++) {
            hsv2=hsv;
            if (HorizFade) hsv2.value*=1.0-abs(HalfWi-x)/HalfWi;
            if (VertFade) hsv2.value*=1.0-abs(HalfHt-y)/HalfHt;
            SetPixel(layer,x,y,hsv2);
        }
    }
}
Ejemplo n.º 4
0
void RgbEffects::RenderSpirals(int PaletteRepeat, int Direction, int Rotation, int Thickness,
                               bool Blend, bool Show3D, bool grow, bool shrink)
{
    int strand_base,strand,thick,x,y,ColorIdx;
    size_t colorcnt=GetColorCount();
    int SpiralCount=colorcnt * PaletteRepeat;
    int deltaStrands=BufferWi / SpiralCount;
    int SpiralThickness=(deltaStrands * Thickness / 100) + 1;
    int spiralGap = deltaStrands - SpiralThickness;
    long SpiralState;
    long ThicknessState = state/10;
    wxImage::HSVValue hsv;
    wxColour color;


    if (fitToTime)
    {
        double position = GetEffectTimeIntervalPosition();
        if (grow&&shrink)
        {
            ThicknessState = position <= 0.5?spiralGap*(position*2):spiralGap*((1-position) * 2);
        }
        else if (grow)
        {
                ThicknessState = spiralGap *position;
        }
        else if (shrink)
        {
            ThicknessState = spiralGap * (1-position);
        }
        SpiralState = position*BufferWi*10*Direction;
    }
    else
    {
        SpiralState=state*Direction;
    }

    spiralGap += (spiralGap==0);
    if (grow && (!shrink || ((ThicknessState/spiralGap)%2)==0))
    {
        SpiralThickness += ThicknessState%(spiralGap);
    }
    else if (shrink && (!grow || ((ThicknessState/spiralGap)%2)==1))
    {
        SpiralThickness +=spiralGap-ThicknessState%(spiralGap);
    }

    for(int ns=0; ns < SpiralCount; ns++)
    {
        strand_base=ns * deltaStrands;
        ColorIdx=ns % colorcnt;
        palette.GetColor(ColorIdx,color);
        for(thick=0; thick < SpiralThickness; thick++)
        {
            strand = (strand_base + thick) % BufferWi;
            for(y=0; y < BufferHt; y++)
            {
                x=(strand + SpiralState/10 + y*Rotation/BufferHt) % BufferWi;
                if (x < 0) x += BufferWi;
                if (Blend)
                {
                    GetMultiColorBlend(double(BufferHt-y-1)/double(BufferHt), false, color);
                }
                if (Show3D)
                {
                    Color2HSV(color,hsv);
                    if (Rotation < 0)
                    {
                        hsv.value*=double(thick+1)/SpiralThickness;
                    }
                    else
                    {
                        hsv.value*=double(SpiralThickness-thick)/SpiralThickness;
                    }
                    SetPixel(x,y,hsv);
                }
                else
                {
                    SetPixel(x,y,color);
                }
            }
        }
    }
}