public HLSRGB(HLSRGB hlsrgb)
 {
     this.red = hlsrgb.Red;
     this.blue = hlsrgb.Blue;
     this.green = hlsrgb.Green;
     this.luminance = hlsrgb.Luminance;
     this.hue = hlsrgb.Hue;
     this.saturation = hlsrgb.Saturation;
 }
Example #2
0
 public HLSRGB(HLSRGB hlsrgb)
 {
     mRed        = hlsrgb.Red;
     mBlue       = hlsrgb.Blue;
     mGreen      = hlsrgb.Green;
     mLuminance  = hlsrgb.Luminance;
     mHue        = hlsrgb.Hue;
     mSaturation = hlsrgb.Saturation;
 }
 public HLSRGB(HLSRGB hlsrgb)
 {
     this.red        = hlsrgb.Red;
     this.blue       = hlsrgb.Blue;
     this.green      = hlsrgb.Green;
     this.luminance  = hlsrgb.Luminance;
     this.hue        = hlsrgb.Hue;
     this.saturation = hlsrgb.Saturation;
 }
Example #4
0
        private void CreateColorsCache()
        {
            HLSRGB hls = new HLSRGB(0.0, 0.5, 1.0);

            colors = new Color[360];
            for (hls.Hue = 0; hls.Hue < 360; hls.Hue++)
            {
                colors[(int)hls.Hue] = hls.Color;
            }
        }
        public static void Colorize(Bitmap image, Color targetColor)
        {
            HLSRGB target = new HLSRGB(targetColor);

            // iterate through each pixel in the image and set it's hue to match what we want
            for (int j = 0; j < image.Height; j++) {
                for (int i = 0; i < image.Width; i++) {
                    Color originalColor = image.GetPixel(i, j);
                    HLSRGB pixel = new HLSRGB(originalColor);
                    pixel.Hue = target.Hue;
                    pixel.Saturation = target.Saturation;
                    image.SetPixel(i, j, Color.FromArgb(originalColor.A, pixel.Color));
                }
            }
        }
        public static void Colorize(Bitmap image, Color targetColor)
        {
            HLSRGB target = new HLSRGB(targetColor);

            // iterate through each pixel in the image and set it's hue to match what we want
            for (int j = 0; j < image.Height; j++)
            {
                for (int i = 0; i < image.Width; i++)
                {
                    Color  originalColor = image.GetPixel(i, j);
                    HLSRGB pixel         = new HLSRGB(originalColor);
                    pixel.Hue        = target.Hue;
                    pixel.Saturation = target.Saturation;
                    image.SetPixel(i, j, Color.FromArgb(originalColor.A, pixel.Color));
                }
            }
        }
Example #7
0
        private void DrawFluidColor(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            for (int y = 0; y < fluid.size; y++)
            {
                for (int x = 0; x < fluid.size; x++)
                {
                    double d   = fluid.density[fluid.Ix(x, y, z)];
                    HLSRGB hls = new HLSRGB(360.0 * Math.Min(1.0, d),
                                            Math.Min(1.0, d),
                                            1.0)
                    {
                        //Hue = 360.0 * Math.Sqrt(Math.Pow(fluid.Vx[ix], 2) + Math.Pow(fluid.Vy[ix], 2)),
                        Alpha = (int)(255 * d * 4)
                    };
                    using SolidBrush b = new SolidBrush(hls.Color);
                    g.FillRectangle(b, x * zoom, y * zoom, zoom, zoom);
                }
            }
        }