Esempio n. 1
0
        public override void OnDraw(MatterHackers.Agg.Graphics2D graphics2D)
        {
            SetGlContext();
            OnDrawGlContent();
            UnsetGlContext();

            RectangleDouble bounds = LocalBounds;

            //graphics2D.Rectangle(bounds, RGBA_Bytes.Black);

            if (DrawRotationHelperCircle)
            {
                DrawTrackballRadius(graphics2D);
            }

            base.OnDraw(graphics2D);
        }
Esempio n. 2
0
        private void Initialize(ImageBuffer sourceImage, RectangleInt boundsToCopyFrom)
        {
            if (sourceImage == this)
            {
                throw new Exception("We do not create a temp buffer for this to work.  You must have a source distinct from the dest.");
            }
            Deallocate();
            Allocate(boundsToCopyFrom.Width, boundsToCopyFrom.Height, boundsToCopyFrom.Width * sourceImage.BitDepth / 8, sourceImage.BitDepth);
            SetRecieveBlender(sourceImage.GetRecieveBlender());

            if (width != 0 && height != 0)
            {
                RectangleInt DestRect           = new RectangleInt(0, 0, boundsToCopyFrom.Width, boundsToCopyFrom.Height);
                RectangleInt AbsoluteSourceRect = boundsToCopyFrom;
                // The first thing we need to do is make sure the frame is cleared. LBB [3/15/2004]
                MatterHackers.Agg.Graphics2D graphics2D = NewGraphics2D();
                graphics2D.Clear(new RGBA_Bytes(0, 0, 0, 0));

                int x = -boundsToCopyFrom.Left - (int)sourceImage.OriginOffset.x;
                int y = -boundsToCopyFrom.Bottom - (int)sourceImage.OriginOffset.y;

                graphics2D.Render(sourceImage, x, y, 0, 1, 1);
            }
        }