Auto stash before merge of "develop" and "origin/develop"

This commit is contained in:
Matthew Cech
2019-06-17 23:13:30 -07:00
parent 22a3330abb
commit 4d6444f8ad
2 changed files with 49 additions and 14 deletions
+4 -14
View File
@@ -5,8 +5,6 @@ import java.awt.Graphics2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import javax.imageio.ImageIO;
import core.Command; import core.Command;
import core.LocStrings; import core.LocStrings;
import dataStructures.KittyChannel; import dataStructures.KittyChannel;
@@ -17,7 +15,6 @@ import dataStructures.KittyRole;
import dataStructures.KittyUser; import dataStructures.KittyUser;
import dataStructures.Response; import dataStructures.Response;
import dataStructures.UserInput; import dataStructures.UserInput;
import utils.GlobalLog;
import utils.ImageUtils; import utils.ImageUtils;
public class CommandColor extends Command public class CommandColor extends Command
@@ -38,8 +35,6 @@ public class CommandColor extends Command
float a = 1; float a = 1;
Color parsed = new Color(r, g, b, a); Color parsed = new Color(r, g, b, a);
GlobalLog.Log("1");
// Construct the image example file that we intend to display locally // Construct the image example file that we intend to display locally
BufferedImage img = new BufferedImage(sideLength, sideLength, BufferedImage.TYPE_4BYTE_ABGR); BufferedImage img = new BufferedImage(sideLength, sideLength, BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D graphics = img.createGraphics(); Graphics2D graphics = img.createGraphics();
@@ -47,25 +42,20 @@ public class CommandColor extends Command
graphics.fillRect(0, 0, sideLength, sideLength); graphics.fillRect(0, 0, sideLength, sideLength);
graphics.dispose(); graphics.dispose();
GlobalLog.Log("2");
String tempFileName = ImageUtils.writeTempImageData(img, ".png"); String tempFileName = ImageUtils.writeTempImageData(img, ".png");
File file = new File(tempFileName); File file = new File(tempFileName);
GlobalLog.Log("3"); // Build the response
KittyEmbed response = new KittyEmbed(); KittyEmbed response = new KittyEmbed();
response.title = "Color Name"; response.title = "Color Name";
response.color = parsed; response.color = parsed;
response.descriptionText = "`rgba` test\n`hex` test\n`hsv` test"; response.descriptionText = "`rgba` test\n`hex` test\n`hsv` test";
response.thumbnailURL = "attachment://" + tempFileName; response.thumbnailURL = "attachment://" + tempFileName;
response.footerText = "All percentages and values are rounded to the nearest whole number";
GlobalLog.Log("4"); // Send then delete the temp local files
res.CallEmbed(response); res.CallEmbed(response);
ImageUtils.BlockingFileDelete(file); ImageUtils.BlockingFileDelete(file);
GlobalLog.Log("5");
}; };
} }
+45
View File
@@ -0,0 +1,45 @@
package network;
import com.google.gson.Gson;
// This class is designed to easily query and ask for responses from https://www.thecolorapi.com/.
// Unlike some of the other networking classes, the query is much more wrapped.
@SuppressWarnings("unused")
public class NetworkTheColorAPI
{
private static final Gson jsonParser_ = new Gson();
private class tca_hsv
{
public int h; // 0-255
public int s; // 0-100, %
public int v; // 0-100, %
}
private class tca_hsl
{
public int h; // 0-255
public int s; // 0-100, %
public int l; // 0-100, %
}
private class tca_rgb
{
public int r; // 0-255
public int g; // 0-255
public int b; // 0-255
}
private class tca_hex
{
public String clean; // format xxxxxx, with no #
}
private class tca_obj
{
public tca_hex hex;
public tca_rgb rgb;
public tca_hsl hsl;
public tca_hsv hsv;
}
}