public RGBA_Doubles(RGBA_Doubles c, double a_) { m_r = c.m_r; m_g = c.m_g; m_b = c.m_b; m_a = a_; }
//-------------------------------------------------------------------- private RGBA_Bytes(RGBA_Doubles c, double a_) { m_R = ((byte)Basics.UnsignedRound(c.m_r * (double)base_mask)); m_G = ((byte)Basics.UnsignedRound(c.m_g * (double)base_mask)); m_B = ((byte)Basics.UnsignedRound(c.m_b * (double)base_mask)); m_A = ((byte)Basics.UnsignedRound(a_ * (double)base_mask)); }
public RGBA_Bytes(RGBA_Doubles c) { m_R = ((byte)Basics.UnsignedRound(c.m_r * (double)base_mask)); m_G = ((byte)Basics.UnsignedRound(c.m_g * (double)base_mask)); m_B = ((byte)Basics.UnsignedRound(c.m_b * (double)base_mask)); m_A = ((byte)Basics.UnsignedRound(c.m_a * (double)base_mask)); }
public RasterBufferAccessorClip(IPixelFormat pixf, RGBA_Doubles bk) { m_pixf = pixf; m_PixelWidthInBytes = m_pixf.PixelWidthInBytes; //pixfmt_alpha_blend_bgra32.MakePixel(m_bk_buf, bk); unsafe { m_pBackBufferColor = (byte *)Marshal.AllocHGlobal(16); } }
public static RGBA_Doubles from_wavelength(double wl, double gamma) { RGBA_Doubles t = new RGBA_Doubles(0.0, 0.0, 0.0); if (wl >= 380.0 && wl <= 440.0) { t.m_r = -1.0 * (wl - 440.0) / (440.0 - 380.0); t.m_b = 1.0; } else if (wl >= 440.0 && wl <= 490.0) { t.m_g = (wl - 440.0) / (490.0 - 440.0); t.m_b = 1.0; } else if (wl >= 490.0 && wl <= 510.0) { t.m_g = 1.0; t.m_b = -1.0 * (wl - 510.0) / (510.0 - 490.0); } else if (wl >= 510.0 && wl <= 580.0) { t.m_r = (wl - 510.0) / (580.0 - 510.0); t.m_g = 1.0; } else if (wl >= 580.0 && wl <= 645.0) { t.m_r = 1.0; t.m_g = -1.0 * (wl - 645.0) / (645.0 - 580.0); } else if (wl >= 645.0 && wl <= 780.0) { t.m_r = 1.0; } double s = 1.0; if (wl > 700.0) { s = 0.3 + 0.7 * (780.0 - wl) / (780.0 - 700.0); } else if (wl < 420.0) { s = 0.3 + 0.7 * (wl - 380.0) / (420.0 - 380.0); } t.m_r = Math.Pow(t.m_r * s, gamma); t.m_g = Math.Pow(t.m_g * s, gamma); t.m_b = Math.Pow(t.m_b * s, gamma); return(t); }
//-------------------------------------------------------------------- public RGBA_Bytes Gradient(RGBA_Bytes c_8, double k) { RGBA_Doubles c = c_8.GetAsRGBA_Doubles(); RGBA_Doubles ret; ret.m_r = m_r + (c.m_r - m_r) * k; ret.m_g = m_g + (c.m_g - m_g) * k; ret.m_b = m_b + (c.m_b - m_b) * k; ret.m_a = m_a + (c.m_a - m_a) * k; return(ret.GetAsRGBA_Bytes()); }
public CheckBoxWidget(double x, double y, string label) : base(x, y, x + 9.0 * 1.5, y + 9.0 * 1.5) { m_text_thickness = (1.5); m_FontSize = (9.0); m_status = (false); m_text = new GsvText(); m_text_poly = new StrokeConverter(m_text); m_label = label; m_text_color = new RGBA_Doubles(0.0, 0.0, 0.0); m_inactive_color = new RGBA_Doubles(0.0, 0.0, 0.0); m_active_color = new RGBA_Doubles(0.4, 0.0, 0.0); }
public static RGBA_Doubles GetTweenColor(RGBA_Doubles Color1, RGBA_Doubles Color2, double RatioOf2) { if (RatioOf2 <= 0) { return(new RGBA_Doubles(Color1)); } if (RatioOf2 >= 1.0) { return(new RGBA_Doubles(Color2)); } // figure out how much of each Color we should be. double RatioOf1 = 1.0 - RatioOf2; return(new RGBA_Doubles( Color1.m_r * RatioOf1 + Color2.m_r * RatioOf2, Color1.m_g * RatioOf1 + Color2.m_g * RatioOf2, Color1.m_b * RatioOf1 + Color2.m_b * RatioOf2)); }
public void TextColor(IColorType c) { m_text_color = c.GetAsRGBA_Doubles(); }
//-------------------------------------------------------------------- RGBA_Bytes(RGBA_Doubles c, double a_) { m_R = ((byte)Basics.UnsignedRound(c.m_r * (double)base_mask)); m_G = ((byte)Basics.UnsignedRound(c.m_g * (double)base_mask)); m_B = ((byte)Basics.UnsignedRound(c.m_b * (double)base_mask)); m_A = ((byte)Basics.UnsignedRound(a_ * (double)base_mask)); }
public static RGBA_Doubles rgba_pre(RGBA_Doubles c, double a) { return new RGBA_Doubles(c, a).premultiply(); }
public static RGBA_Doubles GetTweenColor(RGBA_Doubles Color1, RGBA_Doubles Color2, double RatioOf2) { if (RatioOf2 <= 0) { return new RGBA_Doubles(Color1); } if(RatioOf2 >= 1.0) { return new RGBA_Doubles(Color2); } // figure out how much of each Color we should be. double RatioOf1 = 1.0 - RatioOf2; return new RGBA_Doubles( Color1.m_r * RatioOf1 + Color2.m_r * RatioOf2, Color1.m_g * RatioOf1 + Color2.m_g * RatioOf2, Color1.m_b * RatioOf1 + Color2.m_b * RatioOf2); }
public static RGBA_Doubles from_wavelength(double wl, double gamma) { RGBA_Doubles t = new RGBA_Doubles(0.0, 0.0, 0.0); if(wl >= 380.0 && wl <= 440.0) { t.m_r = -1.0 * (wl - 440.0) / (440.0 - 380.0); t.m_b = 1.0; } else if(wl >= 440.0 && wl <= 490.0) { t.m_g = (wl - 440.0) / (490.0 - 440.0); t.m_b = 1.0; } else if(wl >= 490.0 && wl <= 510.0) { t.m_g = 1.0; t.m_b = -1.0 * (wl - 510.0) / (510.0 - 490.0); } else if(wl >= 510.0 && wl <= 580.0) { t.m_r = (wl - 510.0) / (580.0 - 510.0); t.m_g = 1.0; } else if(wl >= 580.0 && wl <= 645.0) { t.m_r = 1.0; t.m_g = -1.0 * (wl - 645.0) / (645.0 - 580.0); } else if(wl >= 645.0 && wl <= 780.0) { t.m_r = 1.0; } double s = 1.0; if(wl > 700.0) s = 0.3 + 0.7 * (780.0 - wl) / (780.0 - 700.0); else if(wl < 420.0) s = 0.3 + 0.7 * (wl - 380.0) / (420.0 - 380.0); t.m_r = Math.Pow(t.m_r * s, gamma); t.m_g = Math.Pow(t.m_g * s, gamma); t.m_b = Math.Pow(t.m_b * s, gamma); return t; }
//-------------------------------------------------------------------- public RGBA_Doubles(RGBA_Doubles c) : this(c, 1) { }
public static RGBA_Doubles rgba_pre(RGBA_Doubles c, double a) { return(new RGBA_Doubles(c, a).premultiply()); }
public void ActiveColor(IColorType c) { m_active_color = c.GetAsRGBA_Doubles(); }
public RasterBufferAccessorClip(IPixelFormat pixf, RGBA_Doubles bk) { m_pixf = pixf; m_PixelWidthInBytes = m_pixf.PixelWidthInBytes; //pixfmt_alpha_blend_bgra32.MakePixel(m_bk_buf, bk); unsafe { m_pBackBufferColor = (byte*)Marshal.AllocHGlobal(16); } }