private static Bitmap texture1() { int h = 0x40; int bmpW = h << 0x01; int bmpH = h << 0x02; Bitmap bmp = new Bitmap(bmpW, bmpH); Graphics g = Graphics.FromImage(bmp); g.CompositingQuality = CompositingQuality.HighQuality; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.SmoothingMode = SmoothingMode.HighQuality; g.InterpolationMode = InterpolationMode.HighQualityBicubic; float h_2 = 0.5f * h; float rightEnd = h * 2.0f; float margin = h / 48.0f; float margin2 = margin * 2.0f; float margin3 = margin * 3.0f; float r = h / 36.0f; float r2 = 2.0f * r; float s = 0.25f * h; float s2 = s * 2.0f; float s3 = s * 3.0f; float t = 0.5f * s; float t2 = t * 2.0f; float t3 = t * 3.0f; float temp = (margin + s + t - h_2); float R = temp - 4.0f * temp * (float)Math.Sqrt(0.5f); float xP = (2.0f - (float)Math.Sqrt(2.0f)) * temp + r + h_2; float R2 = 2.0f * R; int royalN = 7; float gamma = 180.0f / royalN; float penW = h / 1024.0f; for (int l = 0x00; l < 0x03; l++) { using (GraphicsPath gpNocturne = new GraphicsPath()) { gpNocturne.AddArc(margin, margin, h - margin2, h - margin2, 90.0f, 180.0f); gpNocturne.AddLine(h_2, margin, rightEnd, margin); gpNocturne.AddLine(rightEnd, margin, rightEnd, h - margin); gpNocturne.AddLine(rightEnd, h - margin, h_2, h - margin); gpNocturne.CloseFigure(); if (l == 0x01) { g.FillPath(EgyptInformation.Brushes.EgyptLure, gpNocturne); } else { g.FillPath(EgyptInformation.Brushes.EgyptNocturne, gpNocturne); } } using (GraphicsPath gpGold = new GraphicsPath()) { for (int i = 0x00; i < royalN;) { using (GraphicsPath gpRoyal = new GraphicsPath()) { gpRoyal.AddArc(margin + r, margin + r, h - margin2 - r2, h - margin2 - r2, 90 + gamma * i++, gamma); gpRoyal.AddArc(margin + s, margin + s, h - margin2 - s2, h - margin2 - s2, 90 + gamma * i, -gamma); gpRoyal.CloseFigure(); g.FillPath((((i & 0x01) == 0x01) ? EgyptInformation.Brushes.EgyptPaintBlue : EgyptInformation.Brushes.EgyptPaintRed), gpRoyal); } } gpGold.AddArc(margin, margin, h - margin2, h - margin2, 90.0f, 180.0f); gpGold.AddLine(h_2, margin, rightEnd, margin); gpGold.AddLine(rightEnd, margin, rightEnd, margin + r); gpGold.AddLine(rightEnd, margin + r, h_2 + r, margin + r); gpGold.AddLine(h_2 + r, margin + r, h_2 + r, s + t + margin); //flower gpGold.AddArc(r + margin + s + t, margin3 + s3 + t3 - h, h - margin2 - s2 - t2, h - margin2 - s2 - t2, 90.0f, -45.0f); gpGold.AddArc(xP - R, h_2 - R, R2, R2, -45.0f, 90.0f); gpGold.AddArc(r + margin + s + t, h - margin - s - t, h - margin2 - s2 - t2, h - margin2 - s2 - t2, -45.0f, -45.0f); gpGold.AddLine(h_2 + r, h - s - t - margin, h_2 + r, h - margin - r); gpGold.AddLine(h_2 + r, h - margin - r, rightEnd, h - margin - r); gpGold.AddLine(rightEnd, h - margin - r, rightEnd, h - margin); gpGold.AddLine(rightEnd, h - margin, h_2, h - margin); gpGold.CloseFigure(); gpGold.AddArc(margin + r, margin + r, h - margin2 - r2, h - margin2 - r2, 90.0f, 180.0f); gpGold.AddLine(h_2, margin + r, h_2, margin + s); gpGold.AddArc(margin + s, margin + s, h - margin2 - s2, h - margin2 - s2, 270.0f, -180.0f); gpGold.AddLine(h_2, h - margin - s, h_2, h - margin - r); gpGold.CloseFigure(); gpGold.AddArc(margin + r + s, margin + r + s, h - margin2 - r2 - s2, h - margin2 - r2 - s2, 90.0f, 180.0f); gpGold.AddLine(h_2, margin + r + s, h_2, margin + s + t); gpGold.AddArc(margin + s + t, margin + s + t, h - margin2 - s2 - t2, h - margin2 - s2 - t2, 270.0f, -180.0f); gpGold.AddLine(h_2, h - margin - s - t, h_2, h - margin - r - s); gpGold.CloseFigure(); g.FillPath(EgyptInformation.Brushes.EgyptGold, gpGold); GraphicsUtils.DrawGlass(g, gpGold); //g.DrawPath(new Pen(Color.Black,penW),gpGold); using (GraphicsPath gpTurquoise = new GraphicsPath()) { gpTurquoise.AddEllipse(margin + r + s + t, margin + r + s + t, h - margin2 - r2 - s2 - t2, h - margin2 - r2 - s2 - t2); gpTurquoise.CloseFigure(); g.FillPath(EgyptInformation.Brushes.EgyptPaintTurquoise, gpTurquoise); Region oldRegion = g.Clip; g.Clip = new Region(gpTurquoise); if (l == 0x01) { using (GraphicsPath gpGlow = new GraphicsPath()) { gpGlow.AddEllipse(margin2 + r2 + s2 + t2 - h_2, margin + r + s + t, 2.0f * (h - margin2 - r2 - s2 - t2), 2.0f * (h - margin2 - r2 - s2 - t2)); gpGlow.CloseFigure(); PathGradientBrush pgbGlow = new PathGradientBrush(gpGlow); pgbGlow.CenterColor = EgyptInformation.Colors.EgyptPaintRed; pgbGlow.SurroundColors = new Color[] { Color.Transparent }; g.FillPath(pgbGlow, gpGlow); } } LinearGradientBrush lgbGlass = new LinearGradientBrush(new PointF(0.0f, margin + r + s + t), new PointF(0.0f, h_2 - margin - r - s - t), Color.FromArgb(0x50, 0xff, 0xff, 0xff), Color.FromArgb(0x80, 0xff, 0xff, 0xff)); g.FillEllipse(lgbGlass, margin + r + s + t, margin2 + r2 + s2 + t2 - h_2, h - margin2 - r2 - s2 - t2, h - margin2 - r2 - s2 - t2); g.Clip = oldRegion; g.DrawPath(new Pen(Color.Black, penW), gpTurquoise); } } g.TranslateTransform(0.0f, h); } GraphicsUtils.DrawSepia(bmp, 0x00, 0x00, bmpW, bmpH >> 0x02, 0x00, 0x03 * bmpH / 0x04); bmp.Save("ti.png"); return(bmp); }
private static Bitmap texture0() { int w = 0xc0; int wa = w / 0x03; int h = 0x80; float m = 2.0f; float t = 3.0f; float mt = m + t; float t_2 = 0.5f * t; float R = w / 3 - m; float r = R - t; float s = r - t; float R2 = 2.0f * R; float r2 = 2.0f * r; Bitmap bmp = new Bitmap(0x04 * w / 0x03, 0x02 * h); Graphics g = Graphics.FromImage(bmp); g.CompositingQuality = CompositingQuality.HighQuality; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.SmoothingMode = SmoothingMode.HighQuality; g.InterpolationMode = InterpolationMode.HighQualityBicubic; using (GraphicsPath gpLure = new GraphicsPath()) { gpLure.AddArc(m, m, R2, R2, 180.0f, 90.0f); gpLure.AddLine(m + R, m, w - m - R, m); gpLure.AddArc(w - m - R2, m, R2, R2, 270.0f, 90.0f); gpLure.AddLine(w - m, m + R, w - m, w - m - R); gpLure.AddArc(w - m - R2, w - m - R2, R2, R2, 0.0f, 90.0f); gpLure.AddLine(w - m - R, w - m, m + R, w - m); gpLure.AddArc(m, w - m - R2, R2, R2, 90.0f, 90.0f); gpLure.AddLine(m, w - m - R, m, m + R); gpLure.CloseFigure(); g.FillPath(EgyptInformation.Brushes.EgyptLure, gpLure); } using (GraphicsPath gpGold = new GraphicsPath()) { gpGold.AddArc(m, m, R2, R2, 180.0f, 90.0f); gpGold.AddLine(m + R, m, w - m - R, m); gpGold.AddArc(w - m - R2, m, R2, R2, 270.0f, 90.0f); gpGold.AddLine(w - m, m + R, w - m, w - m - R); gpGold.AddArc(w - m - R2, w - m - R2, R2, R2, 0.0f, 90.0f); gpGold.AddLine(w - m - R, w - m, m + R, w - m); gpGold.AddArc(m, w - m - R2, R2, R2, 90.0f, 90.0f); gpGold.AddLine(m, w - m - R, m, m + R); gpGold.CloseFigure(); gpGold.AddArc(mt, mt, r2, r2, 180.0f, 90.0f); gpGold.AddLine(m + R, mt, w - m - R, mt); gpGold.AddArc(w - mt - r2, mt, r2, r2, 270.0f, 90.0f); gpGold.AddLine(w - mt, m + R, w - mt, w - m - R); gpGold.AddArc(w - mt - r2, w - mt - r2, r2, r2, 0.0f, 90.0f); gpGold.AddLine(w - m - R, w - mt, m + R, w - mt); gpGold.AddArc(mt, w - mt - r2, r2, r2, 90.0f, 90.0f); gpGold.AddLine(mt, w - m - R, mt, m + R); gpGold.CloseFigure(); g.FillPath(EgyptInformation.Brushes.EgyptGold, gpGold); GraphicsUtils.DrawGlass(g, gpGold); } g.FillEllipse(EgyptInformation.Brushes.EgyptNocturne, m, h + wa + m, R, R); using (GraphicsPath gpTurquoise = new GraphicsPath()) { gpTurquoise.AddEllipse(wa + m + t, h + wa + m + t, s, s); g.FillPath(EgyptInformation.Brushes.EgyptPaintTurquoise, gpTurquoise); GraphicsUtils.DrawGlass(g, gpTurquoise); } g.FillEllipse(EgyptInformation.Brushes.EgyptNocturne, m, h + wa + m, R, R); for (int i = 0x00; i < 0x02; i++) { using (GraphicsPath gpGold = new GraphicsPath()) { gpGold.AddEllipse(wa * i + m, h + m + wa, R, R); gpGold.AddEllipse(wa * i + m + t, h + m + wa + t, s, s); g.FillPath(EgyptInformation.Brushes.EgyptGold, gpGold); GraphicsUtils.DrawGlass(g, gpGold); } } g.FillRectangle(EgyptInformation.Brushes.EgyptPaintBlue, wa * 2.5f - 0.5f * t, h + wa, t, wa); bmp.Save("ti.png"); return(bmp); }
public void OnLoad(EventArgs e) { Bitmap bmp = new Bitmap(this.Height * 0x06, this.Height * 0x02); Graphics g = Graphics.FromImage(bmp); g.CompositingQuality = CompositingQuality.HighQuality; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.SmoothingMode = SmoothingMode.HighQuality; g.InterpolationMode = InterpolationMode.HighQualityBicubic; float w = 6.0f * this.Height; int hInt = this.Height; float h = (float)hInt; float margin = h / 48.0f; float m2 = 2.0f * margin; float r = h / 36.0f; ///36.0f float r2 = 2.0f * r; float h_2 = 0.5f * h; float Ro = h_2 - margin; float alpha = (float)(180.0d / Math.PI * Math.Acos(1.0d - 0.5d * r / Ro)); float beta = (float)(180.0d / Math.PI * Math.Acos(1.0d - r / Ro)); float betaY = (float)Math.Sqrt(Ro * Ro - (Ro - r) * (Ro - r)); float sqrtR2 = (float)(Math.Sqrt(0.5d) * (h - m2 - r2)); float __R2 = h_2 - margin - r; __R2 *= __R2; for (int l = 0x00; l < 0x02; l++) { using (GraphicsPath gpNocturne = new GraphicsPath()) { //left wing gpNocturne.AddArc(0.5f * w - h + m2, margin, h - m2, h - m2, 180.0f + alpha, 360.0f - 2.0f * alpha); gpNocturne.AddArc(0.5f * w + 2.0f * (m2 - h) + r, margin, h - m2, h - m2, alpha, 90.0f - alpha); gpNocturne.AddLine(0.5f * w + 1.5f * m2 + r - 1.5f * h, h - margin, h_2, h - margin); gpNocturne.AddArc(margin, margin, h - m2, h - m2, 90.0f, 90.0f - beta); gpNocturne.AddLine(margin + r, h_2 + betaY, margin + r, h - margin); gpNocturne.AddLine(margin + r, h - margin, margin, h - margin); gpNocturne.AddLine(margin, h - margin, margin, margin); gpNocturne.AddLine(margin, margin, margin + r, margin); gpNocturne.AddLine(margin + r, margin, margin + r, h_2 - betaY); gpNocturne.AddArc(margin, margin, h - m2, h - m2, 180.0f + beta, 90.0f - beta); gpNocturne.AddLine(h_2, margin, 0.5f * w + 1.5f * m2 + r - 1.5f * h, margin); gpNocturne.AddArc(0.5f * w + 2.0f * (m2 - h) + r, margin, h - m2, h - m2, 270.0f, 90.0f - alpha); gpNocturne.CloseFigure(); //right wing gpNocturne.AddArc(0.5f * w, margin, h - m2, h - m2, 360.0f - alpha, 2.0f * alpha - 360.0f); gpNocturne.AddArc(0.5f * w + h - m2 - r, margin, h - m2, h - m2, 180.0f - alpha, alpha - 90.0f); gpNocturne.AddLine(0.5f * w + 2.0f * (h - m2) - r, h - margin, w - h_2, h - margin); gpNocturne.AddArc(w - h + margin, margin, h - m2, h - m2, 90.0f, beta - 90.0f); gpNocturne.AddLine(w - margin - r, h_2 + betaY, w - margin - r, h - margin); gpNocturne.AddLine(w - margin - r, h - margin, w - margin, h - margin); gpNocturne.AddLine(w - margin, h - margin, w - margin, margin); gpNocturne.AddLine(w - margin, margin, w - margin - r, margin); gpNocturne.AddLine(w - margin - r, margin, w - margin - r, h_2 - betaY); gpNocturne.AddArc(w - h + margin, margin, h - m2, h - m2, -beta, beta - 90.0f); gpNocturne.AddLine(w - h_2, margin, 0.5f * w + 2.0f * (h - m2) - r, margin); gpNocturne.AddArc(0.5f * w + h - m2 - r, margin, h - m2, h - m2, 270.0f, alpha - 90.0f); gpNocturne.CloseFigure(); if (l == 0x00) { g.FillPath(EgyptInformation.Brushes.EgyptNocturne, gpNocturne); } else { g.FillPath(EgyptInformation.Brushes.EgyptPaintBlue, gpNocturne); } //g.FillPath(new SolidBrush(Color.FromArgb(0x4c,0x41,0x0b)),gpNocturne); using (GraphicsPath gpGold = new GraphicsPath()) { gpGold.AddPath(gpNocturne, false); //left inner gpGold.AddArc(margin + r, margin + r, h - m2 - r2, h - m2 - r2, 90.0f, 180.0f); gpGold.AddArc(0.5f * w + 2.0f * (m2 - h) + r2, margin + r, h - m2 - r2, h - m2 - r2, 270.0f, 180.0f); gpGold.CloseFigure(); //left ellipse gpGold.AddEllipse(0.5f * w - h + m2 + r, margin + r, h - m2 - r2, h - m2 - r2); gpGold.CloseFigure(); //right inner gpGold.AddArc(w - h + margin + r, margin + r, h - m2 - r2, h - m2 - r2, 90.0f, -180.0f); gpGold.AddArc(0.5f * w + h - m2, margin + r, h - m2 - r2, h - m2 - r2, 270.0f, -180.0f); gpGold.CloseFigure(); //right ellipse gpGold.AddEllipse(0.5f * w + r, margin + r, h - m2 - r2, h - m2 - r2); gpGold.CloseFigure(); g.FillPath(EgyptInformation.Brushes.EgyptGold, gpGold); GraphicsUtils.DrawGlass(g, gpGold); } Matrix M = new Matrix(); M.Scale(sqrtR2, sqrtR2); RectangleF bounds; Matrix Mtrans = new Matrix(); GraphicsPath gpHedjet = EgyptInformation.GraphicsPaths.Hedjet(); gpHedjet.Transform(M); bounds = gpHedjet.GetBounds(); Mtrans.Translate(-0.5f * bounds.Width, 0.0f); Mtrans.Scale(-1.0f, 1.0f, MatrixOrder.Append); Mtrans.Translate(0.5f * (w - h + m2), h_2 - 0.5f * bounds.Height, MatrixOrder.Append); gpHedjet.Transform(Mtrans); g.FillPath(EgyptInformation.Brushes.EgyptPaintWhite, gpHedjet); GraphicsUtils.DrawGlass(g, gpHedjet); GraphicsPath gpDeshret = EgyptInformation.GraphicsPaths.Deshret(); gpDeshret.Transform(M); bounds = gpDeshret.GetBounds(); Mtrans.Reset(); Mtrans.Translate(0.5f * (w + h - m2 - bounds.Width), h_2 - 0.5f * bounds.Height); gpDeshret.Transform(Mtrans); g.FillPath(EgyptInformation.Brushes.EgyptPaintRed, gpDeshret); GraphicsUtils.DrawGlass(g, gpDeshret); } g.TranslateTransform(0.0f, h); } BitmapData bmd = bmp.LockBits(new Rectangle(0x00, 0x00, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); this.texturePointer = GL.GenTexture(); GL.BindTexture(TextureTarget.Texture2D, this.texturePointer); GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (float)TextureEnvMode.Modulate); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (float)TextureMinFilter.LinearMipmapLinear); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (float)TextureMagFilter.Linear); Glu.Glu.Build2DMipmap(Glu.TextureTarget.Texture2D, (int)PixelInternalFormat.Four, bmp.Width, bmp.Height, OpenTK.Graphics.PixelFormat.Bgra, Glu.PixelType.UnsignedByte, bmd.Scan0); bmp.UnlockBits(bmd); }