Skip to content

Commit

Permalink
Release 0.3.7 !
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyettinger committed May 25, 2022
1 parent 2cc7f50 commit 0b0fdbc
Show file tree
Hide file tree
Showing 20 changed files with 659 additions and 288 deletions.
41 changes: 24 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ public void writeGif() {
final int frameCount = 20;
Array<Pixmap> pixmaps = new Array<>(frameCount);
for (int i = 0; i < frameCount; i++) {
// you could set the proper state for a frame here.
// you could set the proper state for a frame here.

// you don't need to call render() in all cases, especially if you have Pixmaps already.
// this assumes you're calling this from a class that uses render() to draw to the screen.
// you don't need to call render() in all cases, especially if you have Pixmaps already.
// this assumes you're calling this from a class that uses render() to draw to the screen.
render();
// this gets a screenshot of the current window and adds it to the Array of Pixmap.
// there are two ways to do this; this is the older way, but it is deprecated in current libGDX:
// this gets a screenshot of the current window and adds it to the Array of Pixmap.
// there are two ways to do this; this is the older way, but it is deprecated in current libGDX:
pixmaps.add(ScreenUtils.getFrameBufferPixmap(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
// the newer way is only available in more-recent libGDX (I know 1.10.0 has it); it is not deprecated:
// the newer way is only available in more-recent libGDX (I know 1.10.0 and 1.11.0 have it); it is not deprecated:
// pixmaps.add(Pixmap.createFromFrameBuffer(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
}
// AnimatedGif is from anim8; if no extra settings are specified it will calculate a 255-color palette from
// each given frame and use the most appropriate palette for each frame, dithering any colors that don't
// match. The other file-writing classes don't do this; PNG8 doesn't currently support a palette per-frame,
// while AnimatedPNG doesn't restrict colors to a palette. See Dithering Algorithms below for visual things
// to be aware of and choices you can make.
// AnimatedGif is from anim8; if no extra settings are specified it will calculate a 255-color palette from
// each given frame and use the most appropriate palette for each frame, dithering any colors that don't
// match. The other file-writing classes don't do this; PNG8 doesn't currently support a palette per-frame,
// while AnimatedPNG doesn't restrict colors to a palette. See Dithering Algorithms below for visual things
// to be aware of and choices you can make.
AnimatedGif gif = new AnimatedGif();
// you can write to a FileHandle or an OutputStream; here, the file will be written in the current directory.
// here, pixmaps is usually an Array of Pixmap for any of the animated image types.
// 16 is how many frames per second the animated GIF should play back at.
// you can write to a FileHandle or an OutputStream; here, the file will be written in the current directory.
// here, pixmaps is usually an Array of Pixmap for any of the animated image types.
// 16 is how many frames per second the animated GIF should play back at.
gif.write(Gdx.files.local("AnimatedGif.gif"), pixmaps, 16);
}
```
Expand All @@ -47,8 +47,8 @@ A typical Gradle dependency on anim8 looks like this (in the core module's depen
```groovy
dependencies {
//... other dependencies are here, like libGDX 1.9.11 or higher
// libGDX 1.10.0 is recommended currently, but versions as old as 1.9.11 work.
api "com.github.tommyettinger:anim8-gdx:0.3.6"
// libGDX 1.11.0 is recommended currently, but versions as old as 1.9.11 work.
api "com.github.tommyettinger:anim8-gdx:0.3.7"
}
```

Expand All @@ -57,7 +57,7 @@ You can also get a specific commit using JitPack, by following the instructions
commit, unless you are experiencing problems with one in particular.)

A .gwt.xml file is present in the sources jar, and because GWT needs it, you can depend on the sources jar with
`implementation "com.github.tommyettinger:anim8-gdx:0.3.6:sources"`. The PNG-related code isn't available on GWT because
`implementation "com.github.tommyettinger:anim8-gdx:0.3.7:sources"`. The PNG-related code isn't available on GWT because
it needs `java.util.zip`, which is unavailable there, but PaletteReducer and AnimatedGif should both work. The GWT
inherits line, which is needed in `GdxDefinition.gwt.xml` if no dependencies already have it, is:
```xml
Expand Down Expand Up @@ -174,6 +174,13 @@ passing it an `Array<Pixmap>`, and assign that to the `palette` field; this is r
frame will use the same palette (which means regions of solid color that don't change in the source won't change in the
GIF; this isn't true if `palette` is null).

Starting in version 0.3.7, you can use any of the `PaletteReducer.analyzeHueWise()` methods to analyze the palette of a
`Pixmap` or multiple `Pixmap`s. This approach works well with rather small palettes (about 16 colors) because it tries
to ensure some colors from every hue present in the image will be available in the palette. It stops being noticeably
better than `analyze()` at around 25-30 colors in a palette (this can vary based on the image), and is almost always
slower than `analyze()`. Thanks to [caramel](https://caramellow.dev/) for (very quickly) devising this algorithm for
palette construction.

# Samples

Some animations, using 255 colors taken from the most-used in the animation (`analyze()`, which does well here
Expand Down
2 changes: 1 addition & 1 deletion docs/apidocs/allclasses-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>All Classes and Interfaces (anim8-gdx 0.3.6 API)</title>
<title>All Classes and Interfaces (anim8-gdx 0.3.7 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="description" content="class index">
Expand Down
2 changes: 1 addition & 1 deletion docs/apidocs/allpackages-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>All Packages (anim8-gdx 0.3.6 API)</title>
<title>All Packages (anim8-gdx 0.3.7 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="description" content="package index">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>AnimatedGif (anim8-gdx 0.3.6 API)</title>
<title>AnimatedGif (anim8-gdx 0.3.7 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="description" content="declaration: package: com.github.tommyettinger.anim8, class: AnimatedGif">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>AnimatedPNG (anim8-gdx 0.3.6 API)</title>
<title>AnimatedPNG (anim8-gdx 0.3.7 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="description" content="declaration: package: com.github.tommyettinger.anim8, class: AnimatedPNG">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>AnimationWriter (anim8-gdx 0.3.6 API)</title>
<title>AnimationWriter (anim8-gdx 0.3.7 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="description" content="declaration: package: com.github.tommyettinger.anim8, interface: AnimationWriter">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>Dithered.DitherAlgorithm (anim8-gdx 0.3.6 API)</title>
<title>Dithered.DitherAlgorithm (anim8-gdx 0.3.7 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="description" content="declaration: package: com.github.tommyettinger.anim8, interface: Dithered, enum: DitherAlgorithm">
Expand Down
2 changes: 1 addition & 1 deletion docs/apidocs/com/github/tommyettinger/anim8/Dithered.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>Dithered (anim8-gdx 0.3.6 API)</title>
<title>Dithered (anim8-gdx 0.3.7 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="description" content="declaration: package: com.github.tommyettinger.anim8, interface: Dithered">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>OtherMath.BiasGain (anim8-gdx 0.3.6 API)</title>
<title>OtherMath.BiasGain (anim8-gdx 0.3.7 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="description" content="declaration: package: com.github.tommyettinger.anim8, class: OtherMath, class: BiasGain">
Expand Down Expand Up @@ -134,9 +134,16 @@ <h2>Constructor Summary</h2>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(float,float)" class="member-name-link">BiasGain</a><wbr>(float&nbsp;shape,
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E()" class="member-name-link">BiasGain</a>()</code></div>
<div class="col-last even-row-color">
<div class="block">Constructs a useful default BiasGain interpolation with a smoothstep-like shape.</div>
</div>
<div class="col-constructor-name odd-row-color"><code><a href="#%3Cinit%3E(float,float)" class="member-name-link">BiasGain</a><wbr>(float&nbsp;shape,
float&nbsp;turning)</code></div>
<div class="col-last even-row-color">&nbsp;</div>
<div class="col-last odd-row-color">
<div class="block">Constructs a BiasGain interpolation with the specified (positive) shape and specified turning (between 0 and
1 inclusive).</div>
</div>
</div>
</section>
</li>
Expand Down Expand Up @@ -200,10 +207,26 @@ <h3>turning</h3>
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;()">
<h3>BiasGain</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">BiasGain</span>()</div>
<div class="block">Constructs a useful default BiasGain interpolation with a smoothstep-like shape.
This has a shape of 2.0f and a turning of 0.5f .</div>
</section>
</li>
<li>
<section class="detail" id="&lt;init&gt;(float,float)">
<h3>BiasGain</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">BiasGain</span><wbr><span class="parameters">(float&nbsp;shape,
float&nbsp;turning)</span></div>
<div class="block">Constructs a BiasGain interpolation with the specified (positive) shape and specified turning (between 0 and
1 inclusive).</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>shape</code> - must be positive; similar to a straight line when near 1, becomes smoothstep-like above 1, and
becomes shaped like transpose of smoothstep below 1</dd>
<dd><code>turning</code> - where, between 0 and 1 inclusive, this should change from the starting curve to the ending one</dd>
</dl>
</section>
</li>
</ul>
Expand Down
Loading

0 comments on commit 0b0fdbc

Please sign in to comment.