I'm looking for a way to create a logic color drawing like fill tool in photoshop or gimp or event paint...Here is basically what I want to implement :
--->
Any suggestion on how to do that ?
Sounds/looks like you just need to implement a flood fill algorithm. There a few variations, from simple 4-direction to more complex 8-direction, though all work on a similar principle and are fairly easy to implement.
Here's a link to a GameDev.SE post that may be a good place to start and perhaps even a better place to post this question!
You can implement the flood fill algorithm
Related
I want to create the shapes which are at the bottom of the design, but I'm unable to think of an approach I tried transform.rotate on a container but there are overflow issues. Any kind of help is appreciated. Thanks!
Here's the link to the design, that I want to create.
There are a few solutions for this UI:
You can export the background as an image.
Pros: Save time, easy.
Cons: Performance is not good as solution 2 below (for loading image and app size).
Use canvas (and paint) to draw those curves. If you're not familiar with Canvas in Flutter, you can check this tutorial.
Pros: performance is better (render time is faster and app size is smaller).
Cons: time consuming, sometimes you will need to have good maths knowledge to draw complex UI.
I found a better option for creating custom shapes.
There is this website, which converts shapes to code.
Here's the link: https://fluttershapemaker.com
It saves a lot of time. Thanks.
Can anyone tell me about how to color with pattern(Butterfly) like follwing link a link.
In addition to reading the entirety of the CGLayer reference you posted in your original question I strongly advise you to watch the 'Optimizing 2D Graphics and Animation Performance' session from the 2012 WWDC.
As you progress I think you'll find that it isn't particularly difficult to draw content to the screen using the likes of Quartz 2D and Core Animation but the real challenge will be doing so in a way that achieves an acceptable level of performance.
In the session they optimise a drawing app similar to the one you want to create. The fundamental principals they used to optimize their drawing app were:
Only ever update as little of the screen as you need to
Every so often create a flat composite image of what the user has drawn and re-use this image in proceeding drawing operations. This prevents having to draw everything the user has drawn to the canvas individually, making the application much more performant.
In addition to this they cover a collection of tricks to squeeze out every drop of performance.
I apologise that I have no code examples for you (I usually like my answers to include some) but your question was very broad. I suggest you watch the video I have suggested, continue your research and attempt to begin implementing the application yourself. Once you run into more specific problems you can return here for answers in the event you can't find them elsewhere.
Good luck!
im planning to do a percentage visualisation using a circle, and am currently trying to figure out what framework / technique to use.
i have used corePlot for graphs so far and have been wondering if it might be an option
my ideas are so far:
1: use a Core Plot piechart and add a covering circle layer in the middle
2: try to use quartz 2d to do it somehow
attached is a mockup how it should look like so you get an idea:
what do you think might be the best approach here? id like avoid using cover-up subviews and such..
is there any simple solution i might be missing?
thanks in advance
sebastian
(PS: i do not hope for any code here, just a general fingerpoint to the right direction)
As more of an alternative than an actual straightforward CorePlot answer, you could display your percentage in a customized version of the UICircularProgressView control which I can personally vouch for.
I need to visualize stuff and want to ask for some hints and tutorials. Or which technique to use (Cocos2D, OpenGL, Quartz, ...)
Anyone here who did Visualization on iOS Devices?
It's about moving objects, fading, particles and more...
Any help is appreciated. I attached two examples.
It depends on what you what to present. For something like the very organic color blobs on the left, OpenGL is probably the way to go. For something more crisp and regular like the chart of the right, CoreAnimation layers are probably a good approach because they would be easy to work with yet also performant.
OpenGL does take more work to understand but of course in the end is going to offer the most flexibility, so it's more a matter of deciding how far down the graphics rabbit hole you really want to go.
Suppose I was writing a game which involved a relatively complex geometric game board. Something like a dartboard.
I would want a view to display the game state. What is the best way to implement that view?
For example, should I draw the board off line in something like photoshop, add it as a resource, and then show it using a UIImageView? Or should I use drawing primitives and essentially draw the board programmatically?
What are the trade-offs?
If I do use an image, what format should I prefer? .png, .tiff, .gif, .jpg?
Thanks,
John
If you decide to go the image route you should use png. Displaying any other format you pay a performance hit (as mentioned in the comment).
To decide between building photoshop vs drawing via code you need to decide how much time you want to put into learning Quartz/CoreGraphics. Apple's docs:
http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html
If you already know Photoshop then building the graphic there is probably much easier, if you don't then learning Quartz is prob a less steep learning curve than Photoshop...
If it's a simple board, it's easy enough to draw it into the view, which gives you the possibility of easily manipulating it in interesting ways. Drawing in a view is done with a set of postscript like primitives.
For something more fancy, photoshop might be the way to go.
PNGs are preferred.