public override void MouseDown(int x, int y, bool isRightButton) { //check if we hit a lion or not //this is example => if right button=>test with path if (isRightButton) { if (LionMoveOption == LionMoveOption.Move) { LionMoveOption = LionMoveOption.ZoomAndRotate; } else { LionMoveOption = LionMoveOption.Move; } } //----------------------------------------------------- _hitLion = null; hitOnLion = false; for (int i = lionList.Count - 1; i >= 0; --i) { MyTestSprite lion = lionList[i]; if (lion.HitTest(x, y, isRightButton)) { hitOnLion = true; _hitLion = lion; break; } } base.MouseDown(x, y, isRightButton); }
public override void Init() { VgVisualElement renderVx = VgVisualDocHelper.CreateVgVisualDocFromFile(@"Samples\lion.svg").VgRootElem; var spriteShape = new SpriteShape(renderVx); _testSprite = new MyTestSprite(spriteShape); //lionFill.AutoFlipY = true; }
public override void Init() { //eg. lion _vgVisualElem = VgVisualDocHelper.CreateVgVisualDocFromFile(@"Samples\lion.svg").VgRootElem; var spriteShape = new SpriteShape(_vgVisualElem); _testSprite = new MyTestSprite(spriteShape); _needUpdate = true; _smoothCoeff = 0; }
public override void Init() { VgVisualElement renderVx = VgVisualDocHelper.CreateVgVisualDocFromFile(@"Samples\lion.svg").VgRootElem; var spriteShape = new SpriteShape(renderVx); _testSprite = new MyTestSprite(spriteShape); //lionFill.AutoFlipY = true; _currentTx = PixelFarm.CpuBlit.VertexProcessing.Affine.NewMatix( VertexProcessing.AffinePlan.RotateDeg(30), VertexProcessing.AffinePlan.Scale(2) ); }
public FilterFxDemo() { VgVisualElement renderVx = VgVisualDocHelper.CreateVgVisualDocFromFile(@"Samples\lion.svg").VgRootElem; var spriteShape = new SpriteShape(renderVx); _testSprite = new MyTestSprite(spriteShape); //-------------- //m_rbuf2 = new ReferenceImage(); _shape_bounds = new RectD(); _shadow_ctrl = new PolygonEditWidget(4); this.FlattenCurveChecked = true; this.FilterMethod = FilterMethod.None; this.BlurRadius = 15; // }
public perspective_application() { _lionShape = new SpriteShape(PaintLab.Svg.VgVisualDocHelper.CreateVgVisualDocFromFile(@"Samples\lion.svg").VgRootElem); _lionFill = new MyTestSprite(_lionShape); _quadPolygonControl = new PixelFarm.CpuBlit.UI.PolygonEditWidget(4, 5.0); _quadPolygonControl.SetXN(0, _lionShape.Bounds.Left); _quadPolygonControl.SetYN(0, _lionShape.Bounds.Top); _quadPolygonControl.SetXN(1, _lionShape.Bounds.Right); _quadPolygonControl.SetYN(1, _lionShape.Bounds.Top); _quadPolygonControl.SetXN(2, _lionShape.Bounds.Right); _quadPolygonControl.SetYN(2, _lionShape.Bounds.Bottom); _quadPolygonControl.SetXN(3, _lionShape.Bounds.Left); _quadPolygonControl.SetYN(3, _lionShape.Bounds.Bottom); }
public override void MouseDown(int x, int y, bool isRightButton) { //check if we hit a lion or not //this is example => if right button=>test with path if (isRightButton) { if (LionMoveOption == LionMoveOption.Move) { LionMoveOption = LionMoveOption.ZoomAndRotate; } else { LionMoveOption = LionMoveOption.Move; } } //----------------------------------------------------- _hitSprite = null; hitOnLion = false; for (int i = _spriteList.Count - 1; i >= 0; --i) { MyTestSprite sprite = _spriteList[i]; double testX = x; double testY = y; if (!sprite.JustMove && sprite.CurrentAffineTx != null) { sprite.CurrentAffineTx.Transform(ref testX, ref testY); } if (sprite.HitTest((float)testX, (float)testY, isRightButton)) { hitOnLion = true; _hitSprite = sprite; break; } } base.MouseDown(x, y, isRightButton); }
public override void Init() { lionFill = new MyTestSprite(new SpriteShape(SvgRenderVxLoader.CreateSvgRenderVxFromFile(@"Samples\lion.svg"))); //lionFill.AutoFlipY = true; }
protected override void OnStart(AppHost host) { _host = host; _vgVisElem = VgVisualDocHelper.CreateVgVisualDocFromFile(@"Samples\lion.svg").VgRootElem; _mySprite = new MyTestSprite(_vgVisElem); var evListener = new GeneralEventListener(); evListener.MouseDown += e => { if (e.Button == UIMouseButtons.Right) { VgVisualElement foundE = _mySprite.HitTest(e.X, e.Y, true); if (foundE != null) { foundE.VisualSpec.FillColor = Color.Red; _mySprite.InvalidateLayout(); } } }; evListener.MouseMove += e => { if (e.Button == UIMouseButtons.Left && e.IsDragging) { if (e.Ctrl) { //TODO: //classic Agg's move and rotate } else { //just move _mySprite.SetLocation(_mySprite.X + e.XDiff, _mySprite.Y + e.YDiff); } } }; _mySprite.AttachExternalEventListener(evListener); host.AddChild(_mySprite); //// //var textbox = new LayoutFarm.CustomWidgets.TextBox(100, 30, false); //var textSpanStyle = new Text.TextSpanStyle(); ////test with various font style //textSpanStyle.FontInfo = new PixelFarm.Drawing.RequestFont("tahoma", 18); //textSpanStyle.FontColor = new PixelFarm.Drawing.Color(255, 0, 0); ////set default style //textbox.DefaultSpanStyle = textSpanStyle; //host.AddChild(textbox); //var box1 = new LayoutFarm.CustomWidgets.Box(50, 50); //box1.BackColor = Color.Red; //box1.SetLocation(10, 10); //host.AddChild(box1); ////-------------------------------- //var box2 = new LayoutFarm.CustomWidgets.Box(30, 30); //box2.SetLocation(50, 50); //host.AddChild(box2); ////1. mouse down //box1.MouseDown += (s, e) => //{ // box1.BackColor = KnownColors.FromKnownColor(KnownColor.DeepSkyBlue); // box2.Visible = false; //}; //box1.MouseUp += (s, e) => //{ // box1.BackColor = Color.Red; // box2.Visible = true; //}; }
protected override void OnStart(AppHost host) { _background = new Box(800, 600); _background.BackColor = Color.White; host.AddChild(_background); //--------------------------- _vgVisElem = VgVisualDocHelper.CreateVgVisualDocFromFile(@"Samples\lion.svg").VgRootElem; _mySprite = new MyTestSprite(_vgVisElem); //var evListener = new GeneralEventListener(); //evListener.MouseDrag += (s, e) => //{ // if (e.Ctrl) // { // //TODO: // //classic Agg's move and rotate // } // else // { //just move // _mySprite.SetLocation(_mySprite.Left + e.XDiff, _mySprite.Top + e.YDiff); // } //}; //_mySprite.AttachExternalEventListener(evListener); var rectBounds = _vgVisElem.GetRectBounds(); _quadControl = new QuadWidgetControl(); _quadControl.ShapeUpdated += _quadControl_ShapeUpdated; // _quadControl.SetupCorners( new Quad2f( (float)rectBounds.Left, (float)rectBounds.Bottom, (float)rectBounds.Width, (float)rectBounds.Height)); _lionBounds = new RectangleF((float)rectBounds.Left, (float)rectBounds.Bottom, (float)rectBounds.Width, (float)rectBounds.Height); host.AddChild(_mySprite); host.AddChild(_quadControl); //-------------------- _cmdBiliear = new Box(30, 30); _cmdBiliear.SetLocation(400, 20); _cmdBiliear.BackColor = Color.Yellow; _cmdBiliear.MouseDown += (s, e) => { if (_useBilinear) { _cmdBiliear.BackColor = Color.Yellow; _useBilinear = false; } else { _cmdBiliear.BackColor = Color.Red; _useBilinear = true; } }; host.AddChild(_cmdBiliear); }