Exemple #1
0
 /// <summary>
 /// Constructs a new Selection.
 /// </summary>
 /// <param name="pixels">The IPixels from which
 /// pixels should be selected.</param>
 /// <param name="rect">The Rectangle of pixels to use.</param>
 public Selection(IPixels pixels, PixRect rect)
 {
     this.pixels = pixels;
     this.rect = rect;
 }
 /// <summary>
 /// Crops this ManipulableImage to the specified Rectangle.
 /// </summary>
 /// <param name="rect">The Rectangle to crop to.</param>
 /// <param name="pixels">The new array that will be used to store
 /// this ManipulableImage's pixels.</param>
 public void Crop(PixRect rect, int[] pixels)
 {
     for (int row = rect.Row; row < rect.Row + rect.Height; row++)
     {
         Buffer.BlockCopy(
             Pixels, sizeof(int) * (row * Width + rect.Col),
             pixels, sizeof(int) * (row - rect.Row) * rect.Width,
             sizeof(int) * rect.Width);
     }
     this.pixels = new PixelsArray(rect.Height, rect.Width, pixels);
 }
Exemple #3
0
 /// <summary>
 /// Draws a filled rectangle.
 /// </summary>
 /// <param name="pixels">The IPixels to draw on.</param>
 /// <param name="rect">The rectangle to draw.</param>
 /// <param name="rgb">The color to use.</param>
 public static void FillRect(IPixels pixels, PixRect rect, int rgb)
 {
     Selection selection = new Selection(pixels, rect);
     Shaders.Apply(selection, Shaders.SolidColor(rgb));
 }
 /// <summary>
 /// Crops this ManipulableImage to the specified Rectangle.
 /// </summary>
 /// <param name="rect">The Rectangle to crop to.</param>
 public virtual void Crop(PixRect rect)
 {
     Crop(rect, new int[rect.Height * rect.Width]);
 }