Skip to content

Commit

Permalink
Increased size of creature-color-images in pedigree.
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Apr 2, 2016
1 parent 09394e7 commit 61add17
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 38 deletions.
45 changes: 23 additions & 22 deletions ARKBreedingStats/CreatureBox.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions ARKBreedingStats/CreatureBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public partial class CreatureBox : UserControl
private MyColorPicker cp;
private Button[] colorButtons;
private bool[] enabledColorRegions = new bool[] { true, true, true, true, true, true };
private Image largeImage;
private bool renewLargeImage;

public CreatureBox()
{
Expand Down Expand Up @@ -79,6 +81,7 @@ public void setCreature(Creature creature)
Clear();
this.creature = creature;
updateLabel();
renewLargeImage = true;
}

public void updateStat(int stat)
Expand Down Expand Up @@ -318,6 +321,7 @@ private void chooseColor(int region, Button sender)
// color was chosen
setColorButton(sender, Utils.creatureColor(creature.colors[region]));
pictureBox1.Image = CreatureColored.getColoredCreature(creature.colors, creature.species, enabledColorRegions);
renewLargeImage = true;
}
}
}
Expand All @@ -342,5 +346,14 @@ public bool[] EnabledColorRegions
}
}
}

private void pictureBox1_Click(object sender, EventArgs e)
{
if (renewLargeImage)
{
largeImage = CreatureColored.getColoredCreature(creature.colors, creature.species, enabledColorRegions, 256);
renewLargeImage = false;
}
}
}
}
27 changes: 18 additions & 9 deletions ARKBreedingStats/CreatureColored.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace ARKBreedingStats
{
Expand All @@ -25,12 +26,23 @@ public static Bitmap getColoredCreature(int[] colorIds, string species, bool[] e
}
hsl[c] = new float[] { cl.GetHue(), s, (Math.Max(cl.R, (Math.Max(cl.G, cl.B))) + Math.Min(cl.R, Math.Min(cl.G, cl.B))) / 510f };
}
Bitmap bm;
Bitmap bm = new Bitmap(size, size);
Graphics graph = Graphics.FromImage(bm);
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
string imgFolder = "img\\";
if (!onlyColors && System.IO.File.Exists(imgFolder + species + ".png") && System.IO.File.Exists(imgFolder + species + "_m.png"))
{
bm = new Bitmap(imgFolder + species + ".png");
Bitmap mask = new Bitmap(imgFolder + species + "_m.png");
//bm = new Bitmap(imgFolder + species + ".png");
graph.CompositingMode = CompositingMode.SourceCopy;
graph.CompositingQuality = CompositingQuality.HighQuality;
graph.InterpolationMode = InterpolationMode.HighQualityBicubic;
graph.SmoothingMode = SmoothingMode.HighQuality;
graph.PixelOffsetMode = PixelOffsetMode.HighQuality;
graph.DrawImage(new Bitmap(imgFolder + species + ".png"), 0, 0, size, size);
Bitmap mask = new Bitmap(size, size);
graph.Dispose();
graph = Graphics.FromImage(mask);
graph.DrawImage(new Bitmap(imgFolder + species + "_m.png"), 0, 0, size, size);
float o = 0, l;
Color c = Color.Black, bc = Color.Black;
int r, g, b;
Expand Down Expand Up @@ -83,9 +95,6 @@ public static Bitmap getColoredCreature(int[] colorIds, string species, bool[] e
}
else
{
bm = new Bitmap(size, size);
Graphics g = Graphics.FromImage(bm);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Brush b = new SolidBrush(Color.Black);
int pieAngle = enabledColorRegions.Count(c => c);
pieAngle = 360 / (pieAngle > 0 ? pieAngle : 1);
Expand All @@ -97,15 +106,15 @@ public static Bitmap getColoredCreature(int[] colorIds, string species, bool[] e
if (colorIds[c] > 0)
{
b = new SolidBrush(Utils.creatureColor(colorIds[c]));
g.FillPie(b, (size - pieSize) / 2, (size - pieSize) / 2, pieSize, pieSize, pieNr * pieAngle + 270, pieAngle);
graph.FillPie(b, (size - pieSize) / 2, (size - pieSize) / 2, pieSize, pieSize, pieNr * pieAngle + 270, pieAngle);
}
pieNr++;
}
}
g.DrawEllipse(new Pen(Color.Gray), (size - pieSize) / 2, (size - pieSize) / 2, pieSize, pieSize);
graph.DrawEllipse(new Pen(Color.Gray), (size - pieSize) / 2, (size - pieSize) / 2, pieSize, pieSize);
b.Dispose();
g.Dispose();
}
graph.Dispose();
return bm;
}

Expand Down
8 changes: 4 additions & 4 deletions ARKBreedingStats/Pedigree.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ARKBreedingStats/Pedigree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void createPedigree()
row++;
}

pictureBox.Image = CreatureColored.getColoredCreature(creature.colors, creature.species, enabledColorRegions);
pictureBox.Image = CreatureColored.getColoredCreature(creature.colors, creature.species, enabledColorRegions, 256);

this.Invalidate();
this.ResumeLayout();
Expand Down
4 changes: 2 additions & 2 deletions ARKBreedingStats/colorregions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Dimorphodon,100011
Doedicurus,110011
Gigantopethicus,100011
Ichthyosaurus,100011
Mammoth,101010
Mammoth,111010
Megalodon,100011
Mesopithecus,101011
Pachycephalosaurus,100111
Expand All @@ -25,4 +25,4 @@ Spinosaurus,110011
Stegosaurus,111111
Titanoboa,111111
Triceratops,110111
Rex,110101
Rex,110011
Binary file modified ARKBreedingStats/img/Ankylosaurus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ARKBreedingStats/img/Ankylosaurus_m.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ARKBreedingStats/img/Argentavis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ARKBreedingStats/img/Argentavis_m.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ARKBreedingStats/img/Pteranodon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ARKBreedingStats/img/Pteranodon_m.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ARKBreedingStats/img/Rex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ARKBreedingStats/img/Rex_m.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 61add17

Please sign in to comment.