Exemple #1
0
// 0 <= n < 1
void RgbEffects::GetMultiColorBlend(double n, bool circular, xlColour &color)
{
    size_t colorcnt=GetColorCount();
    if (colorcnt <= 1)
    {
        palette.GetColor(0,color);
        return;
    }
    if (n >= 1.0) n=0.99999;
    if (n < 0.0) n=0.0;
    double realidx=circular ? n*colorcnt : n*(colorcnt-1);
    int coloridx1=floor(realidx);
    int coloridx2=(coloridx1+1) % colorcnt;
    double ratio=realidx-double(coloridx1);
    Get2ColorBlend(coloridx1,coloridx2,ratio,color);
}
Exemple #2
0
// 0 <= n < 1
void RenderBuffer::GetMultiColorBlend(float n, bool circular, xlColor &color)
{
    size_t colorcnt=GetColorCount();
    if (colorcnt <= 1)
    {
        palette.GetColor(0,color);
        return;
    }
    if (n >= 1.0) n=0.99999f;
    if (n < 0.0) n=0.0f;
    float realidx=circular ? n*colorcnt : n*(colorcnt-1);
    int coloridx1=floor(realidx);
    int coloridx2=(coloridx1+1) % colorcnt;
    float ratio=realidx-float(coloridx1);
    Get2ColorBlend(coloridx1,coloridx2,ratio,color);
}
Exemple #3
0
// 0 <= n < 1
void PixelBufferClass::GetMultiColorBlend(int layer, double n, bool circular, wxColour &color)
{
    /*
    // debug
    wxClientDC dc(DrawWindow);
    wxString msg=wxString::Format(wxT("%6.4f"),n);
    wxColour txtcolor(255,255,255);
    dc.Clear();
    dc.SetTextForeground(txtcolor);
    dc.DrawText(msg,0,0);
    */
    size_t colorcnt=GetColorCount(layer);
    if (colorcnt <= 1) {
        palette[layer].GetColor(0,color);
        return;
    }
    if (n >= 1.0) n=0.99999;
    if (n < 0.0) n=0.0;
    double realidx=circular ? n*colorcnt : n*(colorcnt-1);
    int coloridx1=floor(realidx);
    int coloridx2=(coloridx1+1) % colorcnt;
    double ratio=realidx-double(coloridx1);
    Get2ColorBlend(layer,coloridx1,coloridx2,ratio,color);
}
Exemple #4
0
void RenderBuffer::Get2ColorBlend(int coloridx1, int coloridx2, float ratio, xlColor &color)
{
    color = palette.GetColor(coloridx1);
    const xlColor &c2 = palette.GetColor(coloridx2);
    Get2ColorBlend(color, c2, ratio);
}