示例#1
0
        /// <summary>
        /// Flips the specified image horizontally or vertically.
        /// </summary>
        /// <param name="image">The image.</param>
        /// <param name="libraryData">The library data.</param>
        /// <param name="flip">The flip request.</param>
        private void Flip(TexImage image, FreeImageTextureLibraryData libraryData, FlippingRequest flip)
        {
            Log.Info("Flipping image : " + flip.Flip + " ...");

            for (int i = 0; i < libraryData.Bitmaps.Length; ++i)
            {
                switch (flip.Flip)
                {
                    case Orientation.Vertical:
                        FreeImage.FlipVertical(libraryData.Bitmaps[i]);
                        break;

                    case Orientation.Horizontal:
                        FreeImage.FlipHorizontal(libraryData.Bitmaps[i]);
                        break;
                }
            }

            image.Flip(flip.Flip);
        }
示例#2
0
        /// <summary>
        /// Flips the specified image horizontally or vertically.
        /// </summary>
        /// <param name="image">The image.</param>
        /// <param name="orientation">The orientation <see cref="Orientation.Flip"/>.</param>
        public void Flip(TexImage image, Orientation orientation)
        {
            if (image.Format.IsCompressed())
            {
                Log.Warning("You can't flip a compressed texture. It will be decompressed first..");
                Decompress(image, image.Format.IsSRgb());
            }

            var request = new FlippingRequest(orientation);

            ExecuteRequest(image, request);
        }
示例#3
0
        /// <summary>
        /// Flips the specified image vertically or horizontally.
        /// </summary>
        /// <param name="image">The image.</param>
        /// <param name="libraryData">The library data.</param>
        /// <param name="request">The request.</param>
        /// <exception cref="TexLibraryException">Flipping failed.</exception>
        private void Flip(TexImage image, PvrTextureLibraryData libraryData, FlippingRequest request)
        {
            Log.Info("Flipping texture : " + request.Flip + " ... ");

            switch(request.Flip)
            {
                case Orientation.Horizontal:
                    if (!Utilities.Flip(libraryData.Texture, EPVRTAxis.ePVRTAxisX))
                    {
                        Log.Error("Flipping failed.");
                        throw new TextureToolsException("Flipping failed.");
                    }
                    break;
                case Orientation.Vertical:
                    if (!Utilities.Flip(libraryData.Texture, EPVRTAxis.ePVRTAxisY))
                    {
                        Log.Error("Flipping failed.");
                        throw new TextureToolsException("Flipping failed.");
                    }
                    break;
            }

            image.Flip(request.Flip);

            UpdateImage(image, libraryData);
        }