Example #1
0
        public ImageKit Layer(Image source, int offsetX, int offsetY, int width, int height, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
        {
            var ik = new ImageKit(source);

            if (ik.Width > width)
            {
                ik.CropHorizontal(horizontalAlignment, width);
            }

            if (ik.Height > height)
            {
                ik.CropVertical(verticalAlignment, height);
            }

            var x = 0;
            var y = 0;

            switch (horizontalAlignment)
            {
            case HorizontalAlignment.Left:
                x = 0;
                break;

            case HorizontalAlignment.Center:
                x = (width - ik.Width) / 2;
                break;

            case HorizontalAlignment.Right:
                x = width - ik.Width;
                break;
            }

            switch (verticalAlignment)
            {
            case VerticalAlignment.Top:
                y = 0;
                break;

            case VerticalAlignment.Middle:
                y = (height - ik.Height) / 2;
                break;

            case VerticalAlignment.Bottom:
                y = height - ik.Height;
                break;
            }

            Layer(ik, offsetX + x, offsetY + y);

            return(this);
        }
Example #2
0
 public ImageKit Layer(ImageKit source, int offsetX, int offsetY, int width, int height, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
 {
     return(Layer(source.Image, offsetX, offsetY, width, height, horizontalAlignment, verticalAlignment));
 }
Example #3
0
 public ImageKit LayerCentered(ImageKit source, int offsetX, int offsetY)
 {
     return(LayerCentered(source.Image, offsetX, offsetY));
 }
Example #4
0
 /// <summary>
 /// The Image used with the kit will be disposed of upon the completion of most operations.
 /// </summary>
 /// <param name="imageKit"></param>
 public ImageKit(ImageKit imageKit)
 {
     this.Image = imageKit.Image;
 }
Example #5
0
 public ImageKit LayerCentered(ImageKit source)
 {
     return(LayerCentered(source.Image));
 }
Example #6
0
 public ImageKit Layer(ImageKit source)
 {
     return(Layer(source.Image));
 }
Example #7
0
 public ImageKit Layer(ImageKit source, int x, int y)
 {
     return(Layer(source.Image, x, y));
 }