Beispiel #1
0
        public virtual void  addLerp(float factor, RGBColor other)
        {
            float r1 = red() + factor * other.red();
            float g1 = green() + factor * other.green();
            float b1 = blue() + factor * other.blue();

            //if (r1 < 0.0f) r1 = 0.0f;
            //if (g1 < 0.0f) g1 = 0.0f;
            //if (b1 < 0.0f) b1 = 0.0f;

            set(r1, g1, b1);
            //set(red() + factor * other.red(), green() + factor * other.green(), blue() + factor * other.blue());
        }
Beispiel #2
0
        public virtual void  initializeFramebuffer()
        {
            createFramebuffer();

            pixels = new RGBColor[width_][];
            for (int i = 0; i < width_; i++)
            {
                pixels[i] = new RGBColor[height_];
            }

            for (int i = 0; i < width_; i++)
            {
                for (int j = 0; j < height_; j++)
                {
                    setPixel(i, j, new RGBColor());
                }
            }
        }
Beispiel #3
0
        public virtual void  setPixel(int x, int y, RGBColor color)
        {
            if (x < 0 || x >= width_ || y < 0 || y >= height_)
            {
                //System.out.println ("Warning! (x,y) out of bounds.");
            }
            else
            {
                RGBColor clampedColor, screenColor;

                pixels[x][y] = color;

                if (offImg != null)
                {
                    clampedColor = new RGBColor(color);
                    clampedColor.clamp();

                    screenColor = clampedColor.convertTo24Bits();

                    offImg.SetPixel(x, y, System.Drawing.Color.FromArgb((int)screenColor.red(), (int)screenColor.green(), (int)screenColor.blue()));
                }
            }
        }
Beispiel #4
0
 public RGBColor(RGBColor source)
 {
     set(source);
 }
Beispiel #5
0
        public virtual RGBColor scaleNew(RGBColor other)
        {
            RGBColor result = new RGBColor(red() * other.red(), green() * other.green(), blue() * other.blue());

            return(result);
        }
Beispiel #6
0
 public virtual void  scale(RGBColor other)
 {
     set(red() * other.red(), green() * other.green(), blue() * other.blue());
 }
Beispiel #7
0
        public virtual RGBColor scaleNew(float factorR, float factorG, float factorB)
        {
            RGBColor result = new RGBColor(red() * factorR, green() * factorG, blue() * factorB);

            return(result);
        }
Beispiel #8
0
 public virtual void  sub(RGBColor other)
 {
     set(red() - other.red(), green() - other.green(), blue() - other.blue());
 }
Beispiel #9
0
 public virtual void  add(RGBColor other)
 {
     set(red() + other.red(), green() + other.green(), blue() + other.blue());
 }
Beispiel #10
0
 public virtual void  set(RGBColor other)
 {
     set(other.red(), other.green(), other.blue());
 }