Beispiel #1
0
            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);
            }