Пример #1
0
 public FlipDocumentFunction(string historyName, ImageResource image, FlipType flipType)
     : base(ActionFlags.None)
 {
     this.historyName = historyName;
     this.undoImage   = image;
     this.flipType    = flipType;
 }
Пример #2
0
 public FlipDocumentFunction(string historyName, ImageResource image, FlipType flipType)
     : base(ActionFlags.None)
 {
     this.historyName = historyName;
     this.undoImage = image;
     this.flipType = flipType;
 }
Пример #3
0
 public FlipLayerHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace, int layerIndex, FlipType flipType)
     : base(name, image)
 {
     this.historyWorkspace = historyWorkspace;
     this.layerIndex = layerIndex;
     this.flipType = flipType;
 }
Пример #4
0
        /// <summary>
        /// Flips an image by the given instructions.
        /// </summary>
        /// <typeparam name="TColor">The pixel format.</typeparam>
        /// <param name="source">The image to rotate, flip, or both.</param>
        /// <param name="flipType">The <see cref="FlipType"/> to perform the flip.</param>
        /// <returns>The <see cref="Image"/></returns>
        public static Image <TColor> Flip <TColor>(this Image <TColor> source, FlipType flipType)
            where TColor : struct, IPackedPixel, IEquatable <TColor>
        {
            FlipProcessor <TColor> processor = new FlipProcessor <TColor>(flipType);

            return(source.Apply(source.Bounds, processor));
        }
Пример #5
0
        public void ImageShouldFlip(RotateType rotateType, FlipType flipType, ushort orientation)
        {
            string path = CreateOutputDirectory("AutoOrient");

            string file = TestImages.Bmp.F;

            using (FileStream stream = File.OpenRead(file))
            {
                string filename = Path.GetFileNameWithoutExtension(file) + "-" + orientation + Path.GetExtension(file);

                Image image = new Image(stream);
                image.ExifProfile = new ExifProfile();
                image.ExifProfile.SetValue(ExifTag.Orientation, orientation);

                using (FileStream before = File.OpenWrite($"{path}/before-{filename}"))
                {
                    using (FileStream after = File.OpenWrite($"{path}/after-{filename}"))
                    {
                        image.RotateFlip(rotateType, flipType)
                        .Save(before)
                        .AutoOrient()
                        .Save(after);
                    }
                }
            }
        }
Пример #6
0
        private Point FlipTransform(Point point, FlipType flipType, double maxX, double maxY)
        {
            switch (flipType)
            {
            case FlipType.Horizontal:
                point.X = maxX - point.X;
                break;

            case FlipType.Vertical:
                point.Y = maxY - point.Y;
                break;

            case FlipType.HorizontalVertical:
                point.X = maxX - point.X;
                point.Y = maxY - point.Y;
                break;

            case FlipType.None:
                break;     //Do nothing

            default:
                throw new NotImplementedException($"Flipping for {nameof(FlipType)}.{flipType} not implemented.");
            }

            return(point);
        }
Пример #7
0
 public FlipLayerFunction(FlipType flipType, int layerIndex) : base(ActionFlags.None)
 {
     this.historyMementoName  = GetHistoryMementoName(flipType);
     this.historyMementoImage = GetHistoryMementoImage(flipType);
     this.flipType            = flipType;
     this.layerIndex          = layerIndex;
 }
Пример #8
0
        public void Flip_degreesFloat_RotateProcessorWithAnglesSetAndExpandTrue(FlipType flip)
        {
            this.operations.Flip(flip);
            var flipProcessor = this.Verify <FlipProcessor <Rgba32> >();

            Assert.Equal(flip, flipProcessor.FlipType);
        }
Пример #9
0
        public Sprite(
            string Name,
            Vector2 location,
            Texture2D texture,
            Rectangle initialFrame,
            Vector2 velocity,
            BodyType bodytype,
            bool AddFixture
            ) // True
        {
            this.location = location;
            Texture       = texture;

            this.name = Name;
            this.dead = false;

            frames.Add(initialFrame);
            frameWidth  = initialFrame.Width;
            frameHeight = initialFrame.Height;
            origin      = new Vector2(frameWidth / 2, frameHeight / 2);

            tag = null;

            body                 = BodyFactory.CreateBody(GameWorld.world);
            body.BodyType        = bodytype;
            body.SleepingAllowed = false;
            //body.UserData = this; // NO!!!!

            spriteEffects = new SpriteEffects();
            flipType      = new FlipType();
            flipType      = FlipType.NONE;


            body.Restitution = .2f;
            body.Mass        = 100;
            body.Friction    = 10;
            //body.LinearDamping = 2.4f;
            //body.AngularDamping = 6.4f;

            /*body.Rotation = 1.3f;
             * //            box.AngularVelocity = 0.1f;
             * body.Inertia = 25.5f;
             */
            this.Fade     = false;
            this.Location = location;
            //            body.Position = ConvertUnits.ToSimUnits(this.Location);
            body.IgnoreGravity = false;

            if (AddFixture)
            {
                bodyfixture             = FixtureFactory.AttachRectangle(ConvertUnits.ToSimUnits(initialFrame.Width), ConvertUnits.ToSimUnits(initialFrame.Height), 10, Vector2.Zero, body);
                bodyfixture.Restitution = .5f;
                bodyfixture.Friction    = 1;

                bodyfixture.OnCollision += new OnCollisionEventHandler(HandleCollision);
                PhysicsBodyFixture       = bodyfixture;
            }

            this.Velocity = ConvertUnits.ToSimUnits(velocity);
        }
Пример #10
0
        public virtual Image Flip(FlipType type)
        {
            var result = new Bitmap(Image);

            switch (type)
            {
            case FlipType.Horizontal:
            {
                result.RotateFlip(RotateFlipType.RotateNoneFlipX);
                break;
            }

            case FlipType.Vertical:
            {
                result.RotateFlip(RotateFlipType.RotateNoneFlipY);
                break;
            }

            case FlipType.Both:
            {
                result.RotateFlip(RotateFlipType.RotateNoneFlipXY);
                break;
            }
            }

            return(result);
        }
Пример #11
0
        public FluentImage In(FlipType flipType)
        {
            var flip = (flipType == FlipType.Horizontal) ? RotateFlipType.RotateNoneFlipX : RotateFlipType.RotateNoneFlipY;

            this.builder.Image.RotateFlip(flip);
            return(this.builder);
        }
Пример #12
0
 public FlipLayerHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace, int layerIndex, FlipType flipType)
     : base(name, image)
 {
     this.historyWorkspace = historyWorkspace;
     this.layerIndex       = layerIndex;
     this.flipType         = flipType;
 }
Пример #13
0
        private void Flip(FlipType flipType)
        {
            if (DraggedTiles != null)
            {
                Defloat(DraggedTiles);
            }
            if (overlay.SelectTS.Empty)
            {
                return;
            }
            int        x_     = overlay.SelectTS.Location.X / 16;
            int        y_     = overlay.SelectTS.Location.Y / 16;
            CopyBuffer buffer = new CopyBuffer(overlay.SelectTS.Width, overlay.SelectTS.Height);

            Tile[] copiedTiles = new Tile[(overlay.SelectTS.Width / 16) * (overlay.SelectTS.Height / 16)];
            for (int y = 0; y < overlay.SelectTS.Height / 16; y++)
            {
                for (int x = 0; x < overlay.SelectTS.Width / 16; x++)
                {
                    copiedTiles[y * (overlay.SelectTS.Width / 16) + x] =
                        Tileset.Tilesets_tiles[Layer][(y + y_) * 16 + x + x_].Copy();
                }
            }
            if (flipType == FlipType.Horizontal)
            {
                Do.FlipHorizontal(copiedTiles, overlay.SelectTS.Width / 16, overlay.SelectTS.Height / 16);
            }
            else if (flipType == FlipType.Vertical)
            {
                Do.FlipVertical(copiedTiles, overlay.SelectTS.Width / 16, overlay.SelectTS.Height / 16);
            }
            buffer.Tiles = copiedTiles;
            Defloat(buffer);
        }
Пример #14
0
        public static BitmapHolder ToFlipped(BitmapHolder bmp, FlipType flipMode)
        {
            int          width        = bmp.Width;
            int          height       = bmp.Height;
            int          num          = 0;
            BitmapHolder bitmapHolder = new BitmapHolder(new byte[bmp.PixelData.Length], width, height);

            if (flipMode == FlipType.Vertical)
            {
                byte[] pixelData = bitmapHolder.PixelData;
                for (int num2 = height - 1; num2 >= 0; num2--)
                {
                    for (int i = 0; i < width; i++)
                    {
                        int pos = num2 * width + i;
                        bitmapHolder.SetPixel(num, bmp.GetPixel(pos));
                        num++;
                    }
                }
            }
            else
            {
                byte[] pixelData2 = bitmapHolder.PixelData;
                for (int j = 0; j < height; j++)
                {
                    for (int num3 = width - 1; num3 >= 0; num3--)
                    {
                        int pos2 = j * width + num3;
                        bitmapHolder.SetPixel(num, bmp.GetPixel(pos2));
                        num++;
                    }
                }
            }
            return(bitmapHolder);
        }
Пример #15
0
        /// <summary>
        /// Flips an image by the given instructions.
        /// </summary>
        /// <typeparam name="TPixel">The pixel format.</typeparam>
        /// <param name="source">The image to rotate, flip, or both.</param>
        /// <param name="flipType">The <see cref="FlipType"/> to perform the flip.</param>
        /// <returns>The <see cref="Image{TPixel}"/></returns>
        public static Image <TPixel> Flip <TPixel>(this Image <TPixel> source, FlipType flipType)
            where TPixel : struct, IPixel <TPixel>
        {
            FlipProcessor <TPixel> processor = new FlipProcessor <TPixel>(flipType);

            source.ApplyProcessor(processor, source.Bounds);
            return(source);
        }
Пример #16
0
 public FlipLayerFunction(string historyName, ImageResource image, FlipType flipType, int layerIndex)
     : base(ActionFlags.None)
 {
     this.historyName = historyName;
     this.flipType = flipType;
     this.undoImage = image;
     this.layerIndex = layerIndex;
 }
        private void ExecuteFlipAction()
        {
            CreateSnapshot();
            FlipType flipType = EnumUtil.ParseEnum <FlipType>(_paintForm.FlipType);

            _currentCanvas.Flip(flipType);
            _paintForm.UpdateCanvas(_currentCanvas.Bitmap);
        }
Пример #18
0
 public FlipLayerFunction(string historyName, ImageResource image, FlipType flipType, int layerIndex)
     : base(ActionFlags.None)
 {
     this.historyName = historyName;
     this.flipType    = flipType;
     this.undoImage   = image;
     this.layerIndex  = layerIndex;
 }
Пример #19
0
 public void ImageShouldFlip <TPixel>(TestImageProvider <TPixel> provider, FlipType flipType)
     where TPixel : struct, IPixel <TPixel>
 {
     using (Image <TPixel> image = provider.GetImage())
     {
         image.Mutate(x => x.Flip(flipType));
         image.DebugSave(provider, flipType, Extensions.Bmp);
     }
 }
Пример #20
0
 public AutoRotateContext(
     bool mirror,
     FlipType flipType,
     FlipState flipState)
 {
     Mirror    = mirror;
     FlipType  = flipType;
     FlipState = flipState;
 }
Пример #21
0
        public void RotateDegreesFloatRotateProcessorWithAnglesSet(RotateType angle, FlipType flip, float expectedAngle)
        {
            this.operations.RotateFlip(angle, flip);
            RotateProcessor <Rgba32> rotateProcessor = this.Verify <RotateProcessor <Rgba32> >(0);
            FlipProcessor <Rgba32>   flipProcessor   = this.Verify <FlipProcessor <Rgba32> >(1);

            Assert.Equal(expectedAngle, rotateProcessor.Degrees);
            Assert.Equal(flip, flipProcessor.FlipType);
        }
Пример #22
0
        public ComponentPoint Flip(FlipType type, FlipState flipState)
        {
            if (type == FlipType.None)
            {
                return(this);
            }

            var returnPoint = new ComponentPoint(RelativeToX, RelativeToY, Offset);

            if (type == FlipType.Horizontal)
            {
                returnPoint.Offset = new Vector(-Offset.X, Offset.Y);
            }
            else if (type == FlipType.Vertical)
            {
                returnPoint.Offset = new Vector(Offset.X, -Offset.Y);
            }
            else if (type == FlipType.Both)
            {
                returnPoint.Offset = new Vector(-Offset.X, -Offset.Y);
            }

            if (flipState == FlipState.Secondary)
            {
                return(returnPoint);
            }

            if (RelativeToX == ComponentPosition.Start)
            {
                returnPoint.RelativeToX = ComponentPosition.End;
            }
            else if (RelativeToX == ComponentPosition.Middle)
            {
                returnPoint.RelativeToX = ComponentPosition.Middle;
            }
            else if (RelativeToX == ComponentPosition.End)
            {
                returnPoint.RelativeToX = ComponentPosition.Start;
            }

            if (RelativeToY == ComponentPosition.Start)
            {
                returnPoint.RelativeToY = ComponentPosition.End;
            }
            else if (RelativeToY == ComponentPosition.Middle)
            {
                returnPoint.RelativeToY = ComponentPosition.Middle;
            }
            else if (RelativeToY == ComponentPosition.End)
            {
                returnPoint.RelativeToY = ComponentPosition.Start;
            }

            return(returnPoint);
        }
Пример #23
0
 public MvcHtmlString Flip(FlipType type)
 {
     if (_isOriginal)
     {
         return(new MvcHtmlString(_underlying.Src + "?flip=" + type.ToString().ToLower()));
     }
     else
     {
         return(new MvcHtmlString(_underlying.Src + _underlying.GetCropUrl(_alias, useFocalPoint: _underlying.HasFocalPoint()) + "&flip=" + type.ToString().ToLower()));
     }
 }
Пример #24
0
        private void FlipDocumentProcess(object[] processArgs)
        {
            FlipType flip = (FlipType)processArgs[0];

            foreach (var layer in Layers)
            {
                using (new SKAutoCanvasRestore(layer.LayerBitmap.SkiaSurface.Canvas, true))
                {
                    var copy = layer.LayerBitmap.SkiaSurface.Snapshot();

                    var canvas = layer.LayerBitmap.SkiaSurface.Canvas;

                    layer.ClipCanvas();

                    if (flip == FlipType.Horizontal)
                    {
                        canvas.Translate(layer.Width, 0);
                        canvas.Scale(-1, 1, 0, 0);
                    }
                    else
                    {
                        canvas.Translate(0, layer.Width);
                        canvas.Scale(1, -1, 0, 0);
                    }

                    // Flip offset based on document and layer center point
                    var documentCenter = new Coordinates(Width / 2, Height / 2);
                    var layerCenter    = new Coordinates(layer.Width / 2, layer.Height / 2);

                    int newOffsetX = layer.OffsetX;
                    int newOffsetY = layer.OffsetY;

                    if (flip == FlipType.Horizontal)
                    {
                        newOffsetX += layerCenter.X;
                        int diff = documentCenter.X - newOffsetX;
                        newOffsetX = layer.OffsetX + (diff * 2);
                    }
                    else if (flip == FlipType.Vertical)
                    {
                        newOffsetY += layerCenter.Y;
                        int diff = documentCenter.Y - newOffsetY;
                        newOffsetY = layer.OffsetY + (diff * 2);
                    }

                    layer.Offset = new Thickness(newOffsetX, newOffsetY, 0, 0);

                    canvas.DrawImage(copy, default(SKPoint));
                    copy.Dispose();
                }

                layer.InvokeLayerBitmapChange();
            }
        }
Пример #25
0
 public byte[] TransformImage(FlipType type, string file)
 {
     var ft = new FlipTransformation(type);
     var transformedImage = ft.TransformFromFile(file);
     byte[] myByteArray;
     using (var imageData = transformedImage.AsJPEG())
     {
         myByteArray = new byte[imageData.Length];
         System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, myByteArray, 0, Convert.ToInt32(imageData.Length));
     }
     return myByteArray;
 }
Пример #26
0
        private void UpdateFlipEnable(FlipType flip)
        {
            switch (flip)
            {
            case FlipType.LeftToRight:
                EnableFlipLeftToRight();
                break;

            case FlipType.RightToLeft:
                EnableFlipRightToLeft();
                break;
            }
        }
Пример #27
0
        public byte[] TransformImage(FlipType type, string file)
        {
            var ft = new FlipTransformation(type);
            var transformedImage = ft.TransformFromFile(file);

            byte[] myByteArray;
            using (var imageData = transformedImage.AsJPEG())
            {
                myByteArray = new byte[imageData.Length];
                System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, myByteArray, 0, Convert.ToInt32(imageData.Length));
            }
            return(myByteArray);
        }
Пример #28
0
        public void FlipActiveDocument(FlipType flip)
        {
            object[] processArgs = { flip };

            FlipDocumentProcess(processArgs);

            UndoManager.AddUndoChange(new Change(
                                          FlipDocumentProcess,
                                          processArgs,
                                          FlipDocumentProcess,
                                          processArgs,
                                          $"Flip layer: {flip}"));
        }
Пример #29
0
        void Mode_Changed(object sender, SelectionChangedEventArgs e)
        {
            FlipType selected = (FlipType)FlipMode.SelectedIndex;

            if (_flip.Mode != selected)
            {
                Program.Project.Undo.AddAndExecute(new Flip.ModeUndoEntry(
                                                       _flip,
                                                       _flip.Mode,
                                                       selected,
                                                       FlipMode.Items
                                                       ));
            }
        }
Пример #30
0
        public static void FlipInnerRect(float sourceWidth, float sourceHeight, ref Rect rect, FlipType flip)
        {
            if (flip == FlipType.Horizontal || flip == FlipType.Both)
            {
                rect.x = sourceWidth - rect.xMax;
                rect.xMax = rect.x + rect.width;
            }

            if (flip == FlipType.Vertical || flip == FlipType.Both)
            {
                rect.y = sourceHeight - rect.yMax;
                rect.yMax = rect.y + rect.height;
            }
        }
Пример #31
0
        public virtual ImageBox Flip(FlipType type)
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException(nameof(ImageBox));
            }

            var result = new Flipper(Image).Flip(type);

            Image.Dispose();
            Image = result;

            return(this);
        }
        public Bitmap Flip(FlipType flipType, Bitmap currentBitmap)
        {
            switch (flipType)
            {
            case FlipType.Horizontal:
                return(_flipControler.FlipHorizontal(currentBitmap));

            case FlipType.VerticalMenuItem:
                return(_flipControler.FlipVertical(currentBitmap));

            default:
                throw new ArgumentOutOfRangeException(nameof(flipType), flipType, null);
            }
        }
Пример #33
0
        public void ImageShouldRotateFlip(RotateType rotateType, FlipType flipType)
        {
            string path = this.CreateOutputDirectory("RotateFlip");

            foreach (TestFile file in Files)
            {
                string filename = file.GetFileName(rotateType + "-" + flipType);
                using (Image image = file.CreateImage())
                    using (FileStream output = File.OpenWrite($"{path}/{filename}"))
                    {
                        image.RotateFlip(rotateType, flipType).Save(output);
                    }
            }
        }
Пример #34
0
        public void ImageShouldFlip(FlipType flipType)
        {
            string path = this.CreateOutputDirectory("Flip");

            foreach (TestFile file in Files)
            {
                string filename = file.GetFileName(flipType);
                using (Image <Rgba32> image = file.CreateImage())
                    using (FileStream output = File.OpenWrite($"{path}/{filename}"))
                    {
                        image.Flip(flipType).Save(output);
                    }
            }
        }
Пример #35
0
        /// <summary>
        /// Flips the mold selection vertically or horizontally.
        /// </summary>
        /// <param name="flipType">The direction to flip the mold selection.</param>
        private void Flip(FlipType flipType)
        {
            if (overlay.Select.Empty)
            {
                return;
            }
            if (tileset.Tiles == null || overlay.Select.Size == new Size(0, 0))
            {
                return;
            }
            Point location = overlay.Select.Location;
            Point terminal = overlay.Select.Terminal;

            byte[] flippedTiles = new byte[(overlay.Select.Width / 16) * (overlay.Select.Height / 16)];
            for (int y = 0, y_ = overlay.Select.Y / 16; y < overlay.Select.Height / 16; y++, y_++)
            {
                for (int x = 0, x_ = overlay.Select.X / 16; x < overlay.Select.Width / 16; x++, x_++)
                {
                    flippedTiles[y * (overlay.Select.Width / 16) + x] = mold.Tiles[y_ * (width / 16) + x_];
                    if (flipType == FlipType.Horizontal && flippedTiles[y * (overlay.Select.Width / 16) + x] != 0xFF)
                    {
                        flippedTiles[y * (overlay.Select.Width / 16) + x] ^= 0x40;
                    }
                    if (flipType == FlipType.Vertical && flippedTiles[y * (overlay.Select.Width / 16) + x] != 0xFF)
                    {
                        flippedTiles[y * (overlay.Select.Width / 16) + x] ^= 0x80;
                    }
                }
            }
            if (flipType == FlipType.Horizontal)
            {
                Do.FlipHorizontal(flippedTiles, overlay.Select.Width / 16, overlay.Select.Height / 16);
            }
            if (flipType == FlipType.Vertical)
            {
                Do.FlipVertical(flippedTiles, overlay.Select.Width / 16, overlay.Select.Height / 16);
            }
            commandStack.Push(new MoldEdit(
                                  mold.Tiles, width / 16, height / 16, flippedTiles,
                                  overlay.Select.X / 16, overlay.Select.Y / 16, overlay.Select.Width / 16, overlay.Select.Height / 16));
            commandStack.Push(1);
            SetTilemapImage();
            if (sequencesForm != null)
            {
                sequencesForm.SetFrameImages();
                sequencesForm.RealignFrames();
            }
            animation.WriteToBuffer();
        }
Пример #36
0
 public static void FlipRect(ref Rect rect, FlipType flip)
 {
     if (flip == FlipType.Horizontal || flip == FlipType.Both)
     {
         float tmp = rect.xMin;
         rect.xMin = rect.xMax;
         rect.xMax = tmp;
     }
     if (flip == FlipType.Vertical || flip == FlipType.Both)
     {
         float tmp = rect.yMin;
         rect.yMin = rect.yMax;
         rect.yMax = tmp;
     }
 }
Пример #37
0
        public static BitmapHolder ToFlipped(BitmapHolder bmp, FlipType flipMode)
        {
            // Use refs for faster access (really important!) speeds up a lot!
            var w = bmp.Width;
            var h = bmp.Height;
            var p = bmp.Pixels;
            var i = 0;
            BitmapHolder result = new BitmapHolder(new int[bmp.Pixels.Length], w, h);

            if (flipMode == FlipType.Vertical)
            {
                var rp = result.Pixels;
                for (var y = h - 1; y >= 0; y--)
                {
                    for (var x = 0; x < w; x++)
                    {
                        var srcInd = y * w + x;
                        rp[i] = p[srcInd];
                        i++;
                    }
                }
            }
            else
            {
                var rp = result.Pixels;
                for (var y = 0; y < h; y++)
                {
                    for (var x = w - 1; x >= 0; x--)
                    {
                        var srcInd = y * w + x;
                        rp[i] = p[srcInd];
                        i++;
                    }
                }
            }

            return result;
        }
Пример #38
0
        /// <summary>
        /// Sets the tiles flipping mode.
        /// </summary>
        /// <param name="direction">The desired direction to flip.</param>
        public void Flip(FlipDirection direction)
        {
            // Set flipping enumeration.
            switch (_flip)
            {
                case FlipType.None:
                    // If flipping horizontally.
                    if (direction == FlipDirection.Horizontal)
                        _flip = FlipType.Horizontal;
                    else
                        _flip = FlipType.Vertical;

                    break;

                case FlipType.Horizontal:
                    // If flipping horizontally.
                    if (direction == FlipDirection.Horizontal)
                        _flip = FlipType.None;
                    else
                        _flip = FlipType.Both;

                    break;

                case FlipType.Vertical:
                    // If flipping horizontally.
                    if (direction == FlipDirection.Horizontal)
                        _flip = FlipType.Both;
                    else
                        _flip = FlipType.None;

                    break;

                case FlipType.Both:
                    // If flipping horizontally.
                    if (direction == FlipDirection.Horizontal)
                        _flip = FlipType.Vertical;
                    else
                        _flip = FlipType.Horizontal;

                    break;
            }
        }
Пример #39
0
 /// <summary>
 /// Construct a Flip alteration.
 /// </summary>
 /// <param name="p_flipType">
 /// A <see cref="FlipType"/> indicating how to flip the image.
 /// </param>
 public Flip(FlipType p_flipType)
 {
     flipType = p_flipType;
 }
Пример #40
0
        // True
        public Sprite(
            string Name,
            Vector2 location,
            Texture2D texture,
            Rectangle initialFrame,
            Vector2 velocity,
            BodyType bodytype,
            bool AddFixture
            )
        {
            this.location = location;
            Texture = texture;

            this.name = Name;
            this.dead = false;

            frames.Add(initialFrame);
            frameWidth = initialFrame.Width;
            frameHeight = initialFrame.Height;
            origin = new Vector2(frameWidth / 2, frameHeight / 2);

            tag = null;

            body = BodyFactory.CreateBody(GameWorld.world);
            body.BodyType = bodytype;
            body.UserData = this;

            spriteEffects = new SpriteEffects();
            flipType = new FlipType();
            flipType = FlipType.NONE;

            /*
            body.Restitution = 1f;
            body.Mass = 20;
            body.Friction = 5;
            body.LinearDamping = 2.4f;
            body.AngularDamping = 6.4f;
            body.Rotation = 1.3f;
            //            box.AngularVelocity = 0.1f;
            body.Inertia = 25.5f;
            */
            this.Location = location;
            //            body.Position = ConvertUnits.ToSimUnits(this.Location);
            body.IgnoreGravity = false;

            if (AddFixture)
            {
                bodyfixture = FixtureFactory.AttachRectangle(ConvertUnits.ToSimUnits(initialFrame.Width), ConvertUnits.ToSimUnits(initialFrame.Height), 1, Vector2.Zero, body);
                bodyfixture.Restitution = 1;
                bodyfixture.Friction = 1;

                bodyfixture.OnCollision += new OnCollisionEventHandler(HandleCollision);
            }

            this.Velocity = ConvertUnits.ToSimUnits(velocity);
        }
        /// <summary>
        /// Rotates and flips an image by the given instructions.
        /// </summary>
        /// <param name="source">The image to resize.</param>
        /// <param name="rotateType">The <see cref="RotateType"/> to perform the rotation.</param>
        /// <param name="flipType">The <see cref="FlipType"/> to perform the flip.</param>
        /// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param>
        /// <returns>The <see cref="Image"/></returns>
        public static Image RotateFlip(this Image source, RotateType rotateType, FlipType flipType, ProgressEventHandler progressHandler = null)
        {
            RotateFlip processor = new RotateFlip(rotateType, flipType);
            processor.OnProgress += progressHandler;

            try
            {
                return source.Process(source.Width, source.Height, source.Bounds, source.Bounds, processor);
            }
            finally
            {
                processor.OnProgress -= progressHandler;
            }
        }
 /// <summary>
 /// Flips the image after everything is done
 /// </summary>
 public TransformExpression FlipAfter(FlipType flipType)
 {
     builder.SetParameter(TransformCommands.FlipAfter, flipType.ToString().ToLowerInvariant());
     return this;
 }
Пример #43
0
 public TfFlip(FlipType type)
 {
     Name = "Flip";
     _flip = type;
 }
Пример #44
0
		public FlipTransformation(FlipType flipType)
		{
			throw new Exception(Common.DoNotReferenceMessage);
		}
Пример #45
0
 public byte[] FlipImage(FlipType type, string file)
 {
     return _di.TransformImage(type, file);
 }
        public FlipTransformation(FlipType flipType)
        {
			FlipType = flipType;
        }
Пример #47
0
 public FluentImage In(FlipType flipType)
 {
     var flip = (flipType == FlipType.Horizontal) ? RotateFlipType.RotateNoneFlipX : RotateFlipType.RotateNoneFlipY;
     this.builder.Image.RotateFlip(flip);
     return this.builder;
 }
Пример #48
0
		public FlipTransformation(FlipType flipType)
		{
			throw new Exception(DoNotReference);
		}