private void VisitDynamic(ShapeDynamicTextBase dynamicText)
        {
            try
            {
                if (dynamicText.IsChanged)
                {
                    dynamicText.BeginEdit();
                    dynamicText.DrawString(false);
                    dynamicText.EndEdit();

                    dynamicText.Font.FontFileName = dynamicText.FontMgr.FontFileName;
                    if (dynamicText.FixedMode == SizeFixedMode.Frame)
                    {
                        dynamicText.Font.Size = dynamicText.FontMgr.FontHeight / Zoom;
                    }

                    if (dynamicText.FontMgr.Bold)
                    {
                        dynamicText.Font.Style = dynamicText.Font.Style | FontStyle.Bold;
                    }
                    else
                    {
                        dynamicText.Font.Style = dynamicText.Font.Style & ((FontStyle.Bold | FontStyle.Italic | FontStyle.Strikeout | FontStyle.Underline) ^ FontStyle.Bold);
                    }

                    if (dynamicText.FontMgr.Italic)
                    {
                        dynamicText.Font.Style = FontStyle.Italic;
                    }
                    else
                    {
                        dynamicText.Font.Style = dynamicText.Font.Style & ((FontStyle.Bold | FontStyle.Italic | FontStyle.Strikeout | FontStyle.Underline) ^ FontStyle.Italic);
                    }
                    dynamicText.IsChanged = false;
                }
                if (dynamicText.BitmapOverlay == null)
                {
                    dynamicText.DrawString(false);
                }
                else
                {
                    Graphics.DrawImage(dynamicText.BitmapOverlay, dynamicText.VirtualBounds);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
            }
        }
Example #2
0
        private void VisitDynamic(ShapeDynamicTextBase dynamic)
        {
            if (string.IsNullOrEmpty(dynamic.Text))
            {
                return;
            }

            var hideGrid = true;
            var FontMgr  = dynamic.FontMgr;

            FontMgr.ShowGrid   = !hideGrid;
            FontMgr.ScaleIndex = Zoom;
            FontMgr.SetStyle(dynamic.IsFrameSizeFixed, dynamic.IsFontSizeFixed);
            FontMgr.TextColor     = dynamic.ConveredForeColor(Layer.Shape.SignType); //.ForeColor;
            FontMgr.BackColor     = dynamic.ConveredBackColor(Layer.Shape.SignType); //.BackColor;
            FontMgr.FontName      = dynamic.Font.Name;
            FontMgr.FontHeight    = dynamic.Font.Size * Zoom;
            FontMgr.Alignment     = dynamic.Align;
            FontMgr.LineAlignment = dynamic.Valign;
            FontMgr.Bold          = (dynamic.Font.Style & FontStyle.Bold) == FontStyle.Bold;
            FontMgr.Italic        = (dynamic.Font.Style & FontStyle.Italic) == FontStyle.Italic;
            FontMgr.SignSize      = new Size(dynamic.SignSize.Width * Zoom - 2, dynamic.SignSize.Height * Zoom - 2);
            FontMgr.FrameSize     = DrawMode == DESDrawMode.Sign ? FontMgr.SignSize : dynamic.VirtualBounds.Size;
            FontMgr.Text          = dynamic.Text;

            List <Image>  imagesActual = new List <Image>();
            List <Image>  images       = new List <Image>();
            List <string> strings      = new List <string>();

            FontMgr.GenerateBmps(imagesActual, images, strings);


            if (images.Count > 0)
            {
                dynamic.BitmapOverlay = images[0];
                dynamic.InnerImage    = new Bitmap(dynamic.BitmapOverlay);
            }

            if (dynamic.BitmapOverlay != null)
            {
                dynamic.InnerImagePath = dynamic.SaveImage(dynamic.BitmapOverlay);
            }
            dynamic.IsChanged = true;
        }
Example #3
0
        public override void FromTo(ShapeBase shape)
        {
            if (shape == null)
            {
                return;
            }
            base.FromTo(shape);
            ShapeDynamicTextBase other = shape as ShapeDynamicTextBase;

            if (other != null)
            {
                _Align = other._Align;
                //_BitCount = other._BitCount;
                _RollRate      = other._RollRate;
                _RollWay       = other._RollWay;
                _Valign        = other._Valign;
                FrameSizeFixed = other.FrameSizeFixed;
                FontSizeFixed  = other.FontSizeFixed;
            }
        }
        public override Layer Convert(ShapeLayer source)
        {
            if (!source.IsVisible)
            {
                return(null);
            }

            if (source.StartTime > source.EndTime)
            {
                return(null);
            }

            source.Accept(Vistor);

            Layer videoLayer = new Layer();

            var _shape         = source.Shape;
            var StartTime      = source.StartTime;
            var Duration       = source.Duration;
            var Name           = source.Name;
            var EndTime        = source.EndTime;
            var IsVisible      = source.IsVisible;
            var EntryEffect    = source.EntryEffect;
            var EmphasisEffect = source.EmphasisEffect;
            var ExitEffect     = source.ExitEffect;

            if (_shape.Type == ShapeType.DynamicText || _shape.Type == ShapeType.Time || _shape.Type == ShapeType.Temperature)
            {
                ShapeDynamicTextBase DynamicText = _shape as ShapeDynamicTextBase;
                if (DynamicText.RollWay != RollWay.None)
                {
                    videoLayer.TextInfo           = new EffectTravel();
                    videoLayer.TextInfo.Left      = (int)(source.StartTime * Constance.Effect.UnitWidth);
                    videoLayer.TextInfo.Width     = (int)(Duration * Constance.Effect.UnitWidth);
                    videoLayer.TextInfo.Direction = (EffectTravel.DirectionWay)DynamicText.RollWay;
                    videoLayer.TextInfo.Speed     = DynamicText.RollRate;
                }
            }

            videoLayer.FilePath  = _shape.InnerImagePath;
            videoLayer.LayerType = _shape.VideoType;
            if (videoLayer.LayerType == LayerType.Video)
            {
                if ((string.IsNullOrEmpty(videoLayer.FilePath)) || !File.Exists(videoLayer.FilePath))
                {
                    return(null);
                }
            }
            videoLayer.Name    = Name;
            videoLayer.Visible = IsVisible;
            //comment out for upload video resize bug
            if (videoLayer.LayerType == LayerType.Video)
            {
                videoLayer.Rect = _shape.DestBounds;
            }
            else
            {
                videoLayer.Rect = _shape.VirtualBounds;
            }
            videoLayer.StartTime = (long)StartTime;
            videoLayer.EndTime   = (long)EndTime;

            if (!EntryEffect.IsEmpty)
            {
                videoLayer.EntryEffect = EntryEffect.Copy(false) as LayerEffect;
            }
            videoLayer.EmphasisEffect = EmphasisEffect.Copy(false) as LayerEffect;

            if (!ExitEffect.IsEmpty)
            {
                videoLayer.ExitEffect = ExitEffect.Copy(false) as LayerEffect;
            }

            return(videoLayer);
        }