@Test public void testShouldAddImageOnlyTallerThanAtlasReturnsFalse() { assertFalse(GENERATOR.shouldAddImage(1, 101)); }
public boolean shouldAddImage(final int imageWidth, final int imageHeight) { if (imageWidth < 0) { throw new IllegalArgumentException("image width must be non-negative"); } else if (imageHeight < 0) { throw new IllegalArgumentException("image height must be non-negative"); } return (imageWidth + atlasPadding) <= atlasWidth && (imageHeight + atlasPadding) <= atlasHeight && (imageWidth + atlasPadding) * (imageHeight + atlasPadding) / (float) (atlasWidth * atlasHeight) < atlasTolerance; }
TextureAtlasGenerator { public boolean shouldAddImage(final int imageWidth, final int imageHeight) { if (imageWidth < 0) { throw new IllegalArgumentException("image width must be non-negative"); } else if (imageHeight < 0) { throw new IllegalArgumentException("image height must be non-negative"); } return (imageWidth + atlasPadding) <= atlasWidth && (imageHeight + atlasPadding) <= atlasHeight && (imageWidth + atlasPadding) * (imageHeight + atlasPadding) / (float) (atlasWidth * atlasHeight) < atlasTolerance; } }
TextureAtlasGenerator { public boolean shouldAddImage(final int imageWidth, final int imageHeight) { if (imageWidth < 0) { throw new IllegalArgumentException("image width must be non-negative"); } else if (imageHeight < 0) { throw new IllegalArgumentException("image height must be non-negative"); } return (imageWidth + atlasPadding) <= atlasWidth && (imageHeight + atlasPadding) <= atlasHeight && (imageWidth + atlasPadding) * (imageHeight + atlasPadding) / (float) (atlasWidth * atlasHeight) < atlasTolerance; } TextureAtlasGenerator(final int atlasWidth,
                               final int atlasHeight,
                               final int atlasPadding,
                               final float atlasTolerance); }
TextureAtlasGenerator { public boolean shouldAddImage(final int imageWidth, final int imageHeight) { if (imageWidth < 0) { throw new IllegalArgumentException("image width must be non-negative"); } else if (imageHeight < 0) { throw new IllegalArgumentException("image height must be non-negative"); } return (imageWidth + atlasPadding) <= atlasWidth && (imageHeight + atlasPadding) <= atlasHeight && (imageWidth + atlasPadding) * (imageHeight + atlasPadding) / (float) (atlasWidth * atlasHeight) < atlasTolerance; } TextureAtlasGenerator(final int atlasWidth,
                               final int atlasHeight,
                               final int atlasPadding,
                               final float atlasTolerance); @Nullable Result addImage(final int imageWidth, final int imageHeight, @Nonnull final String imageName); boolean shouldAddImage(final int imageWidth, final int imageHeight); @Nullable Result removeImage(@Nonnull final String name); int getAtlasWidth(); int getAtlasHeight(); @Nonnull List<Result> rebuild(
      final int width,
      final int height); void reset(); }
TextureAtlasGenerator { public boolean shouldAddImage(final int imageWidth, final int imageHeight) { if (imageWidth < 0) { throw new IllegalArgumentException("image width must be non-negative"); } else if (imageHeight < 0) { throw new IllegalArgumentException("image height must be non-negative"); } return (imageWidth + atlasPadding) <= atlasWidth && (imageHeight + atlasPadding) <= atlasHeight && (imageWidth + atlasPadding) * (imageHeight + atlasPadding) / (float) (atlasWidth * atlasHeight) < atlasTolerance; } TextureAtlasGenerator(final int atlasWidth,
                               final int atlasHeight,
                               final int atlasPadding,
                               final float atlasTolerance); @Nullable Result addImage(final int imageWidth, final int imageHeight, @Nonnull final String imageName); boolean shouldAddImage(final int imageWidth, final int imageHeight); @Nullable Result removeImage(@Nonnull final String name); int getAtlasWidth(); int getAtlasHeight(); @Nonnull List<Result> rebuild(
      final int width,
      final int height); void reset();  }