示例#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--;
             }
         }
     }
 }
示例#2
0
文件: Touch.cs 项目: skyclub66/HMI
 public unsafe static void Touch_Tpscan()
 {
     if (Touch.myapp.upapp.tp_dev.touchstate == 1)
     {
         Touch.myapp.upapp.tp_dev.x_now = (ushort)(Control.MousePosition.X - Touch.myapp.upapp.mouse_pos.X + (int)Touch.myapp.upapp.tp_dev.x_down);
         Touch.myapp.upapp.tp_dev.y_now = (ushort)(Control.MousePosition.Y - Touch.myapp.upapp.mouse_pos.Y + (int)Touch.myapp.upapp.tp_dev.y_down);
         if (Touch.myapp.dra == 1)
         {
             Lcd.Lcd_Fill((int)Touch.myapp.upapp.tp_dev.x_now, (int)Touch.myapp.upapp.tp_dev.y_now, 2, 2, Touch.myapp.dracolor);
         }
         if (Touch.myapp.Hexstrindex == 65535 && Touch.myapp.moveobjstate > 0 && Touch.myapp.systime.movetime > 20u)
         {
             objxinxi objxinxi = default(objxinxi);
             Readdata.Readdata_ReadObj(ref objxinxi, (int)((ushort)Touch.myapp.downobjid + Touch.myapp.dpagexinxi.objstar));
             if (GuiSlider.GuiSliderPressMove(&objxinxi, Touch.myapp.downobjid) > 0)
             {
                 if (objxinxi.redian.events.Slide != 0 && Touch.myapp.Hexstrindex == 65535)
                 {
                     Touch.myapp.Hexstrindex = (ushort)(objxinxi.redian.events.Slide + objxinxi.zhilingstar);
                 }
             }
             Touch.myapp.systime.movetime = 0u;
         }
     }
 }
示例#3
0
 public static void Lcd_DrawRectangle3D(ushort x1, ushort y1, ushort x2, ushort y2, ushort color1, ushort color2, byte wid)
 {
     Lcd.Lcd_Fill((int)x1, (int)y1, (int)(x2 - x1 + 1), (int)wid, color1);
     Lcd.Lcd_Fill((int)x1, (int)(y2 - (ushort)wid + 1), (int)(x2 - x1 + 1), (int)wid, color2);
     Lcd.Lcd_Fill((int)x1, (int)y1, (int)wid, (int)(y2 - y1 + 1), color1);
     Lcd.Lcd_Fill((int)(x2 - (ushort)wid + 1), (int)y1, (int)wid, (int)(y2 - y1 + 1), color2);
 }
示例#4
0
 public static void Lcd_WR_POINT(uint qyt, ushort color)
 {
     for (uint num = 0u; num < qyt; num += 1u)
     {
         Lcd.Lcd_SendColorData(color);
     }
 }
示例#5
0
 public static void Lcd_Draw_Circles(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)
         {
             uint qyt = (uint)(i * 2 + 1);
             Lcd.LCD_addset((int)((ushort)((int)x0 - num)), (int)((ushort)((int)y0 - i)), (int)((ushort)((int)x0 - num)), (int)((ushort)((int)y0 + i)), 1);
             Lcd.Lcd_WR_POINT(qyt, color);
             Lcd.LCD_addset((int)((ushort)((int)x0 + num)), (int)((ushort)((int)y0 - i)), (int)((ushort)((int)x0 + num)), (int)((ushort)((int)y0 + i)), 1);
             Lcd.Lcd_WR_POINT(qyt, color);
             qyt = (uint)(num * 2 + 1);
             Lcd.LCD_addset((int)((ushort)((int)x0 - i)), (int)((ushort)((int)y0 - num)), (int)((ushort)((int)x0 - i)), (int)((ushort)((int)y0 + num)), 1);
             Lcd.Lcd_WR_POINT(qyt, color);
             Lcd.LCD_addset((int)((ushort)((int)x0 + i)), (int)((ushort)((int)y0 - num)), (int)((ushort)((int)x0 + i)), (int)((ushort)((int)y0 + num)), 1);
             Lcd.Lcd_WR_POINT(qyt, color);
             i++;
             if (num2 < 0)
             {
                 num2 += 4 * i + 6;
             }
             else
             {
                 num2 += 10 + 4 * (i - num);
                 num--;
             }
         }
     }
 }
示例#6
0
 public static void Lcd_SendFill(ushort color, int qyt)
 {
     for (int i = 0; i < qyt; i++)
     {
         Lcd.Lcd_SendColorData(color);
     }
 }
示例#7
0
        public static void Lcd_Draw_h(ushort x0, ushort y0, ushort r, ushort jiao, byte cu, ushort color)
        {
            double num  = (double)r;
            double num2 = 3.141592653 * (double)jiao / 180.0;
            double num3 = num * Math.Cos(num2);
            double num4 = num * Math.Sin(num2);

            Lcd.Lcd_DrawLine((int)((ushort)((double)x0 - num3)), (int)((ushort)((double)y0 - num4)), (int)x0, (int)y0, color, cu);
        }
示例#8
0
文件: GuiCurve.cs 项目: skyclub66/HMI
        public unsafe static byte CurveRefBack(objxinxi *obj, byte ID)
        {
            byte[]       array = new byte[0];
            CURVE_PARAM *ptr;

            if (GuiCurve.myapp.upapp.runapptype == runapptype.bianji)
            {
                GuiCurve.GuiCurvePageInit();
                ptr = (CURVE_PARAM *)GuiCurve.myapp.mymerry;
            }
            else
            {
                ptr = (CURVE_PARAM *)(GuiCurve.myapp.mymerry + obj->attpos);
            }
            if (GuiCurve.myapp.upapp.runapptype == runapptype.bianji || GuiCurve.myapp.pageobjs[ID].vis == 1)
            {
                if (ptr->BackType == 0)
                {
                    Showpic.Showpic_ShowXpic((int)obj->redian.x, (int)obj->redian.y, (ushort)(obj->redian.endx - obj->redian.x + 1), (ushort)(obj->redian.endy - obj->redian.y + 1), (int)obj->redian.x, (int)obj->redian.y, ptr->PicID);
                }
                else if (ptr->BackType == 2)
                {
                    Showpic.Showpic_ShowPic((int)obj->redian.x, (int)obj->redian.y, ptr->PicID);
                }
                else
                {
                    uint qyt = (uint)(ptr->objWid * ptr->objHig);
                    Lcd.LCD_addset((int)obj->redian.x, (int)obj->redian.y, (int)obj->redian.endx, (int)obj->redian.endy, 1);
                    Lcd.Lcd_WR_POINT(qyt, ptr->Bkclr);
                    if (ptr->GridX > 0)
                    {
                        for (short num = (short)obj->redian.x; num <= (short)obj->redian.endx; num += (short)ptr->GridX)
                        {
                            Lcd.LCD_addset((int)((ushort)num), (int)obj->redian.y, (int)((ushort)num), (int)obj->redian.endy, 1);
                            Lcd.Lcd_WR_POINT((uint)ptr->objHig, ptr->Griclr);
                        }
                    }
                    if (ptr->GridY > 0)
                    {
                        for (short num = (short)obj->redian.endy; num >= (short)obj->redian.y; num -= (short)ptr->GridY)
                        {
                            Lcd.LCD_addset((int)obj->redian.x, (int)((ushort)num), (int)obj->redian.endx, (int)((ushort)num), 1);
                            Lcd.Lcd_WR_POINT((uint)ptr->objWid, ptr->Griclr);
                        }
                    }
                }
            }
            return(1);
        }
示例#9
0
文件: Showpic.cs 项目: skyclub66/HMI
 public static void Showpic_Clearspa(int x, int y, int w, int h)
 {
     if (Showpic.myapp.brush.sta == 1)
     {
         Lcd.Lcd_Fill(x, y, w, h, Showpic.myapp.brush.backcolor);
     }
     else if (Showpic.myapp.brush.sta == 0)
     {
         Showpic.Showpic_Picq(x, y, (ushort)w, (ushort)h, x, y, ref Showpic.myapp.brush.pic);
     }
     else if (Showpic.myapp.brush.sta == 2)
     {
         Showpic.Showpic_Picq(x, y, (ushort)w, (ushort)h, (int)((ushort)(x - (int)Showpic.myapp.brush.x)), (int)((ushort)(y - (int)Showpic.myapp.brush.y)), ref Showpic.myapp.brush.pic);
     }
 }
示例#10
0
文件: Showpic.cs 项目: skyclub66/HMI
        public static void Showpic_SendData(uint address, uint qyt)
        {
            Showpic.myapp.upapp.filesr.BaseStream.Position = (long)((ulong)address);
            byte[] array = new byte[2];
            int    num   = 0;

            while ((long)num < (long)((ulong)qyt))
            {
                Showpic.myapp.upapp.filesr.BaseStream.Read(array, 0, 2);
                ushort num2 = (ushort)array[1];
                num2 *= 256;
                num2 += (ushort)array[0];
                Lcd.Lcd_SendColorData(num2);
                num++;
            }
        }
示例#11
0
 public static void Lcd_DrawRectangle(ushort x1, ushort y1, ushort x2, ushort y2, ushort color, byte wid)
 {
     Lcd.Lcd_DrawRectangle3D(x1, y1, x2, y2, color, color, wid);
 }
示例#12
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;
            }
        }
示例#13
0
文件: GuiCurve.cs 项目: skyclub66/HMI
        public unsafe static byte GuiCurveRef(objxinxi *obj, byte ID)
        {
            byte qyt = 0;

            byte[]       buffer         = new byte[4];
            ushort[]     numArray       = new ushort[4];
            ushort[]     numArray2      = new ushort[4];
            ushort[]     numArray3      = new ushort[4];
            ushort[]     numArray4      = new ushort[4];
            byte[]       buffer2        = new byte[4];
            int          num9           = 0;
            int          num10          = 0;
            Picturexinxi pic            = new Picturexinxi();
            CURVE_PARAM *curve_paramPtr = (CURVE_PARAM *)(myapp.mymerry + obj->attpos);

            CURVE_CHANNEL_PARAM *[] curve_channel_paramPtrArray = new CURVE_CHANNEL_PARAM *[4];
            short x     = 0;
            short num12 = 0;
            short endy  = 0;
            short y     = 0;
            short num17 = 0;

            if (curve_paramPtr->CH_qyt <= 4)
            {
                byte num3;
                for (num3 = 0; num3 < curve_paramPtr->CH_qyt; num3 = (byte)(num3 + 1))
                {
                    curve_channel_paramPtrArray[num3] = (CURVE_CHANNEL_PARAM *)((((uint)curve_paramPtr) + sizeof(CURVE_PARAM)) + (sizeof(CURVE_CHANNEL_PARAM) * num3));
                }
                byte num2 = 0;
                num3 = 0;
                while (num3 < curve_paramPtr->CH_qyt)
                {
                    buffer[num3]    = 1;
                    numArray3[num3] = curve_channel_paramPtrArray[num3]->DotLen;
                    if (numArray3[num3] > 0)
                    {
                        num2 = (byte)(num2 + 1);
                    }
                    numArray4[num3] = obj->redian.x;
                    if (curve_paramPtr->DrawDir == 0)
                    {
                        numArray[num3] = (ushort)(curve_channel_paramPtrArray[num3]->BufNext - 1);
                        num17          = -1;
                    }
                    else
                    {
                        num17 = (short)(curve_channel_paramPtrArray[num3]->BufNext - curve_channel_paramPtrArray[num3]->BufPos.star);
                        if (num17 >= numArray3[num3])
                        {
                            numArray[num3] = (ushort)(curve_channel_paramPtrArray[num3]->BufNext - curve_channel_paramPtrArray[num3]->DotLen);
                        }
                        else
                        {
                            numArray[num3] = (ushort)((curve_channel_paramPtrArray[num3]->BufPos.end - (curve_channel_paramPtrArray[num3]->DotLen - num17)) + 1);
                        }
                        if (curve_paramPtr->DrawDir == 2)
                        {
                            num17 = (short)((obj->redian.endx - obj->redian.x) + 1);
                            if (numArray3[num3] < num17)
                            {
                                numArray4[num3] = (ushort)(numArray4[num3] + ((ushort)(num17 - numArray3[num3])));
                            }
                        }
                        num17 = 1;
                    }
                    num3 = (byte)(num3 + 1);
                }
                if (num2 == 0)
                {
                    CurveRefBack(obj, ID);
                }
                else
                {
                    if (curve_paramPtr->BackType == 0)
                    {
                        qyt = 5;
                        Readdata.Readdata_ReadPic(ref pic, curve_paramPtr->PicID);
                        num9 = (int)(pic.addbeg + myapp.app.picdataadd);
                        if (myapp.upapp.lcddev.guidire == 0)
                        {
                            num9 += ((obj->redian.y * pic.W) + obj->redian.x) << 1;
                            num10 = qyt << 1;
                        }
                        else if (myapp.upapp.lcddev.guidire == 1)
                        {
                            num9 += (((pic.H - obj->redian.endy) - 1) + (obj->redian.x * pic.H)) << 1;
                            num10 = (qyt * pic.H) << 1;
                        }
                        else if (myapp.upapp.lcddev.guidire == 2)
                        {
                            num9 += ((((pic.H - obj->redian.endy) * pic.W) - obj->redian.x) - qyt) << 1;
                            num10 = qyt * -2;
                        }
                        else if (myapp.upapp.lcddev.guidire == 3)
                        {
                            num9 += (obj->redian.y + (((pic.W - obj->redian.x) - qyt) * pic.H)) << 1;
                            num10 = (qyt * pic.H) * -2;
                        }
                    }
                    else if (curve_paramPtr->BackType == 2)
                    {
                        qyt = 5;
                        Readdata.Readdata_ReadPic(ref pic, curve_paramPtr->PicID);
                        num9 = (int)(pic.addbeg + myapp.app.picdataadd);
                        if (myapp.upapp.lcddev.guidire == 0)
                        {
                            num10 = qyt << 1;
                        }
                        else if (myapp.upapp.lcddev.guidire == 1)
                        {
                            num10 = (qyt * pic.H) << 1;
                        }
                        else if (myapp.upapp.lcddev.guidire == 2)
                        {
                            num9 += (pic.W - qyt) << 1;
                            num10 = qyt * -2;
                        }
                        else if (myapp.upapp.lcddev.guidire == 3)
                        {
                            num9 += ((pic.W - qyt) * pic.H) << 1;
                            num10 = (qyt * pic.H) * -2;
                        }
                    }
                    else
                    {
                        x     = (short)obj->redian.x;
                        num12 = (short)(x + curve_paramPtr->GridX);
                    }
                    for (short i = (short)obj->redian.x; i <= obj->redian.endx; i = (short)(i + qyt))
                    {
                        short endx = (short)((i + 5) - 1);
                        if (endx > obj->redian.endx)
                        {
                            endx = (short)obj->redian.endx;
                        }
                        if (curve_paramPtr->BackType == 1)
                        {
                            if (curve_paramPtr->GridX > 0)
                            {
                                ushort num15;
                                ushort num16;
                                if (i == x)
                                {
                                    Lcd.LCD_addset((ushort)i, obj->redian.y, (ushort)i, obj->redian.endy, 1);
                                    Lcd.Lcd_WR_POINT(curve_paramPtr->objHig, curve_paramPtr->Griclr);
                                    num15 = (ushort)(i + 1);
                                }
                                else
                                {
                                    num15 = (ushort)i;
                                }
                                if ((num15 + 5) >= num12)
                                {
                                    num16 = (ushort)(num12 - 1);
                                    x     = num12;
                                    num12 = (short)(num12 + curve_paramPtr->GridX);
                                }
                                else
                                {
                                    num16 = (ushort)((num15 + 5) - 1);
                                }
                                qyt = (byte)((num16 - i) + 1);
                                if ((i + qyt) > obj->redian.endx)
                                {
                                    num16 = (ushort)endx;
                                    qyt   = (byte)((endx - i) + 1);
                                }
                                if (curve_paramPtr->GridY > 0)
                                {
                                    endy = (short)obj->redian.endy;
                                    while (endy >= obj->redian.y)
                                    {
                                        y = (short)((endy - curve_paramPtr->GridY) + 1);
                                        if (y < obj->redian.y)
                                        {
                                            y = (short)obj->redian.y;
                                        }
                                        Lcd.LCD_addset(num15, (ushort)endy, num16, (ushort)endy, 1);
                                        Lcd.Lcd_WR_POINT((ushort)((num16 - num15) + 1), curve_paramPtr->Griclr);
                                        Lcd.LCD_addset(num15, (ushort)y, num16, (ushort)(endy - 1), 1);
                                        Lcd.Lcd_WR_POINT((uint)(((num16 - num15) + 1) * (endy - y)), curve_paramPtr->Bkclr);
                                        endy = (short)(endy - curve_paramPtr->GridY);
                                    }
                                }
                                else
                                {
                                    num9 = curve_paramPtr->objHig * ((num16 - num15) + 1);
                                    Lcd.LCD_addset(num15, obj->redian.y, num16, obj->redian.endy, 1);
                                    Lcd.Lcd_WR_POINT((uint)num9, curve_paramPtr->Bkclr);
                                }
                            }
                            else if (curve_paramPtr->GridY > 0)
                            {
                                for (endy = (short)obj->redian.endy; endy >= obj->redian.y; endy = (short)(endy - curve_paramPtr->GridY))
                                {
                                    y = (short)((endy - curve_paramPtr->GridY) + 1);
                                    if (y < obj->redian.y)
                                    {
                                        y = (short)obj->redian.y;
                                    }
                                    Lcd.LCD_addset((ushort)i, (ushort)y, (ushort)endx, (ushort)endy, 1);
                                    qyt = (byte)((endx - i) + 1);
                                    Lcd.Lcd_WR_POINT((uint)(qyt * (endy - y)), curve_paramPtr->Bkclr);
                                    Lcd.Lcd_WR_POINT(qyt, curve_paramPtr->Griclr);
                                }
                            }
                            else
                            {
                                qyt  = (byte)((endx - i) + 1);
                                num9 = curve_paramPtr->objHig * ((endx - i) + 1);
                                Lcd.LCD_addset((ushort)i, obj->redian.y, (ushort)endx, obj->redian.endy, 1);
                                Lcd.Lcd_WR_POINT((uint)num9, curve_paramPtr->Bkclr);
                            }
                        }
                        else
                        {
                            Lcd.LCD_addset((ushort)i, obj->redian.y, (ushort)endx, obj->redian.endy, 1);
                            if ((myapp.upapp.lcddev.guidire & 1) > 0)
                            {
                                Showpic.Showpic_SendDataOffset((uint)num9, (ushort)(pic.H << 1), (ushort)((endx - i) + 1), (byte)curve_paramPtr->objHig);
                            }
                            else
                            {
                                Showpic.Showpic_SendDataOffset((uint)num9, (ushort)(pic.W << 1), curve_paramPtr->objHig, (byte)((endx - i) + 1));
                            }
                            num9 += num10;
                        }
                        for (num3 = 0; num3 < curve_paramPtr->CH_qyt; num3 = (byte)(num3 + 1))
                        {
                            if ((numArray3[num3] > 0) && (i >= numArray4[num3]))
                            {
                                for (num2 = 0; num2 < qyt; num2 = (byte)(num2 + 1))
                                {
                                    byte num6;
                                    byte num5 = myapp.mymerry[numArray[num3]];
                                    byte num4 = buffer2[num3];
                                    if (buffer[num3] > 0)
                                    {
                                        num4         = num5;
                                        buffer[num3] = 0;
                                    }
                                    if (num5 > num4)
                                    {
                                        num6 = (byte)((num5 - num4) + 1);
                                        Lcd.LCD_addset((ushort)(i + num2), (ushort)(obj->redian.endy - num5), (ushort)(i + num2), (ushort)(obj->redian.endy - num4), 1);
                                        Lcd.Lcd_WR_POINT(num6, curve_channel_paramPtrArray[num3]->Penclr);
                                    }
                                    else
                                    {
                                        num6 = (byte)((num4 - num5) + 1);
                                        Lcd.LCD_addset((ushort)(i + num2), (ushort)(obj->redian.endy - num4), (ushort)(i + num2), (ushort)(obj->redian.endy - num5), 1);
                                        Lcd.Lcd_WR_POINT(num6, curve_channel_paramPtrArray[num3]->Penclr);
                                    }
                                    buffer2[num3]  = num5;
                                    numArray[num3] = (ushort)(numArray[num3] + num17);
                                    if (numArray[num3] > curve_channel_paramPtrArray[num3]->BufPos.end)
                                    {
                                        numArray[num3] = curve_channel_paramPtrArray[num3]->BufPos.star;
                                    }
                                    else if (numArray[num3] < curve_channel_paramPtrArray[num3]->BufPos.star)
                                    {
                                        numArray[num3] = curve_channel_paramPtrArray[num3]->BufPos.end;
                                    }
                                    numArray3[num3] = (ushort)(numArray3[num3] - 1);
                                    if (numArray3[num3] == 0)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                myapp.pageobjs[ID].refFlag = 0;
            }
            return(0);
        }
示例#14
0
文件: Showfont.cs 项目: skyclub66/HMI
        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;
                    }
                }
            }
        }
示例#15
0
文件: Showfont.cs 项目: skyclub66/HMI
        public unsafe static byte Showfont_XstringHZK(int x, int y, int w, int h, byte *buf)
        {
            size_tyte size_tyte = default(size_tyte);
            int       num       = (int)Showfont.myapp.brush.x;
            int       num2      = (int)Showfont.myapp.brush.y;
            byte      result;

            if ((int)buf == 0)
            {
                MessageBox.Show("error");
                result = 0;
            }
            else
            {
                try
                {
                    if ((ushort)Showfont.myapp.brush.zikuid >= Showfont.myapp.app.zimoqyt)
                    {
                        if (*buf != 0)
                        {
                            Showfont.myapp.errcode = 5;
                            result = 0;
                            return(result);
                        }
                        if (Showfont.myapp.brush.sta < 10)
                        {
                            myappinf expr_AA_cp_0 = Showfont.myapp;
                            expr_AA_cp_0.brush.sta = Convert.ToByte(expr_AA_cp_0.brush.sta + 10);
                        }
                    }
                    if (Showfont.myapp.brush.endx >= Showfont.myapp.upapp.lcddev.width)
                    {
                        Showfont.myapp.brush.endx = Convert.ToByte(Showfont.myapp.upapp.lcddev.width - 1);
                    }
                    if (Showfont.myapp.brush.endy >= Showfont.myapp.upapp.lcddev.height)
                    {
                        Showfont.myapp.brush.endy = Convert.ToByte(Showfont.myapp.upapp.lcddev.height - 1);
                    }
                    if (Showfont.myapp.brush.sta < 10)
                    {
                        myappinf expr_199_cp_0 = Showfont.myapp;
                        expr_199_cp_0.brush.sta = Convert.ToByte(expr_199_cp_0.brush.sta + 10);
                    }
                    if (Showfont.myapp.brush.sta == 0 || Showfont.myapp.brush.sta == 2 || Showfont.myapp.brush.sta == 10 || Showfont.myapp.brush.sta == 12)
                    {
                        if (Showfont.myapp.brush.backcolor >= Showfont.myapp.app.picqyt)
                        {
                            Showfont.myapp.errcode = 4;
                            result = 0;
                            return(result);
                        }
                    }
                    if (*buf == 0)
                    {
                        if (Showfont.myapp.brush.sta < 10)
                        {
                            myappinf expr_26F_cp_0 = Showfont.myapp;
                            expr_26F_cp_0.brush.sta = Convert.ToByte(expr_26F_cp_0.brush.sta + 10);
                        }
                    }
                    if (Showfont.myapp.brush.sta > 9)
                    {
                        if (Showfont.myapp.brush.sta == 11)
                        {
                            Lcd.Lcd_Fill(num, num2, (int)((ushort)((int)Showfont.myapp.brush.endx - num + 1)), (int)((ushort)((int)Showfont.myapp.brush.endy - num2 + 1)), Showfont.myapp.brush.backcolor);
                        }
                        else if (Showfont.myapp.brush.sta == 10)
                        {
                            Showpic.Showpic_ShowXpic(num, num2, (ushort)((int)Showfont.myapp.brush.endx - num + 1), (ushort)((int)Showfont.myapp.brush.endy - num2 + 1), num, num2, Showfont.myapp.brush.backcolor);
                        }
                        else if (Showfont.myapp.brush.sta == 12)
                        {
                            Showpic.Showpic_ShowPic(num, num2, Showfont.myapp.brush.backcolor);
                        }
                        if (*buf == 0)
                        {
                            result = 1;
                            return(result);
                        }
                        Showfont.myapp.brush.sta = 3;
                    }
                    if (w == 32767)
                    {
                        Showfont.myapp.brush.brendx = (short)Showfont.myapp.brush.endx;
                        Showfont.myapp.brush.brendy = (short)Showfont.myapp.brush.endy;
                        Showfont.Showfont_StringHZK((int)Showfont.myapp.brush.x, (int)Showfont.myapp.brush.y, buf, 0, ref size_tyte);
                    }
                    else
                    {
                        size_tyte.a = (ushort)w;
                        size_tyte.b = (ushort)h;
                    }
                    if (x == 32767)
                    {
                        if (Showfont.myapp.brush.xjuzhong > 0)
                        {
                            int num3 = (int)(Showfont.myapp.brush.endx - Showfont.myapp.brush.x + 1 - size_tyte.a);
                            if (num3 > 1)
                            {
                                if (Showfont.myapp.brush.xjuzhong == 1)
                                {
                                    num += (int)((ushort)(num3 / 2));
                                }
                                else
                                {
                                    num += num3;
                                }
                            }
                        }
                    }
                    else
                    {
                        num = x;
                    }
                    if (y == 32767)
                    {
                        if (Showfont.myapp.brush.yjuzhong > 0)
                        {
                            int num3 = (int)(Showfont.myapp.brush.endy - Showfont.myapp.brush.y + 1 - size_tyte.b);
                            if (num3 > 1)
                            {
                                if (Showfont.myapp.brush.yjuzhong == 1)
                                {
                                    num2 += (int)((ushort)(num3 / 2));
                                }
                                else
                                {
                                    num2 += num3;
                                }
                            }
                        }
                    }
                    else
                    {
                        num2 = y;
                    }
                    if (w != 32767)
                    {
                        Showfont.myapp.brush.brendx = (short)(num + w);
                        Showfont.myapp.brush.brendy = (short)(num2 + h);
                    }
                    Showfont.Showfont_StringHZK(num, num2, buf, 1, ref size_tyte);
                }
                catch (Exception ex)
                {
                    MessageOpen.Show("Showfont_StringHZK is error!" + ex.Message);
                }
                result = 1;
            }
            return(result);
        }