Commit e2a06523 authored by mercury233's avatar mercury233

format

parent 913d739a
......@@ -234,484 +234,491 @@ namespace ImgGen
if (!cardImages.ContainsKey(code))
{
Bitmap bitmap;
SizeF ef;
int nWidth;
if (data.isType(Type.TYPE_SPELL))
{
bitmap = new Bitmap(bTemplates[0]);
}
else if (data.isType(Type.TYPE_TRAP))
{
bitmap = new Bitmap(bTemplates[1]);
}
else if (data.isType(Type.TYPE_SYNCHRO))
bitmap = DrawImage(code, data, text);
cardImages.Add(code, bitmap);
}
return 0;
}
}
private static Bitmap DrawImage(int code, Data data, Text text)
{
Bitmap bitmap;
SizeF ef;
int nWidth;
if (data.isType(Type.TYPE_SPELL))
{
bitmap = new Bitmap(bTemplates[0]);
}
else if (data.isType(Type.TYPE_TRAP))
{
bitmap = new Bitmap(bTemplates[1]);
}
else if (data.isType(Type.TYPE_SYNCHRO))
{
if (data.isType(Type.TYPE_PENDULUM))
{
bitmap = new Bitmap(bTemplates[12]);
}
else
{
bitmap = new Bitmap(bTemplates[2]);
}
}
else if (data.isType(Type.TYPE_LINK))
{
bitmap = new Bitmap(bTemplates[14]);
}
else if (data.isType(Type.TYPE_XYZ))
{
if (data.isType(Type.TYPE_PENDULUM))
{
bitmap = new Bitmap(bTemplates[9]);
}
else
{
bitmap = new Bitmap(bTemplates[3]);
}
}
else if (data.isType(Type.TYPE_FUSION))
{
if (data.isType(Type.TYPE_PENDULUM))
{
bitmap = new Bitmap(bTemplates[13]);
}
else
{
bitmap = new Bitmap(bTemplates[4]);
}
}
else if (data.isType(Type.TYPE_RITUAL))
{
bitmap = new Bitmap(bTemplates[5]);
}
else if (data.isType(Type.TYPE_TOKEN))
{
bitmap = new Bitmap(bTemplates[6]);
}
else if (data.isType(Type.TYPE_EFFECT))
{
if (data.isType(Type.TYPE_PENDULUM))
{
bitmap = new Bitmap(bTemplates[10]);
}
else
{
bitmap = new Bitmap(bTemplates[7]);
}
}
else
{
if (data.isType(Type.TYPE_PENDULUM))
{
bitmap = new Bitmap(bTemplates[11]);
}
else
{
bitmap = new Bitmap(bTemplates[8]);
}
}
Graphics graphics = Graphics.FromImage(bitmap);
text.text = GetStandardText(text.text);
if (data.isType(Type.TYPE_MONSTER))
{
int x = 144;
int y = 15;
int nStar;
if (!data.isType(Type.TYPE_LINK) && !data.isType(Type.TYPE_XYZ))
{
if (!data.isType(Type.TYPE_PENDULUM))
{
if (data.isType(Type.TYPE_PENDULUM))
for (nStar = 0; nStar < (data.level & 0xff); nStar++)
{
bitmap = new Bitmap(bTemplates[12]);
graphics.DrawImage(bStar[0], 149 - (12 * nStar), 37, 11, 11);
}
else
{
bitmap = new Bitmap(bTemplates[2]);
}
}
else if (data.isType(Type.TYPE_LINK))
{
bitmap = new Bitmap(bTemplates[14]);
}
else if (data.isType(Type.TYPE_XYZ))
else
{
if (data.isType(Type.TYPE_PENDULUM))
{
bitmap = new Bitmap(bTemplates[9]);
}
else
for (nStar = 0; nStar < (data.level & 0xff); nStar++)
{
bitmap = new Bitmap(bTemplates[3]);
graphics.DrawImage(bStar[0], 149 - (12 * nStar), 35, 11, 11);
}
y = 12;
}
else if (data.isType(Type.TYPE_FUSION))
}
if (data.isType(Type.TYPE_LINK))
{
x = 147;
y = 11;
}
else if (data.isType(Type.TYPE_XYZ))
{
for (nStar = 0; nStar < (data.level & 0xff); nStar++)
{
if (data.isType(Type.TYPE_PENDULUM))
{
bitmap = new Bitmap(bTemplates[13]);
}
else
{
bitmap = new Bitmap(bTemplates[4]);
}
graphics.DrawImage(bStar[1], 17 + (12 * nStar), 35, 11, 11);
}
else if (data.isType(Type.TYPE_RITUAL))
y = 12;
}
if (data.attribute == Attribute.ATTRIBUTE_EARTH)
{
graphics.DrawImage(bAttributes[0], x, y, 18, 18);
}
else if (data.attribute == Attribute.ATTRIBUTE_WATER)
{
graphics.DrawImage(bAttributes[1], x, y, 18, 18);
}
else if (data.attribute == Attribute.ATTRIBUTE_FIRE)
{
graphics.DrawImage(bAttributes[2], x, y, 18, 18);
}
else if (data.attribute == Attribute.ATTRIBUTE_WIND)
{
graphics.DrawImage(bAttributes[3], x, y, 18, 18);
}
else if (data.attribute == Attribute.ATTRIBUTE_LIGHT)
{
graphics.DrawImage(bAttributes[4], x, y, 18, 18);
}
else if (data.attribute == Attribute.ATTRIBUTE_DARK)
{
graphics.DrawImage(bAttributes[5], x, y, 18, 18);
}
else if (data.attribute == Attribute.ATTRIBUTE_DEVINE)
{
graphics.DrawImage(bAttributes[6], x, y, 18, 18);
}
if (data.isType(Type.TYPE_LINK))
{
if (data.attack >= 0)
{
bitmap = new Bitmap(bTemplates[5]);
graphics.DrawString(data.attack.ToString(), numFont, Brushes.Black, 110f, 231f);
}
else if (data.isType(Type.TYPE_TOKEN))
else
{
bitmap = new Bitmap(bTemplates[6]);
graphics.DrawString("?", numFont, textBrush, 110f, 231f);
}
else if (data.isType(Type.TYPE_EFFECT))
graphics.DrawString(data.level.ToString(), linkFont, Brushes.Black, 156f, 231f);
}
else if (!data.isType(Type.TYPE_PENDULUM))
{
if (!data.isType(Type.TYPE_XYZ))
{
if (data.isType(Type.TYPE_PENDULUM))
if (data.attack >= 0)
{
bitmap = new Bitmap(bTemplates[10]);
graphics.DrawString(data.attack.ToString(), numFont, Brushes.Black, 105f, 231f);
}
else
{
bitmap = new Bitmap(bTemplates[7]);
graphics.DrawString("?", numFont, textBrush, 115f, 231f);
}
}
else
{
if (data.isType(Type.TYPE_PENDULUM))
if (data.defence >= 0)
{
bitmap = new Bitmap(bTemplates[11]);
graphics.DrawString(data.defence.ToString(), numFont, Brushes.Black, 142f, 231f);
}
else
{
bitmap = new Bitmap(bTemplates[8]);
graphics.DrawString("?", numFont, textBrush, 152f, 231f);
}
}
Graphics graphics = Graphics.FromImage(bitmap);
text.text = GetStandardText(text.text);
if (data.isType(Type.TYPE_MONSTER))
else
{
int x = 144;
int y = 15;
int nStar;
if (!data.isType(Type.TYPE_LINK) && !data.isType(Type.TYPE_XYZ))
{
if (!data.isType(Type.TYPE_PENDULUM))
{
for (nStar = 0; nStar < (data.level & 0xff); nStar++)
{
graphics.DrawImage(bStar[0], 149 - (12 * nStar), 37, 11, 11);
}
}
else
{
for (nStar = 0; nStar < (data.level & 0xff); nStar++)
{
graphics.DrawImage(bStar[0], 149 - (12 * nStar), 35, 11, 11);
}
y = 12;
}
}
if (data.isType(Type.TYPE_LINK))
{
x = 147;
y = 11;
}
else if (data.isType(Type.TYPE_XYZ))
{
for (nStar = 0; nStar < (data.level & 0xff); nStar++)
{
graphics.DrawImage(bStar[1], 17 + (12 * nStar), 35, 11, 11);
}
y = 12;
}
if (data.attribute == Attribute.ATTRIBUTE_EARTH)
{
graphics.DrawImage(bAttributes[0], x, y, 18, 18);
}
else if (data.attribute == Attribute.ATTRIBUTE_WATER)
{
graphics.DrawImage(bAttributes[1], x, y, 18, 18);
}
else if (data.attribute == Attribute.ATTRIBUTE_FIRE)
{
graphics.DrawImage(bAttributes[2], x, y, 18, 18);
}
else if (data.attribute == Attribute.ATTRIBUTE_WIND)
{
graphics.DrawImage(bAttributes[3], x, y, 18, 18);
}
else if (data.attribute == Attribute.ATTRIBUTE_LIGHT)
{
graphics.DrawImage(bAttributes[4], x, y, 18, 18);
}
else if (data.attribute == Attribute.ATTRIBUTE_DARK)
{
graphics.DrawImage(bAttributes[5], x, y, 18, 18);
}
else if (data.attribute == Attribute.ATTRIBUTE_DEVINE)
{
graphics.DrawImage(bAttributes[6], x, y, 18, 18);
}
if (data.isType(Type.TYPE_LINK))
{
if (data.attack >= 0)
{
graphics.DrawString(data.attack.ToString(), numFont, Brushes.Black, 110f, 231f);
}
else
{
graphics.DrawString("?", numFont, textBrush, 110f, 231f);
}
graphics.DrawString(data.level.ToString(), linkFont, Brushes.Black, 156f, 231f);
}
else if (!data.isType(Type.TYPE_PENDULUM))
if (data.attack >= 0)
{
if (!data.isType(Type.TYPE_XYZ))
{
if (data.attack >= 0)
{
graphics.DrawString(data.attack.ToString(), numFont, Brushes.Black, 105f, 231f);
}
else
{
graphics.DrawString("?", numFont, textBrush, 115f, 231f);
}
if (data.defence >= 0)
{
graphics.DrawString(data.defence.ToString(), numFont, Brushes.Black, 142f, 231f);
}
else
{
graphics.DrawString("?", numFont, textBrush, 152f, 231f);
}
}
else
{
if (data.attack >= 0)
{
graphics.DrawString(data.attack.ToString(), numFont, Brushes.Black, 109f, 231f);
}
else
{
graphics.DrawString("?", numFont, textBrush, 119f, 231f);
}
if (data.defence >= 0)
{
graphics.DrawString(data.defence.ToString(), numFont, Brushes.Black, 145f, 231f);
}
else
{
graphics.DrawString("?", numFont, textBrush, 155f, 231f);
}
}
graphics.DrawString(data.attack.ToString(), numFont, Brushes.Black, 109f, 231f);
}
else
{
if (data.attack >= 0)
{
graphics.DrawString(data.attack.ToString(), numFont, Brushes.Black, 105f, 231f);
}
else
{
graphics.DrawString("?", numFont, textBrush, 115f, 231f);
}
if (data.defence >= 0)
{
graphics.DrawString(data.defence.ToString(), numFont, Brushes.Black, 142f, 231f);
}
else
{
graphics.DrawString("?", numFont, textBrush, 152f, 231f);
}
}
if (data.isType(Type.TYPE_LINK))
{
graphics.DrawString(GetTypeString(data), typeFont, typeBrush, 10f, 192f);
ef = graphics.MeasureString(text.text, txtFont, 150);
nWidth = 150;
while (ef.Height > 28 * nWidth / 150f)
{
nWidth += 3;
ef = graphics.MeasureString(text.text, txtFont, nWidth);
}
graphics.TranslateTransform(14f, 202f);
graphics.ScaleTransform(150f / nWidth, 150f / nWidth);
graphics.DrawString(text.text, txtFont, textBrush, new RectangleF(0f, 0f, ef.Width, ef.Height));
graphics.ResetTransform();
graphics.DrawString("?", numFont, textBrush, 119f, 231f);
}
else if (data.isType(Type.TYPE_PENDULUM))
if (data.defence >= 0)
{
string type_string = GetTypeString(data);
float width1 = graphics.MeasureString(type_string, typeFont).Width;
float sx1 = 1f;
if (width1 > 150f)
{
sx1 *= 150f / width1;
}
graphics.ScaleTransform(sx1, 1f);
graphics.DrawString(type_string, typeFont, typeBrush, 12f, 192f);
graphics.ResetTransform();
string monster_effect = GetPendulumDesc(text.text, regex_monster);
string pendulum_effect = GetPendulumDesc(text.text, regex_pendulum);
int lscale = (data.level >> 0x18) & 0xff;
int rscale = (data.level >> 0x10) & 0xff;
if (lscale > 9)
{
graphics.DrawString(lscale.ToString(), scaleFontSmall, Brushes.Black, 13f, 174f);
}
else
{
graphics.DrawString(lscale.ToString(), scaleFontNormal, Brushes.Black, 16f, 174f);
}
if (rscale > 9)
{
graphics.DrawString(rscale.ToString(), scaleFontSmall, Brushes.Black, 150f, 174f);
}
else
{
graphics.DrawString(rscale.ToString(), scaleFontNormal, Brushes.Black, 151f, 174f);
}
ef = graphics.MeasureString(monster_effect, txtFont, 145);
nWidth = 145;
while (ef.Height > 28 * nWidth / 145f)
{
nWidth += 3;
ef = graphics.MeasureString(monster_effect, txtFont, nWidth);
}
graphics.TranslateTransform(16f, 202f);
graphics.ScaleTransform(145f / nWidth, 145f / nWidth);
graphics.DrawString(monster_effect, txtFont, textBrush, new RectangleF(0f, 0f, ef.Width, ef.Height));
graphics.ResetTransform();
int nWidthP;
SizeF pf;
pf = graphics.MeasureString(pendulum_effect, txtFont, 119);
nWidthP = 119;
while (pf.Height > 24 * nWidthP / 119f)
{
nWidthP += 1;
pf = graphics.MeasureString(pendulum_effect, txtFont, nWidthP);
}
graphics.TranslateTransform(29f, 162f);
graphics.ScaleTransform(119f / nWidthP, 119f / nWidthP);
graphics.DrawString(pendulum_effect, txtFont, textBrush, new RectangleF(0f, 0f, pf.Width, pf.Height));
graphics.ResetTransform();
graphics.DrawString(data.defence.ToString(), numFont, Brushes.Black, 145f, 231f);
}
else if (data.isType(Type.TYPE_XYZ))
else
{
graphics.DrawString(GetTypeString(data), typeFont, typeBrush, 12f, 192f);
ef = graphics.MeasureString(text.text, txtFont, 145);
nWidth = 145;
while (ef.Height > 28 * nWidth / 145f)
{
nWidth += 3;
ef = graphics.MeasureString(text.text, txtFont, nWidth);
}
graphics.TranslateTransform(16f, 202f);
graphics.ScaleTransform(145f / nWidth, 145f / nWidth);
graphics.DrawString(text.text, txtFont, textBrush, new RectangleF(0f, 0f, ef.Width, ef.Height));
graphics.ResetTransform();
}
else {
graphics.DrawString(GetTypeString(data), typeFont, typeBrush, 13f, 195f);
ef = graphics.MeasureString(text.text, txtFont, 145);
nWidth = 145;
while (ef.Height > 25 * nWidth / 145f)
{
nWidth += 3;
ef = graphics.MeasureString(text.text, txtFont, nWidth);
}
graphics.TranslateTransform(16f, 205f);
graphics.ScaleTransform(145f / nWidth, 145f / nWidth);
graphics.DrawString(text.text, txtFont, textBrush, new RectangleF(0f, 0f, ef.Width, ef.Height));
graphics.ResetTransform();
graphics.DrawString("?", numFont, textBrush, 155f, 231f);
}
}
}
else
{
if (data.attack >= 0)
{
graphics.DrawString(data.attack.ToString(), numFont, Brushes.Black, 105f, 231f);
}
else
{
if (data.isType(Type.TYPE_SPELL))
{
if (data.type == Type.TYPE_SPELL)
{
graphics.DrawImage(bType[0], 101, 37);
}
else
{
graphics.DrawImage(bType[1], 92, 37);
if (data.isType(Type.TYPE_CONTINUOUS))
{
graphics.DrawImage(bType[4], 143, 40);
}
else if (data.isType(Type.TYPE_EQUIP))
{
graphics.DrawImage(bType[6], 143, 40);
}
else if (data.isType(Type.TYPE_FIELD))
{
graphics.DrawImage(bType[7], 143, 40);
}
else if (data.isType(Type.TYPE_QUICKPLAY))
{
graphics.DrawImage(bType[8], 143, 40);
}
else if (data.isType(Type.TYPE_RITUAL))
{
graphics.DrawImage(bType[9], 143, 40);
}
}
}
else if (data.isType(Type.TYPE_TRAP))
{
if (data.type == Type.TYPE_TRAP)
{
graphics.DrawImage(bType[2], 111, 37);
}
else
{
graphics.DrawImage(bType[3], 102, 37);
if (data.isType(Type.TYPE_CONTINUOUS))
{
graphics.DrawImage(bType[4], 143, 40);
}
else if (data.isType(Type.TYPE_COUNTER))
{
graphics.DrawImage(bType[5], 143, 40);
}
}
}
ef = graphics.MeasureString(text.text, txtFont, 145);
nWidth = 145;
while (ef.Height > 40 * nWidth / 145f)
{
nWidth += 3;
ef = graphics.MeasureString(text.text, txtFont, nWidth);
}
graphics.TranslateTransform(16f, 195f);
graphics.ScaleTransform(145f / nWidth, 145f / nWidth);
graphics.DrawString(text.text, txtFont, textBrush, new RectangleF(0f, 0f, ef.Width, ef.Height));
graphics.ResetTransform();
graphics.DrawString("?", numFont, textBrush, 115f, 231f);
}
try
if (data.defence >= 0)
{
Bitmap image = new Bitmap("./pico/" + code.ToString() + ".jpg");
graphics.CompositingMode = CompositingMode.SourceOver;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.SmoothingMode = SmoothingMode.AntiAlias;
if (data.isType(Type.TYPE_LINK))
{
graphics.DrawImage(image, 22, 47, 133, 133);
}
else if (data.isType(Type.TYPE_PENDULUM))
{
//graphics.DrawImage(image, 15, 50, 147, 109);
graphics.DrawImage(image, new Rectangle(15, 50, 147, 109), new Rectangle(0, 0, image.Width, image.Width * 109 / 147), GraphicsUnit.Pixel);
}
else if (!data.isType(Type.TYPE_XYZ))
{
graphics.DrawImage(image, 25, 54, 128, 128);
}
else
{
graphics.DrawImage(image, 24, 51, 128, 128);
}
graphics.DrawString(data.defence.ToString(), numFont, Brushes.Black, 142f, 231f);
}
catch (Exception e)
else
{
Console.WriteLine("Error prasing {0} {1}", data.code, e);
graphics.DrawString("?", numFont, textBrush, 152f, 231f);
}
if (data.isType(Type.TYPE_LINK))
}
if (data.isType(Type.TYPE_LINK))
{
graphics.DrawString(GetTypeString(data), typeFont, typeBrush, 10f, 192f);
ef = graphics.MeasureString(text.text, txtFont, 150);
nWidth = 150;
while (ef.Height > 28 * nWidth / 150f)
{
LinkMarker lm = (LinkMarker)data.defence;
if ((lm & LinkMarker.LINK_MARKER_BOTTOM_LEFT) == 0)
graphics.DrawImage(bLinkMarkers1[0], 14, 169, 18, 17);
else
graphics.DrawImage(bLinkMarkers2[0], 14, 169, 18, 17);
if ((lm & LinkMarker.LINK_MARKER_BOTTOM) == 0)
graphics.DrawImage(bLinkMarkers1[1], 73, 178, 32, 12);
else
graphics.DrawImage(bLinkMarkers2[1], 73, 178, 32, 12);
if ((lm & LinkMarker.LINK_MARKER_BOTTOM_RIGHT) == 0)
graphics.DrawImage(bLinkMarkers1[2], 145, 169, 18, 17);
else
graphics.DrawImage(bLinkMarkers2[2], 145, 169, 18, 17);
if ((lm & LinkMarker.LINK_MARKER_LEFT) == 0)
graphics.DrawImage(bLinkMarkers1[3], 11, 97, 12, 32);
else
graphics.DrawImage(bLinkMarkers2[3], 11, 97, 12, 32);
if ((lm & LinkMarker.LINK_MARKER_RIGHT) == 0)
graphics.DrawImage(bLinkMarkers1[5], 154, 97, 12, 32);
else
graphics.DrawImage(bLinkMarkers2[5], 154, 97, 12, 32);
if ((lm & LinkMarker.LINK_MARKER_TOP_LEFT) == 0)
graphics.DrawImage(bLinkMarkers1[6], 14, 39, 18, 17);
else
graphics.DrawImage(bLinkMarkers2[6], 14, 39, 18, 17);
if ((lm & LinkMarker.LINK_MARKER_TOP) == 0)
graphics.DrawImage(bLinkMarkers1[7], 73, 36, 32, 12);
else
graphics.DrawImage(bLinkMarkers2[7], 73, 36, 32, 12);
if ((lm & LinkMarker.LINK_MARKER_TOP_RIGHT) == 0)
graphics.DrawImage(bLinkMarkers1[8], 146, 39, 18, 17);
else
graphics.DrawImage(bLinkMarkers2[8], 146, 39, 18, 17);
nWidth += 3;
ef = graphics.MeasureString(text.text, txtFont, nWidth);
}
string str3 = text.name.Replace('\x00b7', '・');
float width = graphics.MeasureString(str3, nameFont).Width;
float sx = 1f;
if (width > 130f)
graphics.TranslateTransform(14f, 202f);
graphics.ScaleTransform(150f / nWidth, 150f / nWidth);
graphics.DrawString(text.text, txtFont, textBrush, new RectangleF(0f, 0f, ef.Width, ef.Height));
graphics.ResetTransform();
}
else if (data.isType(Type.TYPE_PENDULUM))
{
string type_string = GetTypeString(data);
float width1 = graphics.MeasureString(type_string, typeFont).Width;
float sx1 = 1f;
if (width1 > 150f)
{
sx *= 130f / width;
sx1 *= 150f / width1;
}
if (data.isType(Type.TYPE_LINK))
graphics.ScaleTransform(sx1, 1f);
graphics.DrawString(type_string, typeFont, typeBrush, 12f, 192f);
graphics.ResetTransform();
string monster_effect = GetPendulumDesc(text.text, regex_monster);
string pendulum_effect = GetPendulumDesc(text.text, regex_pendulum);
int lscale = (data.level >> 0x18) & 0xff;
int rscale = (data.level >> 0x10) & 0xff;
if (lscale > 9)
{
graphics.TranslateTransform(10f, 13f);
graphics.DrawString(lscale.ToString(), scaleFontSmall, Brushes.Black, 13f, 174f);
}
else if (data.isType(Type.TYPE_XYZ))
else
{
graphics.TranslateTransform(12f, 13f);
graphics.DrawString(lscale.ToString(), scaleFontNormal, Brushes.Black, 16f, 174f);
}
else if (data.isType(Type.TYPE_PENDULUM))
if (rscale > 9)
{
graphics.TranslateTransform(12f, 13f);
graphics.DrawString(rscale.ToString(), scaleFontSmall, Brushes.Black, 150f, 174f);
}
else
{
graphics.TranslateTransform(14f, 17f);
graphics.DrawString(rscale.ToString(), scaleFontNormal, Brushes.Black, 151f, 174f);
}
graphics.ScaleTransform(sx, 1f);
graphics.DrawString(str3, nameFont, nameBrush, 0f, 0f);
graphics.DrawString(str3, nameFont, Brushes.Gold, 1f, 1f);
ef = graphics.MeasureString(monster_effect, txtFont, 145);
nWidth = 145;
while (ef.Height > 28 * nWidth / 145f)
{
nWidth += 3;
ef = graphics.MeasureString(monster_effect, txtFont, nWidth);
}
graphics.TranslateTransform(16f, 202f);
graphics.ScaleTransform(145f / nWidth, 145f / nWidth);
graphics.DrawString(monster_effect, txtFont, textBrush, new RectangleF(0f, 0f, ef.Width, ef.Height));
graphics.ResetTransform();
int nWidthP;
SizeF pf;
pf = graphics.MeasureString(pendulum_effect, txtFont, 119);
nWidthP = 119;
while (pf.Height > 24 * nWidthP / 119f)
{
nWidthP += 1;
pf = graphics.MeasureString(pendulum_effect, txtFont, nWidthP);
}
graphics.TranslateTransform(29f, 162f);
graphics.ScaleTransform(119f / nWidthP, 119f / nWidthP);
graphics.DrawString(pendulum_effect, txtFont, textBrush, new RectangleF(0f, 0f, pf.Width, pf.Height));
graphics.ResetTransform();
cardImages.Add(code, bitmap);
}
return 0;
else if (data.isType(Type.TYPE_XYZ))
{
graphics.DrawString(GetTypeString(data), typeFont, typeBrush, 12f, 192f);
ef = graphics.MeasureString(text.text, txtFont, 145);
nWidth = 145;
while (ef.Height > 28 * nWidth / 145f)
{
nWidth += 3;
ef = graphics.MeasureString(text.text, txtFont, nWidth);
}
graphics.TranslateTransform(16f, 202f);
graphics.ScaleTransform(145f / nWidth, 145f / nWidth);
graphics.DrawString(text.text, txtFont, textBrush, new RectangleF(0f, 0f, ef.Width, ef.Height));
graphics.ResetTransform();
}
else {
graphics.DrawString(GetTypeString(data), typeFont, typeBrush, 13f, 195f);
ef = graphics.MeasureString(text.text, txtFont, 145);
nWidth = 145;
while (ef.Height > 25 * nWidth / 145f)
{
nWidth += 3;
ef = graphics.MeasureString(text.text, txtFont, nWidth);
}
graphics.TranslateTransform(16f, 205f);
graphics.ScaleTransform(145f / nWidth, 145f / nWidth);
graphics.DrawString(text.text, txtFont, textBrush, new RectangleF(0f, 0f, ef.Width, ef.Height));
graphics.ResetTransform();
}
}
else
{
if (data.isType(Type.TYPE_SPELL))
{
if (data.type == Type.TYPE_SPELL)
{
graphics.DrawImage(bType[0], 101, 37);
}
else
{
graphics.DrawImage(bType[1], 92, 37);
if (data.isType(Type.TYPE_CONTINUOUS))
{
graphics.DrawImage(bType[4], 143, 40);
}
else if (data.isType(Type.TYPE_EQUIP))
{
graphics.DrawImage(bType[6], 143, 40);
}
else if (data.isType(Type.TYPE_FIELD))
{
graphics.DrawImage(bType[7], 143, 40);
}
else if (data.isType(Type.TYPE_QUICKPLAY))
{
graphics.DrawImage(bType[8], 143, 40);
}
else if (data.isType(Type.TYPE_RITUAL))
{
graphics.DrawImage(bType[9], 143, 40);
}
}
}
else if (data.isType(Type.TYPE_TRAP))
{
if (data.type == Type.TYPE_TRAP)
{
graphics.DrawImage(bType[2], 111, 37);
}
else
{
graphics.DrawImage(bType[3], 102, 37);
if (data.isType(Type.TYPE_CONTINUOUS))
{
graphics.DrawImage(bType[4], 143, 40);
}
else if (data.isType(Type.TYPE_COUNTER))
{
graphics.DrawImage(bType[5], 143, 40);
}
}
}
ef = graphics.MeasureString(text.text, txtFont, 145);
nWidth = 145;
while (ef.Height > 40 * nWidth / 145f)
{
nWidth += 3;
ef = graphics.MeasureString(text.text, txtFont, nWidth);
}
graphics.TranslateTransform(16f, 195f);
graphics.ScaleTransform(145f / nWidth, 145f / nWidth);
graphics.DrawString(text.text, txtFont, textBrush, new RectangleF(0f, 0f, ef.Width, ef.Height));
graphics.ResetTransform();
}
try
{
Bitmap image = new Bitmap("./pico/" + code.ToString() + ".jpg");
graphics.CompositingMode = CompositingMode.SourceOver;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.SmoothingMode = SmoothingMode.AntiAlias;
if (data.isType(Type.TYPE_LINK))
{
graphics.DrawImage(image, 22, 47, 133, 133);
}
else if (data.isType(Type.TYPE_PENDULUM))
{
//graphics.DrawImage(image, 15, 50, 147, 109);
graphics.DrawImage(image, new Rectangle(15, 50, 147, 109), new Rectangle(0, 0, image.Width, image.Width * 109 / 147), GraphicsUnit.Pixel);
}
else if (!data.isType(Type.TYPE_XYZ))
{
graphics.DrawImage(image, 25, 54, 128, 128);
}
else
{
graphics.DrawImage(image, 24, 51, 128, 128);
}
}
catch (Exception e)
{
Console.WriteLine("Error prasing {0} {1}", data.code, e);
}
if (data.isType(Type.TYPE_LINK))
{
LinkMarker lm = (LinkMarker)data.defence;
if ((lm & LinkMarker.LINK_MARKER_BOTTOM_LEFT) == 0)
graphics.DrawImage(bLinkMarkers1[0], 14, 169, 18, 17);
else
graphics.DrawImage(bLinkMarkers2[0], 14, 169, 18, 17);
if ((lm & LinkMarker.LINK_MARKER_BOTTOM) == 0)
graphics.DrawImage(bLinkMarkers1[1], 73, 178, 32, 12);
else
graphics.DrawImage(bLinkMarkers2[1], 73, 178, 32, 12);
if ((lm & LinkMarker.LINK_MARKER_BOTTOM_RIGHT) == 0)
graphics.DrawImage(bLinkMarkers1[2], 145, 169, 18, 17);
else
graphics.DrawImage(bLinkMarkers2[2], 145, 169, 18, 17);
if ((lm & LinkMarker.LINK_MARKER_LEFT) == 0)
graphics.DrawImage(bLinkMarkers1[3], 11, 97, 12, 32);
else
graphics.DrawImage(bLinkMarkers2[3], 11, 97, 12, 32);
if ((lm & LinkMarker.LINK_MARKER_RIGHT) == 0)
graphics.DrawImage(bLinkMarkers1[5], 154, 97, 12, 32);
else
graphics.DrawImage(bLinkMarkers2[5], 154, 97, 12, 32);
if ((lm & LinkMarker.LINK_MARKER_TOP_LEFT) == 0)
graphics.DrawImage(bLinkMarkers1[6], 14, 39, 18, 17);
else
graphics.DrawImage(bLinkMarkers2[6], 14, 39, 18, 17);
if ((lm & LinkMarker.LINK_MARKER_TOP) == 0)
graphics.DrawImage(bLinkMarkers1[7], 73, 36, 32, 12);
else
graphics.DrawImage(bLinkMarkers2[7], 73, 36, 32, 12);
if ((lm & LinkMarker.LINK_MARKER_TOP_RIGHT) == 0)
graphics.DrawImage(bLinkMarkers1[8], 146, 39, 18, 17);
else
graphics.DrawImage(bLinkMarkers2[8], 146, 39, 18, 17);
}
string str3 = text.name.Replace('\x00b7', '・');
float width = graphics.MeasureString(str3, nameFont).Width;
float sx = 1f;
if (width > 130f)
{
sx *= 130f / width;
}
if (data.isType(Type.TYPE_LINK))
{
graphics.TranslateTransform(10f, 13f);
}
else if (data.isType(Type.TYPE_XYZ))
{
graphics.TranslateTransform(12f, 13f);
}
else if (data.isType(Type.TYPE_PENDULUM))
{
graphics.TranslateTransform(12f, 13f);
}
else
{
graphics.TranslateTransform(14f, 17f);
}
graphics.ScaleTransform(sx, 1f);
graphics.DrawString(str3, nameFont, nameBrush, 0f, 0f);
graphics.DrawString(str3, nameFont, Brushes.Gold, 1f, 1f);
graphics.ResetTransform();
return bitmap;
}
public static Bitmap Zoom(Bitmap sourceBitmap, int newWidth, int newHeight)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment