123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using HNWD.Pregrant.Common;
- using HNWD.Pregrant.DataAccess;
- using HNWD.Pregrant.Model;
- using System.Drawing;
- using System.IO;
- namespace HNWD.LatticeScreen.Server
- {
- internal class BitmapProgram : ProgramBase
- {
- private char[] pdata;
- public BitmapProgram(LedLatticeScreen ledLatticeScreen)
- : base()
- {
- this.ledLatticeScreen = ledLatticeScreen;
- }
- public override void SetEntity(Pregrant.Model.WD_ProgramInfo wd_ProgramInfo)
- {
- base.SetEntity(wd_ProgramInfo);
- byte[] byteArray = Convert.FromBase64String(GZipCompress.Decompress(this.wd_ProgramInfo.PROGRAM_MATRIX));
- pdata = new char[byteArray.LongLength];
- for(long i = 0;i<byteArray.LongLength;i++)
- {
- pdata[i] = (char)byteArray[i];
- }
- }
- public override void PlayWithErase()
- {
- this.GetBitmapAlignMode(this.wd_ProgramInfo.PROGRAM_ALIGN);
- LedControl.JHErase(this.ledLatticeScreen.hdl);
- int length = 1200;
- long ntimes = pdata.LongLength % length == 0 ? pdata.LongLength / length : pdata.LongLength / length + 1;
- int x = 0;
- while (x < ntimes)
- {
- tagBitmapSource tagBitmap = new tagBitmapSource();
- tagBitmap.pdata = pdata.Skip(length * x).Take(length).ToArray();
- tagBitmap.size = (ulong)tagBitmap.pdata.LongLength;
- tagBitmap.type = 0;
- tagBitmap.version = 0;
- LedControl.JHDrawBitmap(this.ledLatticeScreen.hdl, Convert.ToInt16(this.wd_ProgramInfo.PROGRAM_X), Convert.ToInt16(this.wd_ProgramInfo.PROGRAM_Y), Convert.ToUInt16(this.wd_ProgramInfo.PROGRAM_WIDTH), Convert.ToUInt16(this.wd_ProgramInfo.PROGRAM_HEIGHT), this.AlignMode, tagBitmap);
- x++;
- }
- }
- public override void PlayWithoutErase()
- {
- this.GetBitmapAlignMode(this.wd_ProgramInfo.PROGRAM_ALIGN);
- int length = 1200;
- long ntimes = pdata.LongLength % length == 0 ? pdata.LongLength / length : pdata.LongLength / length + 1;
- int x = 0;
- while (x < ntimes)
- {
- tagBitmapSource tagBitmap = new tagBitmapSource();
- tagBitmap.pdata = pdata.Skip(length * x ).Take(length).ToArray();
- tagBitmap.size = (ulong)tagBitmap.pdata.LongLength;
- tagBitmap.type = 0;
- tagBitmap.version = 0;
- LedControl.JHDrawBitmap(this.ledLatticeScreen.hdl, Convert.ToInt16(this.wd_ProgramInfo.PROGRAM_X), Convert.ToInt16(this.wd_ProgramInfo.PROGRAM_Y), Convert.ToUInt16(this.wd_ProgramInfo.PROGRAM_WIDTH), Convert.ToUInt16(this.wd_ProgramInfo.PROGRAM_HEIGHT), this.AlignMode, tagBitmap);
-
- x++;
- }
- }
- }
- }
|