Esempio n. 1
0
        private void Draw(SKSurface surface, double scale)
        {
            var canvas = surface.Canvas;

            surface.Canvas.Clear(CanvasBackgroundColor.ToSkiaColor());
            _gridRenderer.Render(canvas, scale);
            if (ToolCollection == null)
            {
                return;
            }
            _backgroundImageRenderer.Render(canvas, scale);
            foreach (var geom in ToolCollection.Geometries)
            {
                GeometryRenderer.Render(canvas, geom, scale);
            }
            //TODO Try to do this on demand, rather than every draw...
            // Snapshotting without encoding is rather fast though and does not impact performance that much
            SnapShot = surface.Snapshot();

            //TODO Look into this
            // Not really needed, but keeps the memory slightly lower and does not impact performance that much
            var mem = GC.GetTotalMemory(true);

            System.Diagnostics.Debug.WriteLine($"Mem {mem}");
        }
        /// <summary>
        /// uses the BarcodeWriterGeneric implementation and the <see cref="WriteableBitmapRenderer"/> class for decoding
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public static Geometry WriteAsGeometry(this IBarcodeWriterGeneric writer, string content)
        {
            var bitmatrix = writer.Encode(content);
            var renderer  = new GeometryRenderer();

            return(renderer.Render(bitmatrix, writer.Format, content, writer.Options));
        }
Esempio n. 3
0
        private void RenderGeoJson()
        {
            var path   = NSBundle.MainBundle.PathForResource("GeoJSON_Sample", "geojson");
            var url    = new NSUrl(path, isDir: false);
            var parser = new GeoJSONParser(url);

            parser.Parse();

            var renderer = new GeometryRenderer(mapView, parser.Features);

            renderer.Render();
        }
Esempio n. 4
0
        private void RenderKML()
        {
            var path   = NSBundle.MainBundle.PathForResource("KML_Sample", "kml");
            var url    = new NSUrl(path, isDir: false);
            var parser = new KMLParser(url);

            parser.Parse();

            var renderer = new GeometryRenderer(mapView, parser.Placemarks, parser.Styles);

            renderer.Render();
        }