示例#1
0
 public void ForegroundColor()
 {
     var grid = _image.Grid;
       RGB color = new RGB(11, 22, 33);
       grid.ForegroundColor = color;
       Assert.AreEqual(color, grid.ForegroundColor);
 }
示例#2
0
 public void AddOperator()
 {
     double red = 0.13;
       double green = 0.24;
       double blue = 0.35;
       RGB rgb = new RGB(red, green, blue);
       RGB result = rgb + new RGB(0, 0, 0);
       Assert.AreEqual(rgb, result);
 }
示例#3
0
 public void Alpha()
 {
     double red = 0.13;
       double green = 0.24;
       double blue = 0.35;
       RGB rgb = new RGB(red, green, blue);
       rgb.Alpha = 0.5;
       Assert.AreEqual(0.5, rgb.Alpha);
 }
示例#4
0
 public void Add()
 {
     double red = 0.13;
       double green = 0.24;
       double blue = 0.35;
       RGB rgb = new RGB(red, green, blue);
       rgb.Add(new RGB(0, 0, 0));
       Assert.AreEqual(new RGB(red, green, blue), rgb);
 }
示例#5
0
        public void Bytes()
        {
            byte red = 13;
              byte green = 24;
              byte blue = 35;
              RGB rgb = new RGB(red, green, blue);

              byte[] bytes = rgb.Bytes;
              Assert.AreEqual(new byte[]{red, green, blue}, bytes);
        }
示例#6
0
 public void Background()
 {
     RGB background = new RGB(11, 12, 13);
       Context.Background = background;
       RGB result = Context.Background;
       Assert.AreEqual(background.R, result.R);
       Assert.AreEqual(background.G, result.G);
       Assert.AreEqual(background.B, result.B);
       // Fix me: why doesn't Assert.AreEqual(background, result) just work?
 }
示例#7
0
        public void CombineMasks()
        {
            RGB color = new RGB(0, 255, 0);
              var channelOne = new Channel(_image, "one", color);
              var channelTwo = new Channel(_image, "two", color);

              _image.AddChannel(channelOne, 0);
              _image.AddChannel(channelTwo, 0);

              channelOne.CombineMasks(channelTwo, ChannelOps.Add, 0, 0);
        }
        public void Select(RGB color, int threshold, ChannelOps operation, 
		       bool antialias, bool feather, double featherRadius,
		       bool sampleMerged)
        {
            var rgb = color.GimpRGB;
              if (!gimp_by_color_select(_drawableID, ref rgb, threshold, operation,
                antialias, feather, featherRadius,
                sampleMerged))
            {
              throw new GimpSharpException();
            }
        }
示例#9
0
        public void PutGetPixel()
        {
            // Fill with some color
              var foreground = new RGB(22, 55, 77);
              Context.Push();
              Context.Foreground = foreground;
              _drawable.Fill(FillType.Foreground);
              Context.Pop();

              var expected = new Pixel(33, 66, 99);

              // Fill with different color, using shadow
              using (var pf = new PixelFetcher(_drawable, true))
            {
              for (int y = 0; y < _height; y++)
            {
              for (int x = 0; x < _width; x++)
            {
              pf[y, x] = expected;
            }
            }
            }

              // check that original hasn't changed
              using (var pf = new PixelFetcher(_drawable, false))
            {
              for (int y = 0; y < _height; y++)
            {
              for (int x = 0; x < _width; x++)
            {
              Assert.AreEqual(foreground, pf[y, x].Color);
            }
            }
            }

              _drawable.MergeShadow(true);

              // and now the orginal should be changed
              using (var pf = new PixelFetcher(_drawable, false))
            {
              for (int y = 0; y < _height; y++)
            {
              for (int x = 0; x < _width; x++)
            {
              Assert.IsTrue(expected.IsSameColor(pf[y, x]));
            }
            }
            }
        }
示例#10
0
        public void Fill()
        {
            // Fill with some color
              RGB foreground = new RGB(22, 55, 77);
              Context.Push();
              Context.Foreground = foreground;
              _drawable.Fill(FillType.Foreground);
              Context.Pop();

              using (PixelFetcher pf = new PixelFetcher(_drawable, false))
            {
              Pixel pixel = pf[_height / 2, _width / 2];
              Assert.AreEqual(foreground, pixel.Color);
            }
        }
示例#11
0
 public void SegmentSetRightColor(int segment, RGB color, double opacity)
 {
     var rgb = color.GimpRGB;
       if (!gimp_gradient_segment_set_right_color(Name, segment, ref rgb,
                  opacity))
     {
       throw new GimpSharpException();
     }
 }
示例#12
0
        public void SetUChar()
        {
            RGB rgb = new RGB(0, 0, 0);

              byte red = 13;
              byte green = 24;
              byte blue = 35;

              rgb.SetUchar(red, green, blue);

              byte r, g, b;
              rgb.GetUchar(out r, out g, out b);
              Assert.AreEqual(red, r);
              Assert.AreEqual(green, g);
              Assert.AreEqual(blue, b);
        }
示例#13
0
 public double Distance(RGB rgb)
 {
     return gimp_rgb_distance(ref _rgb, ref rgb._rgb);
 }
示例#14
0
        public static RGB Interpolate(double value, RGB rgb1, RGB rgb2)
        {
            double r = rgb1.R + value * (rgb2.R - rgb1.R);
              double g = rgb1.G + value * (rgb2.G - rgb1.G);
              double b = rgb1.B + value * (rgb2.B - rgb1.B);

              return new RGB(r, g, b);
        }
示例#15
0
 public static RGB operator +(RGB rgb1, RGB rgb2)
 {
     RGB result = new RGB(rgb1);
       result.Add(rgb2);
       return result;
 }
示例#16
0
 public PaletteEntry AddEntry(string entryName, RGB color)
 {
     GimpRGB rgb = color.GimpRGB;
       int entryNum;
       if (!gimp_palette_add_entry(Name, entryName, ref rgb,
                           out entryNum))
     {
       throw new GimpSharpException();
     }
       return new PaletteEntry(this, entryNum);
 }
示例#17
0
 public void Foreground()
 {
     RGB foreground = new RGB(11, 12, 13);
       Context.Foreground = foreground;
       RGB result = Context.Foreground;
       Assert.AreEqual(foreground.R, result.R);
       Assert.AreEqual(foreground.G, result.G);
       Assert.AreEqual(foreground.B, result.B);
       // Fix me: why doesn't Assert.AreEqual(foreground, result) just work?
       // Answer: because of the undefined alpha channel
 }
示例#18
0
        public void ParseInvalidCss()
        {
            RGB rgb = new RGB(0, 0, 0);

            rgb.ParseCss("#nonsense");
        }
示例#19
0
        public void ClampNothing()
        {
            double red = 0.13;
              double green = 0.24;
              double blue = 0.35;

              RGB rgb = new RGB(red, green, blue);
              rgb.Clamp();
              Assert.AreEqual(new RGB(red, green, blue), rgb);
        }
示例#20
0
 public void ParseName()
 {
     RGB rgb = new RGB(0, 0, 0);
       rgb.ParseName("blue");
       Assert.AreEqual(new RGB(0, 0, 255), rgb);
 }
示例#21
0
 public static RGB operator *(RGB rgb, double factor)
 {
     RGB result = new RGB(rgb);
       result.Multiply(factor);
       return result;
 }
示例#22
0
 public RGB(RGB rgb)
     : this(rgb.R, rgb.G, rgb.B)
 {
 }
示例#23
0
 public static RGB operator +(RGB rgb, double v)
 {
     RGB result = new RGB(rgb);
       result.R += v;
       result.G += v;
       result.B += v;
       return result;
 }
示例#24
0
        public void ParseInvalidHex()
        {
            RGB rgb = new RGB(0, 0, 0);

            rgb.ParseHex("#nonsense");
        }
示例#25
0
 public static RGB operator -(RGB rgb1, RGB rgb2)
 {
     RGB result = new RGB(rgb1);
       result.Subtract(rgb2);
       return result;
 }
示例#26
0
 public Channel(Image image, string name, int width, int height,
     double opacity, RGB color)
     : this(image, name, width, height, opacity, color.GimpRGB)
 {
 }
示例#27
0
 public void Add(RGB rgb)
 {
     gimp_rgb_add(ref _rgb, ref rgb._rgb);
 }
示例#28
0
 public Channel(Image image, string name, RGB color)
     : this(image, name, image.Width, image.Height, 100, color.GimpRGB)
 {
 }
示例#29
0
 public void Subtract(RGB rgb)
 {
     gimp_rgb_subtract(ref _rgb, ref rgb._rgb);
 }
示例#30
0
 public void Subtract()
 {
     double red = 0.13;
       double green = 0.24;
       double blue = 0.35;
       RGB rgb = new RGB(red, green, blue);
       RGB tmp = new RGB(red, green, blue);
       rgb.Subtract(new RGB(0, 0, 0));
       Assert.AreEqual(tmp, rgb);
 }
示例#31
0
 public GimpColorButton(string title, int width, int height,
     RGB color, ColorAreaType type)
     : this(title, width, height, color.GimpRGB, type)
 {
 }
示例#32
0
 public byte[] GetColorUchar(RGB color)
 {
     var colorUchar = new byte[_bpp];
       var rgb = color.GimpRGB;
       gimp_drawable_get_color_uchar(ID, ref rgb, colorUchar);
       return colorUchar;
 }