Exemple #1
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);
        }
        /// <summary>
        /// Called if we hit an exception at a bad time (when
        ///  updating the index files) and must discard all
        ///  currently buffered docs.  this resets our state,
        ///  discarding any docs added since last flush.
        /// </summary>
        internal virtual void Abort(ISet <string> createdFiles)
        {
            //System.out.println(Thread.currentThread().getName() + ": now abort seg=" + segmentInfo.name);
            HasAborted = Aborting = true;
            try
            {
                if (InfoStream.IsEnabled("DWPT"))
                {
                    InfoStream.Message("DWPT", "now abort");
                }
                try
                {
                    Consumer.Abort();
                }
                catch (Exception t)
                {
                }

                PendingUpdates.Clear();
                CollectionsHelper.AddAll(createdFiles, Directory.CreatedFiles);
            }
            finally
            {
                Aborting = false;
                if (InfoStream.IsEnabled("DWPT"))
                {
                    InfoStream.Message("DWPT", "done abort");
                }
            }
        }
Exemple #3
0
        public void Resize(int?width = null, int?height = null)
        {
            if (width == null && height == null)
            {
                return;
            }

            var w = width ?? this.Width;
            var h = height ?? this.Height;

            ResetDataInternally(w, h);
#if AdvancedVersion
            Buffers?.ResizeAll();
#endif
            PendingUpdates.Clear();
            PendingUpdates.Invalidate(Factory.newRectangle(0, 0, Width, Height));
        }