I need to make a lasso implementation for an image.
The user clicks on the image and a dot is placed,
after the next click, one more point is added and they are connected by a line. And this happens until the lines intersect. After that, only the area that was selected remains on the image, and the rest becomes transparent.
Can you please help. I do not need a full implementation of this logic, but at least help in which direction to look for information, or there are already ready-made solutions in the form of a library. I was thinking of using uibezierpath to draw but I don't know how to apply it to clearing the rest of the image
Related
I've been asked to build something similar to this so that customers can draw basics shapes of kitchen tops. Similar to that in the image below but also have dimensions.
It looks like konva has support for basic shapes like rectangle and circle etc and it also includes a transformer which allows for resizing. However, I think if I want to build a custom shape like the one in green and have individual sizing i.e. resize each individual line. I am going to have to build something myself.
I was hoping someone could point me in the right direction. I have seen an example where someone has used a "line" class which takes a series of points and then sets the attribute to closed which fills in the shape. Obviously I would need to extend this to allow the custom resizing. However, Im not sure this is the correct path to head down?
Any suggestions?
.
How about using rectangles and having an option to snap them together. It should be fairly simple to do the edge detection and snapping. Then show the result as a Konva.Line around the perimeter.
Then you can show all the control handles for the rectangles except those on the sides where another Rect has joined.
Out of the box we get LinearGradient, RadialGradient and SweepGradient. What I would like to do is something similar to the shown image below. Let's say we draw a custom shape with CustomPainter. When this customShapeGradient is applied on it, the gradient should start from the border of the custom shape and go towards the center. I realize that this might introduce wierd effects since our shape will mostly be not symmetric and a "border to center" approach is not as easy as a "center to border" approach(like the 3 out of the box methods). Here it will be the developer's responsibility to make sure the gradient fill do not overlap with itself, meaning it won't go all the way to the center.
Here is an image I found for an Elliptic shape which most closely describe what I want. Let's say our shape is the line with the yellow color. And I want to achieve the gradient which fills inside.
This is a similar image too:
The two examples I have provided are for ellipses however my question is for any type of shape that is created by a CustomPainter.
I am almost sure this is possible since a shadow(gradient in nature) is basically the inverse of this. We can apply a shadow to a CustomPainter shape. The only difference will be that the shadow will grow towards inside of the shape(maybe like a inner shadow).
I'm trying to implement a way to allow a user to quickly edit which portion of their selected photo to be an icon. However the default state is simply a square but my icons are circles. I know I can simply make a circle from the square image they select but from a UX standpoint that's not ideal. I would prefer them to simply select an image with knowledge of it being a circle in mind.
As far as I know, there is no way to easily do this. I would suggest keeping it as a square and simply displaying the image in a round imageView.
There should be no significant difference between saving the image as a circle and displaying it as a circle.
Hope this helps.
I want to use multiple irregular picture makes up a map, each picture is a button.Transparent part of the images will overwrite each other, how should I do to make their control areas does not overlap.
I use a lot of pictures makes up a large map.
And each piece of the map is irregular, but their control area is a rectangle. Because they all have transparent pixels.
I just want to make the hit area and their shape becomes the same.Some encountered a similar problem?
I have implemented one for the cocos2d-x v3.x:
https://github.com/yszheda/cocos2d-x-irregular-button
It works OK on cocos2d-x v3.2. Maybe you can have a try XD
I am trying to solve a problem using Bing maps v7 JS API. My problem is that I need a custom callout or bubble with the beak pointing to a specific position (lat/lon) and the bubble portion containing 2-4 short lines of text which describe that point. The bubble portion should be movable (and the text within it).
Our first try at this was using a pushpin and an infobox. This functioned as desired but was not aesthetically pleasing. It was created where the pushpin could be moved and the infobox followed. The only option to mark the original location of the pushpin once it was moved was to extend a polyline from the pushpin tip to the original point. This really wasn't intuitive when looking at the map because the actual location was not at the push pin but at the end of the polyline connecting the pushpin to the original location. Also, there were 3 different objects used for each point which detracted from the presentation of the map.
Now, alternatively, I have created a polygon resembling a callout whose bubble portion can be moved around while keeping the beak pointing to the desired location (this is a requirement as well). What I can't figure out is how to place text within the polygon. Moving this text with the polygon would be the next hurdle but something that I am pretty sure that I can handle once I figure out how to place it. The text needs to be, say white, with a transparent background so that it appears it and the polygon are one.
In this application there will be 3-8 of these callouts. And each may have their bubbles re-positioned so that they may all fit in the screen view.
How can I place text within a polygon using the v7 JS API?
Thanks!
Any ideas