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)); }
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); }
public void Resize(Dimensions dimensions, Offset offset) { Resize(dimensions.Width, dimensions.Height, offset.X, offset.Y); }
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; }
public Image(Dimensions dimensions, ImageBaseType type) : this(dimensions.Width, dimensions.Height, type) { }
public void Crop(Dimensions dimensions, Offset offset) { Crop(dimensions.Width, dimensions.Height, offset.X, offset.Y); }
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; }
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); }
public void Constructor() { var dimensions = new Dimensions(13, 14); Assert.AreEqual(13, dimensions.Width); Assert.AreEqual(14, dimensions.Height); }
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)); }
public void Resize(Dimensions dimensions) { Resize(dimensions.Width, dimensions.Height); }
public void Scale(Dimensions dimensions, bool localOrigin, InterpolationType interpolation) { Scale(dimensions.Width, dimensions.Height, localOrigin, interpolation); }
public void Scale(Dimensions dimensions, bool localOrigin) { Scale(dimensions.Width, dimensions.Height, localOrigin); }
public void Inside() { var dimensions = new Dimensions(13, 14); Assert.IsTrue(dimensions.IsInside(5, 6)); }
public void Scale(Dimensions dimensions) { Scale(dimensions.Width, dimensions.Height); }
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; }
public void Scale(Dimensions dimensions, InterpolationType interpolation) { Scale(dimensions.Width, dimensions.Height, interpolation); }