Class Texture2Tile


  • public class Texture2Tile
    extends java.lang.Object
    Utility for making a seamless tilable 512x256 tile from a seamless tilable texture. Recommended texture size (the input image) is 256x128. Other sizes will be seamlessly rescaled with interpolation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int RESULT_HEIGHT  
      private static int RESULT_WIDTH  
    • Constructor Summary

      Constructors 
      Constructor Description
      Texture2Tile()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static boolean closerToCorrectAspectWithoutDoublingHorizontally​(java.awt.image.BufferedImage inputImage)  
      private static java.awt.image.BufferedImage combineQuarterTiles​(java.awt.image.BufferedImage imageA, java.awt.image.BufferedImage imageB)  
      private static java.awt.image.BufferedImage createImageWithTextureFill​(java.awt.image.BufferedImage im, int width, int height)  
      private static java.awt.image.BufferedImage extractQuarterTileA​(java.awt.image.BufferedImage inputImage, int quarterTileWidth, int quarterTileHeight)  
      private static java.awt.image.BufferedImage extractQuarterTileB​(java.awt.image.BufferedImage inputImage, int quarterTileWidth, int quarterTileHeight)  
      private static java.awt.image.BufferedImage imageWithMaskApplied​(java.awt.image.BufferedImage image, java.lang.String variation)  
      static void main​(java.lang.String[] args)  
      private static java.awt.image.BufferedImage seamlessRescaleTexture​(java.awt.image.BufferedImage im, int width, int height)  
      private static java.awt.image.BufferedImage seamlessRescaleTextureIfNeeded​(java.awt.image.BufferedImage inputImage, int quarterTileWidth, int quarterTileHeight)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Texture2Tile

        public Texture2Tile()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • seamlessRescaleTextureIfNeeded

        private static java.awt.image.BufferedImage seamlessRescaleTextureIfNeeded​(java.awt.image.BufferedImage inputImage,
                                                                                   int quarterTileWidth,
                                                                                   int quarterTileHeight)
      • closerToCorrectAspectWithoutDoublingHorizontally

        private static boolean closerToCorrectAspectWithoutDoublingHorizontally​(java.awt.image.BufferedImage inputImage)
      • combineQuarterTiles

        private static java.awt.image.BufferedImage combineQuarterTiles​(java.awt.image.BufferedImage imageA,
                                                                        java.awt.image.BufferedImage imageB)
      • seamlessRescaleTexture

        private static java.awt.image.BufferedImage seamlessRescaleTexture​(java.awt.image.BufferedImage im,
                                                                           int width,
                                                                           int height)
      • createImageWithTextureFill

        private static java.awt.image.BufferedImage createImageWithTextureFill​(java.awt.image.BufferedImage im,
                                                                               int width,
                                                                               int height)
      • extractQuarterTileA

        private static java.awt.image.BufferedImage extractQuarterTileA​(java.awt.image.BufferedImage inputImage,
                                                                        int quarterTileWidth,
                                                                        int quarterTileHeight)
                                                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • extractQuarterTileB

        private static java.awt.image.BufferedImage extractQuarterTileB​(java.awt.image.BufferedImage inputImage,
                                                                        int quarterTileWidth,
                                                                        int quarterTileHeight)
                                                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • imageWithMaskApplied

        private static java.awt.image.BufferedImage imageWithMaskApplied​(java.awt.image.BufferedImage image,
                                                                         java.lang.String variation)
                                                                  throws java.lang.Exception
        Throws:
        java.lang.Exception