Esempio n. 1
0
        /// <summary>
        /// Flips the specified image horizontally or vertically.
        /// </summary>
        /// <param name="image">The image.</param>
        /// <param name="index">The index of the sub-image.</param>
        /// <param name="orientation">The orientation <see cref="Orientation.Flip"/>.</param>
        public void FlipSub(TexImage image, int index, 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 FlippingSubRequest(index, orientation);

            ExecuteRequest(image, request);
        }
Esempio n. 2
0
        /// <summary>
        /// Flips the specified sub-image horizontally or vertically.
        /// </summary>
        /// <param name="image">The image.</param>
        /// <param name="libraryData">The library data.</param>
        /// <param name="flipSub">The flip request.</param>
        private void FlipSub(TexImage image, FreeImageTextureLibraryData libraryData, FlippingSubRequest flipSub)
        {
            Log.Info("Flipping image : sub-image " + flipSub.SubImageIndex + " " + flipSub.Flip + " ...");

            if (flipSub.SubImageIndex >= 0 && flipSub.SubImageIndex < libraryData.Bitmaps.Length)
            {
                switch (flipSub.Flip)
                {
                    case Orientation.Vertical:
                        FreeImage.FlipVertical(libraryData.Bitmaps[flipSub.SubImageIndex]);
                        break;

                    case Orientation.Horizontal:
                        FreeImage.FlipHorizontal(libraryData.Bitmaps[flipSub.SubImageIndex]);
                        break;
                }
            }
            else
            {
                Log.Warning("Cannot flip the sub-image " + flipSub.SubImageIndex + " because there is only " + libraryData.Bitmaps.Length + " sub-images.");
            }

            // TODO: texture atlas update?
        }