public override void Initialize() { PPath n = PPath.CreateRectangle(0, 0, 100, 80); // add another node the the root as a reference point so that we can // tell that our node is getting dragged, as opposed the the canvas // view being panned. Canvas.Layer.AddChild(PPath.CreateRectangle(0, 0, 100, 80)); Canvas.Layer.AddChild(n); // tell the node to show its default handles. PBoundsHandle.AddBoundsHandlesTo(n); // The default PBoundsHandle implementation doesn't work well with PPaths that have strokes. The reason // for this is that the default PBoundsHandle modifies the bounds of an PNode, but when adding handles to // a PPath we really want it to be modifying the underlying geometry of the PPath, the shape without the // stroke. The solution is that we need to create handles specific to PPaths that locate themselves on the // paths internal geometry, not the external bounds geometry... n.Pen = new Pen(Color.Black, 10); n.Brush = Brushes.Green; // Here we create our own custom handle. This handle is located in the center of its parent // node and you can use it to drag the parent around. This handle also updates its color when // the is pressed/released in it. PHandle h = new PathHandle(new PNodeLocator(n)); h.AddInputEventListener(new HandleEventHandler(h)); // make this handle appear a bit different then the default handle appearance. h.Brush = Brushes.Red; h.SetBounds(-10, -10, 20, 20); // also add our new custom handle to the node. n.AddChild(h); }
public void SetGlyphToPath(FontHandle font, uint glyphIndex) { PathHandle path = PathHandle.Invalid; if (segments.Count != 0) { byte[] segmentBytes = segments.Cast <byte>().ToArray(); float[] coordsFloats = coords.ToArray(); path = vg.CreatePath( Constants.VG_PATH_FORMAT_STANDARD, PathDatatype.VG_PATH_DATATYPE_F, 1.0f / 2048, 0.0f, segmentBytes.Length, coordsFloats.Length, PathCapabilities.VG_PATH_CAPABILITY_ALL ); vg.AppendPathData(path, segmentBytes, coordsFloats); } var origin = new float[] { 0.0f, 0.0f }; vg.SetGlyphToPath(font, glyphIndex, path, false, origin, escapement); if (path != PathHandle.Invalid) { vg.DestroyPath(path); } }
protected Shape(IOpenVG vg) { this.vg = vg; this.PaintModes = PaintMode.VG_STROKE_PATH; this.StrokeLineWidth = 1.0f; // Create an OpenVG path resource: this.path = vg.CreatePathStandardFloat(); }
public override void Initialize() { PPath n = PPath.CreateRectangle(0, 0, 100, 80); // add another node the the root as a reference point so that we can // tell that our node is getting dragged, as opposed the the canvas // view being panned. Canvas.Layer.AddChild(PPath.CreateRectangle(0, 0, 100, 80)); Canvas.Layer.AddChild(n); // tell the node to show its default handles. PBoundsHandle.AddBoundsHandlesTo(n); // The default PBoundsHandle implementation doesn't work well with PPaths that have strokes. The reason // for this is that the default PBoundsHandle modifies the bounds of an PNode, but when adding handles to // a PPath we really want it to be modifying the underlying geometry of the PPath, the shape without the // stroke. The solution is that we need to create handles specific to PPaths that locate themselves on the // paths internal geometry, not the external bounds geometry... n.Pen = new Pen(Color.Black, 10); n.Brush = Brushes.Green; // Here we create our own custom handle. This handle is located in the center of its parent // node and you can use it to drag the parent around. This handle also updates its color when // the is pressed/released in it. PHandle h = new PathHandle(new PNodeLocator(n)); h.AddInputEventListener(new HandleEventHandler(h)); // make this handle appear a bit different then the default handle appearance. h.Brush = Brushes.Red; h.SetBounds(-10, -10, 20, 20); // also add our new custom handle to the node. n.AddChild(h); }
private void OpenWithBrowser_Click(object sender, RoutedEventArgs e) { var getBrowser = PathHandle.GetStandardBrowserPath(); var etLink = (RememberUtility.Model.Entertainment)listviewEt.SelectedItem; var getFileName = Path.GetFileName(getBrowser); var returnOpenWtihBrowser = etLink.Links; var ArgumentsPlus = string.Empty; if (getFileName == "chrome.exe") { ArgumentsPlus = " -incognito " + returnOpenWtihBrowser; Process.Start(getBrowser, ArgumentsPlus); } else if (getFileName == "firefox.exe") { ArgumentsPlus = " -private " + returnOpenWtihBrowser; Process.Start(getBrowser, ArgumentsPlus); } else { Process.Start(getBrowser, returnOpenWtihBrowser); } }
public uint Ellipse(PathHandle path, float cx, float cy, float width, float height) { var result = vguEllipse(path, cx, cy, width, height); return(result); }
public uint RoundRect(PathHandle path, float x, float y, float width, float height, float arcWidth, float arcHeight) { var result = vgRoundRect(path, x, y, width, height, arcWidth, arcHeight); return(result); }
public uint Line(PathHandle path, float x0, float y0, float x1, float y1) { var result = vgLine(path, x0, y0, x1, y1); return(result); }
public void SetGlyphToPath(FontHandle font, uint glyphIndex, PathHandle path, bool isHinted, float[] origin, float[] escapement) { vgSetGlyphToPath(font, glyphIndex, path, isHinted ? 1U : 0, origin, escapement); }
public void AppendPathData(PathHandle path, byte[] segments, float[] coords) { vgAppendPathData(path, segments.Length, segments, coords); }
public void DrawPath(PathHandle path, PaintMode paintModes) { vgDrawPath(path, paintModes); }
public void DestroyPath(PathHandle path) { //Console.WriteLine("vgDestroyPath"); vgDestroyPath(path); }
void DrawHandle(int i) { var handlePosition = BezierPath[i]; var anchorHandleSize = GetHandleDiameter( _globalDisplaySettings.anchorSize * Data.bezierHandleScale, BezierPath[i]); var controlHandleSize = GetHandleDiameter( _globalDisplaySettings.controlSize * Data.bezierHandleScale, BezierPath[i]); var isAnchorPoint = i % 3 == 0; var isInteractive = isAnchorPoint || BezierPath.ControlPointMode != BezierPath.ControlMode.Automatic; var handleSize = (isAnchorPoint) ? anchorHandleSize : controlHandleSize; var doTransformHandle = i == _handleIndexToDisplayAsTransform; var handleColours = (isAnchorPoint) ? _splineAnchorColours : _splineControlColours; var cap = _capFunctions[(isAnchorPoint) ? _globalDisplaySettings.anchorShape : _globalDisplaySettings.controlShape]; PathHandle.HandleInputType handleInputType; handlePosition = PathHandle.DrawHandle( handlePosition, BezierPath.Space, isInteractive, handleSize, cap, handleColours, out handleInputType, i); if (doTransformHandle) { // Show normals rotate tool if (Data.showNormals && Tools.current == Tool.Rotate && isAnchorPoint && BezierPath.Space == PathSpace.Xyz) { Handles.color = _handlesStartCol; var attachedControlIndex = (i == BezierPath.NumPoints - 1) ? i - 1 : i + 1; var dir = (BezierPath[attachedControlIndex] - handlePosition).normalized; var handleRotOffset = (360 + BezierPath.GlobalNormalsAngle) % 360; _anchorAngleHandle.radius = handleSize * 3; _anchorAngleHandle.angle = handleRotOffset + BezierPath.GetAnchorNormalAngle(i / 3); var handleDirection = Vector3.Cross(dir, Vector3.up); var handleMatrix = Matrix4x4.TRS( handlePosition, Quaternion.LookRotation(handleDirection, dir), Vector3.one); using (new Handles.DrawingScope(handleMatrix)) { // draw the handle EditorGUI.BeginChangeCheck(); _anchorAngleHandle.DrawHandle(); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_creator, "Set angle"); BezierPath.SetAnchorNormalAngle(i / 3, _anchorAngleHandle.angle - handleRotOffset); } } } else { handlePosition = Handles.DoPositionHandle(handlePosition, Quaternion.identity); } } switch (handleInputType) { case PathHandle.HandleInputType.LmbDrag: _draggingHandleIndex = i; _handleIndexToDisplayAsTransform = -1; break; case PathHandle.HandleInputType.LmbRelease: _draggingHandleIndex = -1; _handleIndexToDisplayAsTransform = -1; break; case PathHandle.HandleInputType.LmbClick: if (Event.current.shift) { _handleIndexToDisplayAsTransform = -1; // disable move tool if new point added } else { if (_handleIndexToDisplayAsTransform == i) { _handleIndexToDisplayAsTransform = -1; // disable move tool if clicking on point under move tool } else { _handleIndexToDisplayAsTransform = i; } } break; case PathHandle.HandleInputType.LmbPress: if (_handleIndexToDisplayAsTransform != i) { _handleIndexToDisplayAsTransform = -1; } break; } if (BezierPath[i] != handlePosition) { Undo.RecordObject(_creator, "Move point"); BezierPath.MovePoint(i, handlePosition); } }