Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

Commit

Permalink
v3.1.0 Feat: multithreading
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatOneCalculator committed Jul 9, 2021
1 parent f19561b commit 66725da
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 72 deletions.
2 changes: 1 addition & 1 deletion Among-Us-Dumpy-Gif-Maker
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Based off of: https://daveparrish.net/posts/2019-11-16-Better-AppImage-PKGBUILD-template.html

_pkgname="among-us-dumpy-gif-maker"
_pkgver="3.0.1"
_pkgver="3.1.0"
_jar="Among-Us-Dumpy-Gif-Maker-${_pkgver}-all.jar"

pkgname="${_pkgname}"
Expand Down
2 changes: 1 addition & 1 deletion PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Based off of: https://daveparrish.net/posts/2019-11-16-Better-AppImage-PKGBUILD-template.html

_pkgname="among-us-dumpy-gif-maker"
_pkgver="3.0.1"
_pkgver="3.1.0"
_jar="Among-Us-Dumpy-Gif-Maker-${_pkgver}-all.jar"

pkgname="${_pkgname}"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


### Please credit this repository when you use this program!
##### Current version: 3.0.1
##### Current version: 3.1.0

# Instructions

Expand All @@ -50,13 +50,13 @@

To everyone else:

### Make sure to [download the jar](https://github.com/ThatOneCalculator/Among-Us-Dumpy-Gif-Maker/releases/download/v3.0.1/Among-Us-Dumpy-Gif-Maker-3.0.1-all.jar)!
### Make sure to [download the jar](https://github.com/ThatOneCalculator/Among-Us-Dumpy-Gif-Maker/releases/download/v3.1.0/Among-Us-Dumpy-Gif-Maker-3.1.0-all.jar)!

### Basic usage:
Click and open the jar, select the file, and a file called "dumpy.gif" will be made in the same folder as the jar.

### CLI usage:
- `java -jar Among-Us-Dumpy-Gif-Maker-3.0.1-all.jar <flags>`
- `java -jar Among-Us-Dumpy-Gif-Maker-3.1.0-all.jar <flags>`
All flags are optional.
Flags:
```
Expand All @@ -75,5 +75,5 @@ git clone https://github.com/ThatOneCalculator/Among-Us-Dumpy-Gif-Maker
cd Among-Us-Dumpy-Gif-Maker
gradle wrapper
./gradlew shadowJar # .\gradelw.bat shadowJar if you're on Windows
java -jar ./build/libs/Among-Us-Dumpy-Gif-Maker-3.0.1-all.jar
java -jar ./build/libs/Among-Us-Dumpy-Gif-Maker-3.1.0-all.jar
```
2 changes: 1 addition & 1 deletion among-us-dumpy-gif-maker
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

/usr/bin/java -jar /usr/lib/Among-Us-Dumpy-Gif-Maker-3.0.1-all.jar $@
/usr/bin/java -jar /usr/lib/Among-Us-Dumpy-Gif-Maker-3.1.0-all.jar $@
2 changes: 1 addition & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
statcordkey = lines[0].strip()

upsince = datetime.datetime.now()
version = "3.0.1"
version = "3.1.0"

intents = discord.Intents.default()
bot = commands.AutoShardedBot(command_prefix=commands.when_mentioned_or("!!"), intents=intents, chunk_guilds_at_startup=False)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "dev.t1c.amogus"
version = "3.0.1"
version = "3.1.0"

repositories {
mavenCentral()
Expand Down
84 changes: 21 additions & 63 deletions src/main/java/dev/t1c/dumpy/sus.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ public static void main(String[] args) throws Exception {

Options options = new Options();

Option li = Option.builder().longOpt("lines").hasArg().desc("Changes the number of lines (defaults to 10)").build();
Option li = Option.builder().longOpt("lines").hasArg().desc("Changes the number of lines (defaults to 10)")
.build();
Option fl = Option.builder().longOpt("file").hasArg().desc("Path to file, hides file picker").build();
Option bk = Option.builder().longOpt("background").hasArg().desc("Path to custom background").build();
Option md = Option.builder().longOpt("mode").hasArg().desc("Crewmade mode, currently supports default and furry").build();
Option md = Option.builder().longOpt("mode").hasArg()
.desc("Crewmade mode, currently supports default and furry").build();
Option eo = Option.builder().longOpt("extraoutput").hasArg().desc("Appends text to output files").build();
Option hp = Option.builder().longOpt("help").desc("Shows this message").build();
options.addOption(li);
Expand Down Expand Up @@ -166,21 +168,31 @@ public static void main(String[] args) throws Exception {
CountDownLatch l = new CountDownLatch(frames.length);
for (int index = 0; index < frames.length; index++) {
final int indexx = index;
// "Finalized series" of variables. To fix "final or effectively final" errors.
final BufferedImage F_bg = bg;
final int F_ty = ty;
final int F_tx = tx;
final String F_modestring = modestring;
final int F_count1Check = count1Check;
final int F_count2Reset = count2Reset;
final String F_dotSlash = dotSlash;
final String F_extraoutput = extraoutput;
// Start of new thread
new Thread(() -> {
try {
// bg
frames[indexx] = toBufferedImage(bg.getScaledInstance(ix, iy, Image.SCALE_SMOOTH));
frames[indexx] = toBufferedImage(F_bg.getScaledInstance(ix, iy, Image.SCALE_SMOOTH));

// counts. One for iterating across frames and the other for the line reset
int count = indexx;
int count2 = indexx;

// iterates through pixels
for (int y = 0; y < ty; y++) {
for (int x = 0; x < tx; x++) {
for (int y = 0; y < F_ty; y++) {
for (int x = 0; x < F_tx; x++) {

// Grabs appropriate pixel frame
var pixelI = main.getResource("dumpy/" + count + modestring + ".png");
var pixelI = main.getResource("dumpy/" + count + F_modestring + ".png");
BufferedImage pixel = ImageIO.read(pixelI);
pixel = shader(pixel, image.getRGB(x, y));
// overlays it (if not null)
Expand All @@ -190,56 +202,19 @@ public static void main(String[] args) throws Exception {

// Handles animating
count++;
if (count == count1Check) {
if (count == F_count1Check) {
count = 0;
}
}
// Handles line resets
count2--;
if (count2 == -1) {
count2 = count2Reset;
count2 = F_count2Reset;
}
count = count2;
final int indexx = index;
// "Finalized series" of variables. To fix "final or effectively final" errors.
final BufferedImage F_bg = bg;
final int F_ty = ty;
final int F_tx = tx;
final String F_modestring = modestring;
final int F_count1Check = count1Check;
final int F_count2Reset = count2Reset;
final String F_dotSlash = dotSlash;
final String F_extraoutput = extraoutput;
// Start of new thread
new Thread(()->{
try {
// bg
frames[indexx] = toBufferedImage(F_bg.getScaledInstance(ix, iy, Image.SCALE_SMOOTH));

// counts. One for iterating across frames and the other for the line reset
int count = indexx;
int count2 = indexx;

// iterates through pixels
for (int y = 0; y < F_ty; y++) {
for (int x = 0; x < F_tx; x++) {

// Grabs appropriate pixel frame
var pixelI = main.getResource("dumpy/" + count + F_modestring + ".png");
BufferedImage pixel = ImageIO.read(pixelI);
pixel = shader(pixel, image.getRGB(x, y));
// overlays it (if not null)
if (pixel != null) {
frames[indexx] = overlayImages(frames[indexx], pixel, (x * 74) + pad, (y * 63) + pad);
}

// Handles animating
count++;
if (count == F_count1Check) {
count = 0;
}
// Writes finished frames
ImageIO.write(frames[indexx], "PNG", new File(dotSlash + "F_" + indexx + extraoutput + ".png"));
ImageIO.write(frames[indexx], "PNG", new File(F_dotSlash + "F_" + indexx + F_extraoutput + ".png"));

// Gives an idea of progress
System.out.println(indexx);
Expand All @@ -248,23 +223,6 @@ public static void main(String[] args) throws Exception {
e.printStackTrace();
}
}).start();
// Handles line resets
count2--;
if (count2 == -1) {
count2 = F_count2Reset;
}
count = count2;
}
// Writes finished frames
ImageIO.write(frames[indexx], "PNG", new File(F_dotSlash + "F_" + indexx + F_extraoutput + ".png"));

// Gives an idea of progress
System.out.println(indexx);
l.countDown();
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
l.await();
// Sets output file name
Expand Down

0 comments on commit 66725da

Please sign in to comment.