Ejemplo n.º 1
0
		public bool GenerateData(LedPanel panel, ref Process process)
		{
			bool result = false;
			try
			{
				for (int i = 0; i < panel.Items.Count; i++)
				{
					for (int j = 0; j < panel.Items[i].Subareas.Count; j++)
					{
						if (panel.Items[i].Subareas[j].Type == LedSubareaType.Subtitle)
						{
							LedDText ledDText = (LedDText)panel.Items[i].Subareas[j].SelectedContent;
							if (ledDText.DoNeedDrawingFull)
							{
								ledDText.DrawMode = LedDrawMode.Full;
								ledDText.Draw();
								ledDText.DrawMode = LedDrawMode.Part;
							}
						}
						else if (panel.Items[i].Subareas[j].Type == LedSubareaType.PictureText)
						{
							LedSubarea ledSubarea = panel.Items[i].Subareas[j];
							for (int k = 0; k < ledSubarea.Contents.Count; k++)
							{
								LedPictureText ledPictureText = (LedPictureText)ledSubarea.Contents[k];
								if (ledPictureText.DoNeedDrawingFull || (ledPictureText.LastDrawn != null && ledPictureText.GetSize() != ledPictureText.LastDrawn.Size))
								{
									ledPictureText.DrawMode = LedDrawMode.Full;
									ledPictureText.Draw();
									ledPictureText.DrawMode = LedDrawMode.Part;
								}
							}
						}
					}
				}
				if (this.isAnimation)
				{
					this.GetAnimationAndBackground(panel);
				}
				process = new Process();
				if (panel.IsLSeries())
				{
					process.PanelBytes = panel.ToLBytes();
					process.ItemTimerLBytes = panel.ToItemTimerLByte();
					process.ItemStartLBytes = panel.ToItemStartLBytes();
					process.ItemLBytes = panel.ToItemLBytes();
				}
				else
				{
					process.PanelBytes = panel.ToBytes();
					process.BmpDataBytes = panel.ToItemBmpDataBytes();
					process.ItemBytes = panel.ToItemBytes();
				}
				result = true;
			}
			catch
			{
				process = null;
				result = false;
			}
			return result;
		}
Ejemplo n.º 2
0
        public MarqueeDisplay130(LedPictureText pContent)
        {
            System.Drawing.Size size = pContent.GetSize();
            this.content      = pContent;
            this.nowLoopNum   = 1;
            this.nowPositionF = (float)(-(float)size.Width);
            LedElement ledElement = pContent.Elements[0];
            int        num        = 0;
            int        num2;

            if (ledElement.PageCount >= 3)
            {
                num2 = 3;
                ledElement.PageNumber = 3;
            }
            else
            {
                num2 = ledElement.PageCount;
                ledElement.PageNumber = ledElement.PageCount - 1;
            }
            int  num3 = size.Width * num2;
            bool flag = false;
            int  num4 = pContent.EffectiveLength;

            if (num3 > pContent.EffectiveLength)
            {
                num3 = pContent.EffectiveLength;
            }
            if (pContent.EffectiveLength < size.Width)
            {
                if (pContent.EffectiveLength == 0)
                {
                    num3 = size.Width;
                    num4 = size.Width;
                }
                else
                {
                    num3 = (size.Width / pContent.EffectiveLength + 1) * num3;
                    num4 = pContent.EffectiveLength;
                }
                flag = true;
            }
            this.AllBit = new System.Drawing.Bitmap(num3, size.Height);
            System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(this.AllBit);
            for (int i = 0; i < num2; i++)
            {
                System.Drawing.Bitmap bmpFromFile = LedGraphics.GetBmpFromFile(size, i, this.content.GetFileFullPath());
                if (flag)
                {
                    for (int j = 0; j < num3; j += num4)
                    {
                        graphics.DrawImage(bmpFromFile, new System.Drawing.Rectangle(j, 0, num4, size.Height), new System.Drawing.Rectangle(0, 0, num4, size.Height), System.Drawing.GraphicsUnit.Pixel);
                    }
                }
                else
                {
                    graphics.DrawImage(bmpFromFile, new System.Drawing.Point(num, 0));
                    num += bmpFromFile.Width;
                    bmpFromFile.Dispose();
                }
            }
        }