Пример #1
0
        public void SetEmpty()
        {
            Changed = false;

            Width  = ApplicationSettings.BackgroundDefault.Default.EmptyWidth;
            Height = ApplicationSettings.BackgroundDefault.Default.EmptyHeight;
            EmptyBackgroundColor = ApplicationSettings.BackgroundDefault.Default.EmptyBackgroundColor;

            TextStart = ApplicationSettings.BackgroundDefault.Default.EmptyTextPos;
            NameStart = ApplicationSettings.BackgroundDefault.Default.EmptyNamePos;

            GlyphScale  = ApplicationSettings.BackgroundDefault.Default.EmptyGlyphScale;
            ColorName   = ApplicationSettings.BackgroundDefault.Default.EmptyNameColor;
            ColorText   = ApplicationSettings.BackgroundDefault.Default.EmptyTextColor;
            LineSpacing = ApplicationSettings.BackgroundDefault.Default.EmptyLineSpacing;

            rect = new Rect(0, 0, Width, Height);

            image = BitmapSource.Create(Width, Height, 96, 96, PixelFormats.Indexed1,
                                        new BitmapPalette(new List <Color> {
                EmptyBackgroundColor
            }), new byte[Width * Height], Width);

            if (Changed)
            {
                BackgroundChanged?.Invoke(this);
            }
        }
Пример #2
0
        public unsafe void ApplyBackground(IPenContext context)
        {
            if (context == null)
            {
                return;
            }

            IBufferPen Pen = (context is IBufferPen) ? context as IBufferPen : context.ToPen(Width, Height);

            if (Pen == null || Pen.ID == BackgroundPen)
            {
                return;
            }

            var rc = Factory.newRectangle(0, 0, Pen.Width, Pen.Height);

            Pen.CopyTo(rc, Pixels, Length, Width, 0, 0);
            BackgroundPen = Pen.ID;
            Factory.Add(Pen, ObjType.Buffer);
            PendingUpdates.Clear();
            BackgroundChanged?.Invoke(this, Factory.EventArgsEmpty);
            //RefreshAll();
            PendingUpdates.Clear();
            PendingUpdates.Invalidate(rc);
        }
Пример #3
0
 protected virtual void OnBackgroundChanged(ColorEventArgs e)
 {
     GDI.ApplyContainerBackColorChange(this, Background);
     BackgroundChanged?.Invoke(e);
 }