mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-07-13 04:28:11 +00:00
TextureAtlasEditor - Move Dye colors into GameConstants class and add ToBGR extension method
This commit is contained in:
@@ -15,6 +15,11 @@ namespace PckStudio.Extensions
|
||||
return new Vector4(color.R / 255f, color.G / 255f, color.B / 255f, color.A / 255f);
|
||||
}
|
||||
|
||||
internal static int ToBGR(this Color color)
|
||||
{
|
||||
return color.B << 16 | color.G << 8 | color.R;
|
||||
}
|
||||
|
||||
internal static byte BlendValues(byte source, byte overlay, BlendMode blendType)
|
||||
{
|
||||
return (byte)MathExtensions.Clamp(BlendValues(source / 255f, overlay / 255f, blendType) * 255, 0, 255);
|
||||
|
||||
@@ -590,27 +590,24 @@ namespace PckStudio.Forms.Editor
|
||||
colorPick.AnyColor = true;
|
||||
colorPick.SolidColorOnly = true;
|
||||
|
||||
// custom colors are read as BGR for some reason, so hex values are "backwards"
|
||||
// values below are the default Minecraft dyed leather armor values for convenience
|
||||
//Debug.Assert(Color.FromArgb(0xf9fffe).ToBGR() == 0xfefff9); // White
|
||||
//Debug.Assert(Color.FromArgb(0xf9801d).ToBGR() == 0x1d80f9); // Orange
|
||||
//Debug.Assert(Color.FromArgb(0xc74ebd).ToBGR() == 0xbd4ec7); // Magenta
|
||||
//Debug.Assert(Color.FromArgb(0x3ab3da).ToBGR() == 0xdab33a); // Light Blue
|
||||
//Debug.Assert(Color.FromArgb(0xfed83d).ToBGR() == 0x3dd8fe); // Yellow
|
||||
//Debug.Assert(Color.FromArgb(0x80c71f).ToBGR() == 0x1fc780); // Lime
|
||||
//Debug.Assert(Color.FromArgb(0xf38baa).ToBGR() == 0xaa8bf3); // Pink
|
||||
//Debug.Assert(Color.FromArgb(0x474f52).ToBGR() == 0x524f47); // Gray
|
||||
//Debug.Assert(Color.FromArgb(0x9d9d97).ToBGR() == 0x979d9d); // Light Gray
|
||||
//Debug.Assert(Color.FromArgb(0x169c9c).ToBGR() == 0x9c9c16); // Cyan
|
||||
//Debug.Assert(Color.FromArgb(0x8932b8).ToBGR() == 0xb83289); // Purple
|
||||
//Debug.Assert(Color.FromArgb(0x3c44aa).ToBGR() == 0xaa443c); // Blue
|
||||
//Debug.Assert(Color.FromArgb(0x835432).ToBGR() == 0x325483); // Brown
|
||||
//Debug.Assert(Color.FromArgb(0x5e7c16).ToBGR() == 0x167c5e); // Green
|
||||
//Debug.Assert(Color.FromArgb(0xb02e26).ToBGR() == 0x262eb0); // Red
|
||||
//Debug.Assert(Color.FromArgb(0x1d1d21).ToBGR() == 0x211d1d); // Black
|
||||
|
||||
colorPick.CustomColors = new int[] {
|
||||
0xfefff9, // White
|
||||
0x1d80f9, // Orange
|
||||
0xbd4ec7, // Magenta
|
||||
0xdab33a, // Light Blue
|
||||
0x3dd8fe, // Yellow
|
||||
0x1fc780, // Lime
|
||||
0xaa8bf3, // Pink
|
||||
0x524f47, // Gray
|
||||
0x979d9d, // Light Gray
|
||||
0x9c9c16, // Cyan
|
||||
0xb83289, // Purple
|
||||
0xaa443c, // Blue
|
||||
0x325483, // Brown
|
||||
0x167c5e, // Green
|
||||
0x262eb0, // Red
|
||||
0x211d1d // Black
|
||||
};
|
||||
colorPick.CustomColors = GameConstants.DyeColors.Select(c => c.ToBGR()).ToArray();
|
||||
|
||||
if (colorPick.ShowDialog(this) != DialogResult.OK) return;
|
||||
|
||||
|
||||
31
PCK-Studio/Internal/GameConstants.cs
Normal file
31
PCK-Studio/Internal/GameConstants.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
internal static class GameConstants
|
||||
{
|
||||
public static readonly Color[] DyeColors = [
|
||||
Color.FromArgb(0xf9fffe), // White
|
||||
Color.FromArgb(0xf9801d), // Orange
|
||||
Color.FromArgb(0xc74ebd), // Magenta
|
||||
Color.FromArgb(0x3ab3da), // Light Blue
|
||||
Color.FromArgb(0xfed83d), // Yellow
|
||||
Color.FromArgb(0x80c71f), // Lime
|
||||
Color.FromArgb(0xf38baa), // Pink
|
||||
Color.FromArgb(0x474f52), // Gray
|
||||
Color.FromArgb(0x9d9d97), // Light Gray
|
||||
Color.FromArgb(0x169c9c), // Cyan
|
||||
Color.FromArgb(0x8932b8), // Purple
|
||||
Color.FromArgb(0x3c44aa), // Blue
|
||||
Color.FromArgb(0x835432), // Brown
|
||||
Color.FromArgb(0x5e7c16), // Green
|
||||
Color.FromArgb(0xb02e26), // Red
|
||||
Color.FromArgb(0x1d1d21), // Black
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -148,6 +148,7 @@
|
||||
<Compile Include="Forms\ContributorsForm.Designer.cs">
|
||||
<DependentUpon>ContributorsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Internal\GameConstants.cs" />
|
||||
<Compile Include="Internal\IO\TGA\TGADeserializer.cs" />
|
||||
<Compile Include="Internal\IO\TGA\TGASerializer.cs" />
|
||||
<Compile Include="Extensions\LocFileExtensions.cs" />
|
||||
|
||||
Reference in New Issue
Block a user