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()); }
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()); } } }
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())); } } }
public RGBColor(RGBColor source) { set(source); }
public virtual RGBColor scaleNew(RGBColor other) { RGBColor result = new RGBColor(red() * other.red(), green() * other.green(), blue() * other.blue()); return(result); }
public virtual void scale(RGBColor other) { set(red() * other.red(), green() * other.green(), blue() * other.blue()); }
public virtual RGBColor scaleNew(float factorR, float factorG, float factorB) { RGBColor result = new RGBColor(red() * factorR, green() * factorG, blue() * factorB); return(result); }
public virtual void sub(RGBColor other) { set(red() - other.red(), green() - other.green(), blue() - other.blue()); }
public virtual void add(RGBColor other) { set(red() + other.red(), green() + other.green(), blue() + other.blue()); }
public virtual void set(RGBColor other) { set(other.red(), other.green(), other.blue()); }