Beispiel #1
0
 public void DrawWidth(GLEx g, int x, int y)
 {
     try {
         if (drawTexWidth == null)
         {
             LImage    img = LImage.CreateImage(width, height, true);
             LGraphics gl  = img.GetLGraphics();
             for (int i = 0; i < width; i++)
             {
                 gl.SetColor(
                     (start.GetRed() * (width - i)) / width
                     + (end.GetRed() * i) / width,
                     (start.GetGreen() * (width - i)) / width
                     + (end.GetGreen() * i) / width,
                     (start.GetBlue() * (width - i)) / width
                     + (end.GetBlue() * i) / width, alpha);
                 gl.DrawLine(i, 0, i, height);
             }
             drawTexWidth = new LTexture(GLLoader.GetTextureData(img),
                                         Loon.Core.Graphics.Opengl.LTexture.Format.SPEED);
             gl.Dispose();
             gl = null;
         }
         g.DrawTexture(drawTexWidth, x, y);
     } catch (Exception) {
         for (int i = 0; i < width; i++)
         {
             g.SetColorValue(
                 (start.GetRed() * (width - i)) / width
                 + (end.GetRed() * i) / width,
                 (start.GetGreen() * (width - i)) / width
                 + (end.GetGreen() * i) / width,
                 (start.GetBlue() * (width - i)) / width
                 + (end.GetBlue() * i) / width, alpha);
             g.DrawLine(i + x, y, i + x, y + height);
         }
     }
 }
Beispiel #2
0
 public void DrawHeight(GLEx g, int x, int y)
 {
     try {
         if (drawTexHeight == null)
         {
             LImage    img = LImage.CreateImage(width, height, true);
             LGraphics gl  = img.GetLGraphics();
             for (int i = 0; i < height; i++)
             {
                 gl.SetColor(
                     (start.GetRed() * (height - i)) / height
                     + (end.GetRed() * i) / height,
                     (start.GetGreen() * (height - i)) / height
                     + (end.GetGreen() * i) / height,
                     (start.GetBlue() * (height - i)) / height
                     + (end.GetBlue() * i) / height, alpha);
                 gl.DrawLine(0, i, width, i);
             }
             drawTexHeight = new LTexture(GLLoader.GetTextureData(img),
                                          Loon.Core.Graphics.Opengl.LTexture.Format.SPEED);
             gl.Dispose();
             gl = null;
         }
         g.DrawTexture(drawTexHeight, x, y);
     } catch (Exception) {
         for (int i = 0; i < height; i++)
         {
             g.SetColorValue(
                 (start.GetRed() * (height - i)) / height
                 + (end.GetRed() * i) / height,
                 (start.GetGreen() * (height - i)) / height
                 + (end.GetGreen() * i) / height,
                 (start.GetBlue() * (height - i)) / height
                 + (end.GetBlue() * i) / height, alpha);
             g.DrawLine(x, i + y, x + width, i + y);
         }
     }
 }
Beispiel #3
0
 public void DrawHeight(LGraphics g, int x, int y)
 {
     try {
         if (drawImgHeight == null)
         {
             drawImgHeight = LImage.CreateImage(width, height, true);
             LGraphics gl = drawImgHeight.GetLGraphics();
             for (int i = 0; i < height; i++)
             {
                 gl.SetColor(
                     (start.GetRed() * (height - i)) / height
                     + (end.GetRed() * i) / height,
                     (start.GetGreen() * (height - i)) / height
                     + (end.GetGreen() * i) / height,
                     (start.GetBlue() * (height - i)) / height
                     + (end.GetBlue() * i) / height, alpha);
                 gl.DrawLine(0, i, width, i);
             }
             gl.Dispose();
             gl = null;
         }
         g.DrawImage(drawImgHeight, x, y);
     } catch (Exception) {
         for (int i = 0; i < height; i++)
         {
             g.SetColor(
                 (start.GetRed() * (height - i)) / height
                 + (end.GetRed() * i) / height,
                 (start.GetGreen() * (height - i)) / height
                 + (end.GetGreen() * i) / height,
                 (start.GetBlue() * (height - i)) / height
                 + (end.GetBlue() * i) / height, alpha);
             g.DrawLine(x, i + y, x + width, i + y);
         }
     }
 }
Beispiel #4
0
 public void DrawWidth(LGraphics g, int x, int y)
 {
     try {
         if (drawImgWidth == null)
         {
             drawImgWidth = LImage.CreateImage(width, height, true);
             LGraphics gl = drawImgWidth.GetLGraphics();
             for (int i = 0; i < width; i++)
             {
                 gl.SetColor(
                     (start.GetRed() * (width - i)) / width
                     + (end.GetRed() * i) / width,
                     (start.GetGreen() * (width - i)) / width
                     + (end.GetGreen() * i) / width,
                     (start.GetBlue() * (width - i)) / width
                     + (end.GetBlue() * i) / width, alpha);
                 gl.DrawLine(i, 0, i, height);
             }
             gl.Dispose();
             gl = null;
         }
         g.DrawImage(drawImgWidth, x, y);
     } catch (Exception) {
         for (int i = 0; i < width; i++)
         {
             g.SetColor(
                 (start.GetRed() * (width - i)) / width
                 + (end.GetRed() * i) / width,
                 (start.GetGreen() * (width - i)) / width
                 + (end.GetGreen() * i) / width,
                 (start.GetBlue() * (width - i)) / width
                 + (end.GetBlue() * i) / width, alpha);
             g.DrawLine(i + x, y, i + x, y + height);
         }
     }
 }