示例#1
0
 public virtual void CopyTo(IBImage i)
 {
     i.imageData = new BGRA32FormattedImage((int)imageData.actualSize.Width, (int)imageData.actualSize.Height);
     i.imageData.SetDrawingMode();
     for (int c = 0; c < i.imageData.data.Length; c++)
     {
         i.imageData.data[c] = imageData.data[c];
     }
     i.IsSelectedLayer = IsSelectedLayer;
     i.LayerName       = LayerName;
     i.LayerType       = LayerType;
     i.PropertyChanged = PropertyChanged;
     i.Rect            = new IBRectangle(Rect.Width, Rect.Height, Rect.OffsetX, Rect.OffsetY);
     i.imageData.EndDrawingMode();
 }
示例#2
0
        public virtual void Activate(IBCanvasControl canvas, IBProjectElement trg)
        {
            if (canvas != null)
            {
                currentCanvas = canvas;
            }
            ActiveBrush = this;

            if (trg == null)
            {
                return;
            }
            trgImage = trg;
            trgLayer = GetSelectedLayer();
        }
示例#3
0
        public virtual bool Set(IBCanvasControl canvas, IBProjectElement trg, IBCoord coord)
        {
            currentCanvas = canvas;
            trgImage      = trg;
            trgLayer      = GetSelectedLayer();
            if (trgImage == null || trgLayer == null || !trgLayer.imageData.CanDraw)
            {
                return(false);
            }

            if (!drawing)
            {
                beforeDataStride = (int)trgLayer.imageData.actualSize.Width * 4;
                RecordBeforeData();
            }

            penUp   = false;
            drawing = true;
            count   = 0;

            for (int i = 0; i < histPressure.Length; i++)
            {
                histPressure[i] = currentCanvas.StylusPressure;
                if (WintabUtility.Pressure != 0)
                {
                    histPressure[i] = WintabUtility.Pressure;
                }
            }

            foreach (IBCoord c in histCoord)
            {
                c.x = coord.x;
                c.y = coord.y;
            }

            return(true);
        }
示例#4
0
            public RUDraw(byte[] _beforData, IBImage layer)
            {
                trg = layer;
                byte[] _newData = layer.imageData.data;
                stride  = (drawAreaXE - drawAreaXS) * 4;
                height  = drawAreaYE - drawAreaYS;
                offsetX = drawAreaXS;
                offsetY = drawAreaYS;

                BeforeData = new byte[height * stride];
                NewData    = new byte[height * stride];
                int layerStride = (int)layer.imageData.actualSize.Width * 4;
                int _offsetx    = offsetX * 4;

                for (int y = 0; y < height; y++)
                {
                    int offset = (drawAreaYS + y) * layerStride;
                    for (int x = 0; x < stride; x++)
                    {
                        BeforeData[y * stride + x] = _beforData[offset + _offsetx + x];
                        NewData[y * stride + x]    = _newData[offset + _offsetx + x];
                    }
                }
            }
示例#5
0
 public override void CopyTo(IBImage i)
 {
     i = new SingleColorImage();
     base.CopyTo(i);
     ((SingleColorImage)i).Color = Color;
 }