public void SetColorChannelHdr(RgbaChannel channel, float value) { if (this.m_ColorHdr[(int)channel] != value) { this.m_ColorHdr[(int)channel] = value; this.OnRgbaHdrChannelChanged((int)channel); } }
public void SetColorChannelHdr(RgbaChannel channel, float value) { if (m_ColorHdr[(int)channel] == value) { return; } m_ColorHdr[(int)channel] = value; OnRgbaHdrChannelChanged((int)channel); }
public void SetColorChannelHdr(RgbaChannel channel, float value) { if (m_ColorHdr[(int)channel] == value) { return; } m_ColorHdr[(int)channel] = value; m_HDRBaseColor = new Color(m_ColorHdr[0], m_ColorHdr[1], m_ColorHdr[2], m_ColorHdr[3]); OnRgbaHdrChannelChanged((int)channel); }
public void SetColorChannel(RgbaChannel channel, byte value) { if (this.m_Color[(int)channel] != value) { this.m_Color[(int)channel] = value; this.m_ColorHdr[(int)channel] = (float)value / 255f; if (channel != RgbaChannel.A) { this.m_ColorHdr[(int)channel] *= Mathf.Pow(2f, this.m_ExposureValue); } Color.RGBToHSV(this.color, out this.m_Hsv[0], out this.m_Hsv[1], out this.m_Hsv[2]); } }
public void SetColorChannel(RgbaChannel channel, byte value) { if (m_Color[(int)channel] == value) { return; } m_Color[(int)channel] = value; m_ColorHdr[(int)channel] = (value / 255f); if (channel != RgbaChannel.A) { m_ColorHdr[(int)channel] *= Mathf.Pow(2f, m_ExposureValue); } Color.RGBToHSV( color, out m_Hsv[(int)HsvChannel.H], out m_Hsv[(int)HsvChannel.S], out m_Hsv[(int)HsvChannel.V] ); }
public static Color ModifyChannelByteValue(Color color, RgbaChannel channel, byte value) { switch (channel) { case RgbaChannel.Alpha: return(Color.FromArgb(value, color.R, color.G, color.B)); case RgbaChannel.Red: return(Color.FromArgb(color.A, value, color.G, color.B)); case RgbaChannel.Green: return(Color.FromArgb(color.A, color.R, value, color.B)); case RgbaChannel.Blue: return(Color.FromArgb(color.A, color.R, color.G, value)); default: throw new ArgumentOutOfRangeException(nameof(channel)); } }
public static byte GetChannelByteValue(Color color, RgbaChannel channel) { switch (channel) { case RgbaChannel.Alpha: return(color.A); case RgbaChannel.Red: return(color.R); case RgbaChannel.Green: return(color.G); case RgbaChannel.Blue: return(color.B); default: throw new ArgumentOutOfRangeException(nameof(channel)); } }
public System.Drawing.Color GetColorFromChannel(System.Drawing.Color color, RgbaChannel channel) { switch (channel) { case RgbaChannel.Red: return(System.Drawing.Color.FromArgb(color.R, color.R, color.R)); case RgbaChannel.Green: return(System.Drawing.Color.FromArgb(color.G, color.G, color.G)); case RgbaChannel.Blue: return(System.Drawing.Color.FromArgb(color.B, color.B, color.B)); case RgbaChannel.Alpha: return(System.Drawing.Color.FromArgb(color.A, color.A, color.A)); default: return(color); } }
private Color GetSingleChannelColor(float value, RgbaChannel channel) { int i = (int)(value * 255.0f); i = Math.Max(Math.Min(i, 255), 0); switch (channel) { case RgbaChannel.Alpha: return(Color.FromArgb(i, 0, 0, 0)); case RgbaChannel.Red: return(Color.FromArgb(0, i, 0, 0)); case RgbaChannel.Green: return(Color.FromArgb(0, 0, i, 0)); case RgbaChannel.Blue: return(Color.FromArgb(0, 0, 0, i)); } return(Color.FromArgb(i, i, i, i)); }
public float GetColorChannelNormalized(RgbaChannel channel) { return(m_Color[(int)channel] / 255f); }
public byte GetColorChannel(RgbaChannel channel) { return(m_Color[(int)channel]); }
public float GetColorChannelHdr(RgbaChannel channel) { return(m_ColorHdr[(int)channel]); }
public static Color ModifyChannelByteValue(this Color color, RgbaChannel channel, byte value) { return(ColorUtils.ModifyChannelByteValue(color, channel, value)); }
glTFLoader.Schema.TextureInfo GetSingleChannelTexture(Rhino.DocObjects.Texture texture, RgbaChannel channel, bool invert) { string path = texture.FileReference.FullPath; Bitmap bmp = new Bitmap(path); Bitmap final = new Bitmap(bmp.Width, bmp.Height); for (int i = 0; i < bmp.Width; i++) { for (int j = 0; j < bmp.Height; j++) { Color4f color = new Color4f(bmp.GetPixel(i, j)); float value = color.L; if (invert) { value = 1.0f - value; } Color colorFinal = GetSingleChannelColor(value, channel); final.SetPixel(i, j, colorFinal); } } int textureIndex = GetTextureFromBitmap(final); glTFLoader.Schema.TextureInfo textureInfo = new glTFLoader.Schema.TextureInfo() { Index = textureIndex, TexCoord = 0, }; return(textureInfo); }
public Rhino.Render.RenderTexture GetRenderTextureFromChannel(int textureIndex, RgbaChannel channel) { System.Drawing.Bitmap bmp = GetTextureBitmap(textureIndex, out string name); if (bmp == null) { return(null); } int width = bmp.Width; int height = bmp.Height; System.Drawing.Bitmap resolvedBmp = new System.Drawing.Bitmap(width, height); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { System.Drawing.Color color = bmp.GetPixel(i, j); System.Drawing.Color colorResolved = GetColorFromChannel(color, channel); resolvedBmp.SetPixel(i, j, colorResolved); } } Rhino.Render.RenderTexture renderTexture = Rhino.Render.RenderTexture.NewBitmapTexture(resolvedBmp, doc); renderTexture.BeginChange(Rhino.Render.RenderContent.ChangeContexts.Program); renderTexture.Name = name; renderTexture.EndChange(); return(renderTexture); }
public void SetColorChannel(RgbaChannel channel, float normalizedValue) { SetColorChannel(channel, (byte)Mathf.RoundToInt(Mathf.Clamp01(normalizedValue) * 255f)); }
public static byte GetChannelByteValue(this Color color, RgbaChannel channel) { return(ColorUtils.GetChannelByteValue(color, channel)); }