Example #1
0
 public static void Lcd_Draw_Circle(ushort x0, ushort y0, ushort r, ushort color)
 {
     if (r <= x0 && r <= y0 && y0 + r <= Lcd.myapp.upapp.lcddev.height && x0 + r <= Lcd.myapp.upapp.lcddev.width)
     {
         int i    = 0;
         int num  = (int)r;
         int num2 = 3 - ((int)r << 1);
         while (i <= num)
         {
             Lcd.Lcd_DrawPoint((int)((ushort)((int)x0 + i)), (int)((ushort)((int)y0 - num)), color);
             Lcd.Lcd_DrawPoint((int)((ushort)((int)x0 + num)), (int)((ushort)((int)y0 - i)), color);
             Lcd.Lcd_DrawPoint((int)((ushort)((int)x0 + num)), (int)((ushort)((int)y0 + i)), color);
             Lcd.Lcd_DrawPoint((int)((ushort)((int)x0 + i)), (int)((ushort)((int)y0 + num)), color);
             Lcd.Lcd_DrawPoint((int)((ushort)((int)x0 - i)), (int)((ushort)((int)y0 + num)), color);
             Lcd.Lcd_DrawPoint((int)((ushort)((int)x0 - num)), (int)((ushort)((int)y0 + i)), color);
             Lcd.Lcd_DrawPoint((int)((ushort)((int)x0 - i)), (int)((ushort)((int)y0 - num)), color);
             Lcd.Lcd_DrawPoint((int)((ushort)((int)x0 - num)), (int)((ushort)((int)y0 - i)), color);
             i++;
             if (num2 < 0)
             {
                 num2 += 4 * i + 6;
             }
             else
             {
                 num2 += 10 + 4 * (i - num);
                 num--;
             }
         }
     }
 }
Example #2
0
        public static void Lcd_DrawLine(int x1, int y1, int x2, int y2, ushort color, byte cu)
        {
            int num  = 0;
            int num2 = 0;
            int num3 = x2 - x1;
            int num4 = y2 - y1;
            int num5 = x1;
            int num6 = y1;
            int num7;

            if (num3 > 0)
            {
                num7 = 1;
            }
            else if (num3 == 0)
            {
                num7 = 0;
            }
            else
            {
                num7 = -1;
                num3 = -num3;
            }
            int num8;

            if (num4 > 0)
            {
                num8 = 1;
            }
            else if (num4 == 0)
            {
                num8 = 0;
            }
            else
            {
                num8 = -1;
                num4 = -num4;
            }
            int num9;

            if (num3 > num4)
            {
                num9 = num3;
            }
            else
            {
                num9 = num4;
            }
            ushort num10 = 0;

            while ((int)num10 <= num9 + 1)
            {
                if (cu == 1)
                {
                    Lcd.Lcd_DrawPoint((int)((ushort)num5), (int)((ushort)num6), color);
                }
                else
                {
                    Lcd.Lcd_Fill((int)((ushort)num5), (int)((ushort)num6), (int)cu, (int)cu, color);
                }
                num  += num3;
                num2 += num4;
                if (num > num9)
                {
                    num  -= num9;
                    num5 += num7;
                }
                if (num2 > num9)
                {
                    num2 -= num9;
                    num6 += num8;
                }
                num10 += 1;
            }
        }
Example #3
0
        private static void SendZiku(int x, int y, byte h, byte l)
        {
            byte[] array = new byte[2];
            int    num   = x;
            int    num2  = y;
            byte   b     = 0;

            if (Showfont.myapp.brush.pw != 0)
            {
                h = 0;
                l = Showfont.myapp.brush.pw;
            }
            uint num3 = Showfont.myapp.brush.mzimo.addbeg + Showfont.myapp.app.zimodataadd + (uint)Showfont.myapp.brush.mzimo.datastar;

            if (Showfont.myapp.brush.mzimo.state == 1)
            {
                if (h != 0)
                {
                    if (l > Showfont.myapp.brush.mzimo.codelT0)
                    {
                        l -= Showfont.myapp.brush.mzimo.codelV0;
                    }
                    b     = Showfont.myapp.brush.mzimo.w;
                    num3 += (uint)(((h - Showfont.myapp.brush.mzimo.codeh_star) * (Showfont.myapp.brush.mzimo.codel_end - Showfont.myapp.brush.mzimo.codel_star - Showfont.myapp.brush.mzimo.codelV0 + 1) + (l - Showfont.myapp.brush.mzimo.codel_star)) * (Showfont.myapp.brush.mzimo.w / 8) * Showfont.myapp.brush.mzimo.h);
                }
                else
                {
                    b     = Convert.ToByte(Showfont.myapp.brush.mzimo.w / 2);
                    num3 += (uint)((ulong)(Showfont.myapp.brush.mzimo.qyt - 95u + (uint)l - 32u) * (ulong)((long)(Showfont.myapp.brush.mzimo.w / 8)) * (ulong)Showfont.myapp.brush.mzimo.h);
                }
            }
            else if (Showfont.myapp.brush.mzimo.state == 0)
            {
                b     = Showfont.myapp.brush.mzimo.w;
                num3 += (uint)((l - 32) * (Showfont.myapp.brush.mzimo.h / 8 * Showfont.myapp.brush.mzimo.w));
            }
            else if (Showfont.myapp.brush.mzimo.state == 2)
            {
                if (h > 0)
                {
                    b = Showfont.myapp.brush.mzimo.w;
                }
                else
                {
                    b = Convert.ToByte(Showfont.myapp.brush.mzimo.w / 2);
                }
                num3 = Showfont.Findziadd(h, l, ref Showfont.myapp.brush.mzimo);
            }
            ushort num4 = (ushort)(Showfont.myapp.brush.mzimo.h / 8 * b);

            switch (Showfont.myapp.upapp.lcddev.guidire)
            {
            case 1:
                y = (int)((ushort)(num2 + (int)Showfont.myapp.brush.mzimo.h - 1));
                break;

            case 2:
                x = (int)((ushort)(num + (int)b - 1));
                y = (int)((ushort)(num2 + (int)Showfont.myapp.brush.mzimo.h - 1));
                break;

            case 3:
                x = (int)((ushort)(num + (int)b - 1));
                break;
            }
            for (uint num5 = 0u; num5 < (uint)num4; num5 += 1u)
            {
                Readdata.SPI_Flash_Read(ref array, num3 + num5, 1u);
                for (byte b2 = 0; b2 < 8; b2 += 1)
                {
                    if (((int)array[0] & 1 << (int)(7 - b2)) > 0)
                    {
                        if (x >= (int)Showfont.myapp.brush.x && x <= (int)Showfont.myapp.brush.endx && y >= (int)Showfont.myapp.brush.y && y <= (int)Showfont.myapp.brush.endy)
                        {
                            Lcd.Lcd_DrawPoint(x, y, Showfont.myapp.brush.pointcolor);
                        }
                    }
                    switch (Showfont.myapp.upapp.lcddev.guidire)
                    {
                    case 0:
                        x++;
                        if (x - num == (int)b)
                        {
                            x = num;
                            y++;
                        }
                        break;

                    case 1:
                        y--;
                        if (y < num2)
                        {
                            y = (int)((ushort)(num2 + (int)Showfont.myapp.brush.mzimo.h - 1));
                            x++;
                        }
                        break;

                    case 2:
                        x--;
                        if (x < num)
                        {
                            x = (int)((ushort)(num + (int)b - 1));
                            y--;
                        }
                        break;

                    case 3:
                        y++;
                        if (y >= num2 + (int)Showfont.myapp.brush.mzimo.h)
                        {
                            y = num2;
                            x--;
                        }
                        break;
                    }
                }
            }
        }