예제 #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);
 }