Пример #1
0
        public void Equals()
        {
            var dimensions1 = new Dimensions(13, 14);
              var dimensions2 = new Dimensions(23, 24);
              var dimensions3 = new Dimensions(13, 14);

              Assert.IsTrue(dimensions1.Equals(dimensions3));
              Assert.IsFalse(dimensions1.Equals(dimensions2));
        }
Пример #2
0
        public void Operators()
        {
            var dimensions1 = new Dimensions(13, 14);
              var dimensions2 = new Dimensions(23, 24);
              var dimensions3 = new Dimensions(13, 14);

              Assert.IsTrue(dimensions1 == dimensions3);
              Assert.IsFalse(dimensions1 == dimensions2);

              Assert.IsFalse(dimensions1 != dimensions3);
              Assert.IsTrue(dimensions1 != dimensions2);
        }
Пример #3
0
 public void Resize(Dimensions dimensions, Offset offset)
 {
     Resize(dimensions.Width, dimensions.Height, offset.X, offset.Y);
 }
Пример #4
0
        public Pixel[,] GetThumbnail(Dimensions dimensions, Transparency alpha)
        {
            IntPtr src = gimp_image_get_thumbnail(ID, dimensions.Width,
                        dimensions.Height, alpha);
              var pixbuf = new Pixbuf(src);

              int bpp = ActiveDrawable.Bpp;
              var thumbnail = Pixel.ConvertToPixelArray(pixbuf.Pixels, dimensions, bpp);
              // Marshaller.Free(src);
              return thumbnail;
        }
Пример #5
0
 public Image(Dimensions dimensions, ImageBaseType type)
     : this(dimensions.Width, dimensions.Height, type)
 {
 }
Пример #6
0
 public void Crop(Dimensions dimensions, Offset offset)
 {
     Crop(dimensions.Width, dimensions.Height, offset.X, offset.Y);
 }
Пример #7
0
        internal static Pixel[,] ConvertToPixelArray(IntPtr src, 
            Dimensions dimensions,
            int bpp)
        {
            int width = dimensions.Width;
              int height = dimensions.Height;
              var dest = new byte[width * height * bpp];
              Marshal.Copy(src, dest, 0, width * height * bpp);

              var thumbnail = new Pixel[height, width];

              int index = 0;
              for (int y = 0; y < height; y++)
            {
              for (int x = 0; x < width; x++)
            {
              var pixel = new Pixel(bpp);
              pixel.CopyFrom(dest, index);
              index += bpp;
              thumbnail[y, x] = pixel;
            }
            }
              return thumbnail;
        }
Пример #8
0
 public void GetThumbnailData()
 {
     var dimensions = new Dimensions(16, 32);
       var thumbnail = _drawable.GetThumbnailData(dimensions);
       Assert.AreEqual(32, thumbnail.GetLength(0));
       Assert.AreEqual(16, thumbnail.GetLength(1));
       Assert.AreEqual(_drawable.Bpp, thumbnail[0, 0].Bpp);
 }
Пример #9
0
 public void Constructor()
 {
     var dimensions = new Dimensions(13, 14);
       Assert.AreEqual(13, dimensions.Width);
       Assert.AreEqual(14, dimensions.Height);
 }
Пример #10
0
 public void GetThumbnail()
 {
     var layer = new Layer(_image, "test", ImageType.Rgb);
       _image.InsertLayer(layer, 0);
       var dimensions = new Dimensions(19, 23);
       var thumbnail = _image.GetThumbnail(dimensions, Transparency.KeepAlpha);
       int width = thumbnail.GetLength(1);
       int height = thumbnail.GetLength(0);
       Assert.AreEqual(dimensions, new Dimensions(width, height));
 }
Пример #11
0
 public void Resize(Dimensions dimensions)
 {
     Resize(dimensions.Width, dimensions.Height);
 }
Пример #12
0
 public void Scale(Dimensions dimensions, bool localOrigin,
     InterpolationType interpolation)
 {
     Scale(dimensions.Width, dimensions.Height, localOrigin, interpolation);
 }
Пример #13
0
 public void Scale(Dimensions dimensions, bool localOrigin)
 {
     Scale(dimensions.Width, dimensions.Height, localOrigin);
 }
Пример #14
0
 public void Inside()
 {
     var dimensions = new Dimensions(13, 14);
       Assert.IsTrue(dimensions.IsInside(5, 6));
 }
Пример #15
0
 public void Scale(Dimensions dimensions)
 {
     Scale(dimensions.Width, dimensions.Height);
 }
Пример #16
0
        public Pixel[,] GetThumbnailData(Rectangle rectangle,
            Dimensions dimensions)
        {
            int width = dimensions.Width;
              int height = dimensions.Height;
              int bpp;

              IntPtr src = gimp_drawable_get_sub_thumbnail_data(ID, rectangle.X1,
                            rectangle.Y1,
                            rectangle.Width,
                            rectangle.Height,
                            ref width, ref height,
                            out bpp);
              var thumbnail =
            Pixel.ConvertToPixelArray(src, new Dimensions(width, height), bpp);
              Marshaller.Free(src);

              return thumbnail;
        }
Пример #17
0
 public void Scale(Dimensions dimensions, InterpolationType interpolation)
 {
     Scale(dimensions.Width, dimensions.Height, interpolation);
 }
Пример #18
0
 public void Resize(Dimensions dimensions)
 {
     Resize(dimensions.Width, dimensions.Height);
 }