Exemple #1
0
        /// <summary>
        /// Get a raster layer.
        /// </summary>
        /// <param name="layer"></param>
        /// <returns></returns>
        public Raster GetRaster(PictureLayer layer)
        {
            switch (layer)
            {
            case PictureLayer.Visual: return(Visual);

            case PictureLayer.Priority: return(Priority);

            case PictureLayer.Control: return(Control);

            case PictureLayer.Auxiliary: return(Auxiliary);

            default: throw new ArgumentException(typeof(PictureLayer).Name + " value " + layer + " is not valid.", "layer");
            }
        }
Exemple #2
0
        public void addPicture(Offset offset, Picture picture,
                               bool isComplex = false, bool willChange = false)
        {
            if (this._currentLayer == null)
            {
                return;
            }

            var layer = new PictureLayer();

            layer.offset     = offset;
            layer.picture    = picture;
            layer.isComplex  = isComplex;
            layer.willChange = willChange;
            this._currentLayer.add(layer);
        }
        public void AddPicture(double dx, double dy, SKPicture picture, int hints)
        {
            if (current_layer_ == null)
            {
                return;
            }
            SKPoint offset      = new SKPoint((float)dx, (float)dy);
            SKRect  pictureRect = picture.CullRect;

            pictureRect.Offset(offset.X, offset.Y);
            var layer = new PictureLayer();

            layer.set_offset(offset);
            layer.set_picture(new Flow.SkiaGPUObject <SKPicture>(picture, _queue)); // UIDartState::CreateGPUObject(picture->picture()));
            layer.set_is_complex(true);                                             // !!(hints & 1));
            layer.set_will_change(true);                                            // !!(hints & 2));
            current_layer_.Add(layer);
        }
Exemple #4
0
        /// <summary>
        /// Initialise the browser.
        /// </summary>
        /// <param name="picture"></param>
        public PictureBrowser(Picture picture)
        {
            Picture = picture;
            Canvas  = new PictureCanvas(picture);
            Canvas.Visual.DitherBlend = BlendColorsDefault;

            InitializeComponent();
            SetStipplingSpitButtonImage();

            instructionTrackBar.Width   = Math.Max(picture.Instructions.Count, 200);
            instructionTrackBar.Maximum = picture.Instructions.Count;
            instructionTrackBar.Value   = picture.Instructions.Count;

            this.picture.Width  = (int)(Canvas.Resolution.X * 4 / 1.333);
            this.picture.Height = Canvas.Resolution.Y * 4;

            Layer = PictureLayer.Visual;
        }
        //Flow.SkiaUnrefQueue _queue = new Flow.SkiaUnrefQueue();
        public void AddPicture(double dx, double dy, SKPicture picture, int hints)
        {
            if (current_layer_ == null)
            {
                return;
            }
            SKPoint offset      = new SKPoint((float)dx, (float)dy);
            SKRect  pictureRect = picture.CullRect;

            pictureRect.Offset(offset.X, offset.Y);
            var layer = new PictureLayer();

            layer.set_offset(offset);
            layer.set_picture(picture);
            layer.set_is_complex((hints & 1) == 1);
            layer.set_will_change((hints & 2) == 2);
            current_layer_.Add(layer);
        }
Exemple #6
0
        public void addPicture(Offset offset, Picture picture,
                               bool isComplexHint = false, bool willChangeHint = false)
        {
            D.assert(offset != null);
            D.assert(picture != null);

            if (this._currentLayer == null)
            {
                return;
            }

            var layer = new PictureLayer();

            layer.offset     = offset;
            layer.picture    = picture;
            layer.isComplex  = isComplexHint;
            layer.willChange = willChangeHint;
            this._currentLayer.add(layer);
        }
Exemple #7
0
 /// <summary>
 /// Clear all of the layers to their default values (by default), or specific layers with specific values if desired. This locks, then unlocks the bitmaps.
 /// </summary>
 /// <param name="visualValue">What to clear the visual map to if Layer.Visual is included in mask.</param>
 /// <param name="priorityValue">What to clear the priority map to if Layer.Priority is included in mask.</param>
 /// <param name="controlValue">What to clear the control map to if Layer.Control is included in mask.</param>
 /// <param name="auxiliaryValue">What to clear the auxiliary map to if Layer.Auxiliary is included in mask.</param>
 /// <param name="mask"></param>
 public virtual void Clear(byte visualValue = 15, byte priorityValue = 0, byte controlValue = 0, byte auxiliaryValue = 0, PictureLayer mask = PictureLayer.All)
 {
     Lock();
     if ((mask & PictureLayer.Visual) != 0)
     {
         Visual.Clear(visualValue);
     }
     if ((mask & PictureLayer.Priority) != 0)
     {
         Priority.Clear(priorityValue);
     }
     if ((mask & PictureLayer.Control) != 0)
     {
         Control.Clear(controlValue);
     }
     if ((mask & PictureLayer.Auxiliary) != 0)
     {
         Auxiliary.Clear(auxiliaryValue);
     }
     Unlock();
 }
Exemple #8
0
 private void OnAuxiliaryClicked(object sender, EventArgs e)
 {
     Layer = PictureLayer.Auxiliary;
 }
Exemple #9
0
 private void OnControlClicked(object sender, EventArgs e)
 {
     Layer = PictureLayer.Control;
 }
Exemple #10
0
 private void OnPriorityClicked(object sender, EventArgs e)
 {
     Layer = PictureLayer.Priority;
 }
Exemple #11
0
 private void OnVisualClicked(object sender, EventArgs e)
 {
     Layer = PictureLayer.Visual;
 }
 /// <summary>
 /// Get a raster layer.
 /// </summary>
 /// <param name="layer"></param>
 /// <returns></returns>
 public Raster GetRaster(PictureLayer layer)
 {
     switch (layer) {
         case PictureLayer.Visual: return Visual;
         case PictureLayer.Priority: return Priority;
         case PictureLayer.Control: return Control;
         case PictureLayer.Auxiliary: return Auxiliary;
         default: throw new ArgumentException(typeof(PictureLayer).Name + " value " + layer + " is not valid.", "layer");
     }
 }
 /// <summary>
 /// Clear all of the layers to their default values (by default), or specific layers with specific values if desired. This locks, then unlocks the bitmaps.
 /// </summary>
 /// <param name="visualValue">What to clear the visual map to if Layer.Visual is included in mask.</param>
 /// <param name="priorityValue">What to clear the priority map to if Layer.Priority is included in mask.</param>
 /// <param name="controlValue">What to clear the control map to if Layer.Control is included in mask.</param>
 /// <param name="auxiliaryValue">What to clear the auxiliary map to if Layer.Auxiliary is included in mask.</param>
 /// <param name="mask"></param>
 public virtual void Clear(byte visualValue = 15, byte priorityValue = 0, byte controlValue = 0, byte auxiliaryValue = 0, PictureLayer mask = PictureLayer.All)
 {
     Lock();
     if ((mask & PictureLayer.Visual) != 0)
         Visual.Clear(visualValue);
     if ((mask & PictureLayer.Priority) != 0)
         Priority.Clear(priorityValue);
     if ((mask & PictureLayer.Control) != 0)
         Control.Clear(controlValue);
     if ((mask & PictureLayer.Auxiliary) != 0)
         Auxiliary.Clear(auxiliaryValue);
     Unlock();
 }