I have a floor plan (.svg format) and I want to load this svg with SkiaSharp, so that I could zoom-in and zoom out. (this guy's documentation was very helpful)
I will put a pin on svg (on SkiaSharp)
I created AbsoluteLayout and ImageButton and used AbsoluteLayout.SetLayoutBounds method. This worked.
But, this is actually not skiasharp's control, this is forms control. I have a coordinates on svg and I will use skiasharp svg's coordinates . How can I add a layer by layer control on skiasharp, or does skiasharp have a control for this?
Related
I'm working on a basic design app where the user can upload images to a canvas, drag them around and resize them. The problem I have is resizing the image with a mouse drag. I'd like the user to position the mouse pointer on either corner of the bitmap image and drag either towards or away from the bitmap to resize it proportionally. I'd be grateful for any code or suggestions.
Lanny mentioned that you had this question here. ZIM, which is based on CreateJS has this functionality built in - it is called transform(). We also have an uploader built in called Loader().
Here is the code that you would use inside the ZIM template available on the code page at ZIM https://zimjs.com
const loader = new Loader().center();
loader.on("loaded", e=>{
e.bitmap.center().transform();
// or if you want multiple files
// loop(e.bitmaps, bitmap=>{
// bitmap.center().transform();
// });
loader.removeFrom();
stage.update();
});
Below is an image that has been loaded. You can try it here https://zimjs.com/explore/uploadresize.html. The transform interface will go away when the user clicks off the image and then comes back when they click on the image. There are various options for all of this that you can read about in the Docs available on the ZIM site.
All your regular CreateJS will work and you will find that ZIM is helpful in many other ways too! Aside from transform() there is drag() for normal dragging, and gesture() for pinch zoom and rotate - you would use one or the other of these not combined.
I am currently trying to make a map like canvas with buttons inside using SkiaSharp and Xamarin.Forms.
but when it comes to zoom / pan i can't sync this 2 up because when
a) im using a control with zoom / pan actions and canvas + buttons as childs with inverse scale, that mostly works but the skiasharp canvas will be blurry because it's only an element transform (bitmap scaling)
b) the buttons don't stay at the desired location when using the direct skiasharp canvas transform and a seperate content container for the buttons because (bad) transform syncing
any idea on how to combine this 2 components to a map with button markers like element?
My suggestion would be to use AbsoluteLayouts to stack Xamarin.Forms buttons (or Images with GestureRecognizers) over the top of a drawn SKCanvas. Each time a button is clicked you then have to eventually call InvalidateSurface() on the SKCanvas and it will redraw with the parameters that were changed by the clicking of the button. I'm doing this a lot in an app of mine and am very happy with it, you can see it over here.
I have a CombinedChart in my app (same app on both Android and iOS platforms using MPAndroidChart & iOS-Charts respectively) with stacked bars and a line but I also need to highlight specific points where a given event happened. I've got some small icon images (png) and need to place the correct image at the correct place on the graph depending on what type of event happened.
I have tried Bubble chart first and can get bubbles of the right colour at the right location but can't specify custom image instead of the bubbles' circles.
I am now trying Scatter Chart which does have a Custom shape option but it's not just a shape I need, it's a specific image. I have not worked with Core Graphics before so I'm not familiar with CGPath functions.
Is there a way to pass a UIImage to the ScatterChart customScatterShape property?
Or maybe a way to convert a UIImage created from a named png to a CGPath object which the Scatter Chart custom shape requires?
Thanks in advance for your suggestions!
As of MPAndroid version 3.0.2, you can pass in a Drawable as part of your Entry dataSet.add(new Entry(x, y, drawable)), and enable the drawIcons flag via dataSet.setDrawIcons(true).
Source code where icon gets drawn for Line charts specifically: LineChartRenderer.java
I have draw a pieChart with CorePlot,and I want to fill each piece of the pieChart with animation.The point is Core-Plot doesn't has a animation on CPTPieChart.So how should I add a fill animation to the pieChart?
All visible parts of a Core Plot graph are drawn in Core Animation layers. All of the standard animations are available to you. Many Core Plot-specific properties are animatable as well. There is a list of animatable properties in the Core Plot docs. You can also use the CPTAnimation class to animate nearly any property, including those that are not supported by Core Animation.
I have a squared formed image. I need to add perspective view to it and then make an animation that will restore image back to square view. This actions must work at least in all newest versions of browsers and without Flash.
I have tried to do this as follows:
Using RaphaelJS I can only clip image (create path and set fill to image url), not add perspective.
Canvas works as svg and vml in RaphaelJS... I can't add perspective with it's help.
CSS3 3D animation method rotateX adds perspective, but it is supported only by Chrome and Safary.
There is no way to add perspective to image using built in tools.
The only possible solution, I have found is using SVG add clip path to image - it doesn't add perspective view, but it's the best possible solution.
As I understand - we can use Canvas to add perspective, but you must write your own javascript algorithm to transform plain image to perspective view.