What are the main advantages of using core plot in iOS applications to draw graphs? - core-plot

Can someone please tell me the main advantages of using core plot to draw graphs in iOS.

Core Plot is a mature framework that has a lot of flexibility. It can draw many different types of plots and offers many options to customize the appearance of the graph. The graphs can be interactive and support gestures like panning and pinch zoom. You can animate various properties using Core Animation or the animation class built into Core Plot which offers additional capabilities.

Related

Reasons to use CoreGraphics instead of SpriteKit?

SpriteKit runs efficiently on the GPU.
CoreGraphics runs on the CPU.
I can't think of any drawing that CoreGraphics can do that SpriteKit can't do.
Given this, can you name reasons for why someone may still want to prefer CoreGraphics over SpriteKit for new apps?
It's not an "either or" question, because there are disparities in their abilities.
Core Graphics can make very complex imagery, with incredibly sophisticated build ups of layers with differing effects and content. But most of all, it's very good at drawing shapes and lines at a quality that no other iOS framework matches. As Apple says:
Core Graphics... provides low-level, lightweight 2D rendering with
unmatched output fidelity. You use this framework to handle path-based
drawing, transformations, color management, offscreen rendering,
patterns, gradients and shadings, image data management, image
creation, and image masking, as well as PDF document creation,
display, and parsing.
https://developer.apple.com/reference/coregraphics
You won't find PDF export creation, image creation (texture creation, yes, but not image creation), nor complex gradients, color management, complex patterns, transforms and offscreen rendering with a context in SpriteKit.
Similarly, you won't find the kind of anti-aliasing in Core Graphics in SpriteKit.
If you want to integrate your creations from image making into UIKit applications, you're far better off using a blend of Core Graphics, Core Image and Core Animation than even attempting to use SpriteKit for that kind of image creation and animation in an app.
Use SpriteKit for games that suitably benefit from the focus on Sprites as the primary graphic content.
You might, for example, choose Core Animation and Core Graphics for games that focus on more dynamic content or a demand for higher quality programmatically created content than you can get from just SpriteKit. Or you could use Core Graphics to make content for sprites at a higher quality than you'll ever get out of SKShapeNode.
So... horses for courses.
The courses being, basically:
A) Sprites and Simple 2D rendering and drawing
B) All kinds of graphics, dynamic drawing and much higher demands in quality and output types
or
C) A bit of a blend of both

confusion regarding quartz2d, core graphics, core animation, core images

i am working on a project which requires some image processing, i also asked question regarding it and i got very good solution here is the link create whole new image in iOS by selecting different properties
but now i want to learn this in more detail and i am confused from where should i start learning quartz 2d or core animation or core graphics or core image
apple documents say regarding quartz 2d that
The Quartz 2D API is part of the Core Graphics framework, so you may
see Quartz referred to as Core Graphics or, simply, CG.
and apple docs says about core graphics that
The Core Graphics framework is a C-based API that is based on the
Quartz advanced drawing engine.
this is confusing how they both relate to each other...
now core animation contains all concepts of coordinates, bounds, frames etc which is also required in drawing images
and core image is introduced in ios 5
from where should i start learning or i which sequence i start learning all these.
Quartz and Core Graphics are effectively synonymous. I tend to avoid using "Quartz" because the term is very prone to confusion (indeed, the framework that includes Core Animation is "QuartzCore," confusing matters further).
I would say:
Learn Core Graphics (CoreGraphics.framework) if you need high performance vector drawing (lines, rectangles, circles, text, etc.), perhaps intermingled with bitmap/raster graphics with simple modifications (e.g. scaling, rotation, borders, etc.). Core Graphics is not particularly well suited for more advanced bitmap operations (e.g. color correction). It can do a lot in the way of bitmap/raster operations, but it's not always obvious or straightforward. In short, Core Graphics is best for "Illustrator/Freehand/OmniGraffle" type uses.
Learn Core Animation (inside QuartzCore.framework) if, well, you need to animate content. Basic animations (such as moving a view around the screen) can be accomplished entirely without Core Animation, using basic UIView functionality, but if you want to do fancier animation, Core Animation is your friend. Somewhat unintuitively, Core Animation is also home to the CALayer family of classes, which in addition to being animatable allow you to do some more interesting things, like quick (albeit poorly performing) view shadows and 3D transforms (giving you what might be thought of as "poor man's OpenGL"). But it's mainly used for animating content (or content properties, such as color and opacity).
Learn Core Image (inside QuartzCore.framework) if you need high performance, pixel-accurate image processing. This could be everything from color correction to lens flares to blurs and anything in between. Apple publishes a filter reference that enumerates the various pre-built Core Image filters that are available. You can also write your own, though this isn't necessarily for the faint of heart. In short, if you need to implement something like "[pick your favorite photo editor] filters" then Core Image is your go-to.
Does that clarify matters?
Core Animation is a technology that relies a lot more on OpenGL, which means its GPU-bound.
Core Graphics on the other hand uses the CPU for rendering. It's a lot more precise (pixel-wise) than Core Animation, but will use your CPU.

iOS: is Core Graphics implemented on top of OpenGL?

I have found one diagram that shows Core Graphics implemented above OpenGL, and another that puts it alongside OpenGL. I would think that Apple would be smart to give each equal access to the graphics hardware but then again, I don't know much about the graphics chip they are using... maybe it is 3D all the way?
Does anybody here know the specifics?
Yes, on iOS Core Graphics (Quartz) appears to be layered on top of OpenGL ES for drawing that targets the screen, although not in an explicit way that we have access to.
Core Graphics takes vector elements (lines, arcs, etc.) and some raster ones (images) and processes them for display to the screen or for other forms of output (PDF files, printing, etc.). If the target is the screen on iOS, those vector elements will be hosted in a CALayer, either directly or through the backing layer of a UIView.
These Core Animation layers are effectively wrappers around rectangular textures on the GPU, which is how Core Animation can provide the smooth translation, scaling, and rotation of layers on even the original iPhone hardware. I can't find a reference for it right now, but at least one WWDC presentation states that OpenGL ES is used by Core Animation to communicate with the GPU to perform this hardware acceleration. Something similar can be observed on the new dual-GPU MacBook Pros, where the more powerful GPU kicks in when interacting with an application using Core Animation.
Because Core Graphics rasterizes the vector and raster elements into a CALayer when drawing to the screen, and a CALayer effectively wraps around an OpenGL ES texture, I would place OpenGL ES below Core Graphics on iOS, but only for the case where Core Graphics is rendering to the screen. The reason for the side-by-side placement in the hierarchy you saw may be due to three factors: on the Mac, not all views are layer-backed, so they may not be hardware accelerated in the same way; we can't really interact with the OpenGL ES backing of standard UI elements, so from a developer's point of view they are distinct concepts; and Core Graphics can be used to render to offscreen contexts, like PDF files or images.
Core Graphics and OpenGL are two completely separate systems. Look at the image below (source), which shows both listed at the same level. The description of Core Graphics lower on the same page also indicates that it is the lowest-level native drawing system.
Also see the About OpenGL ES page. It shows that the OpenGL code runs directly on the GPU, and if you scroll down you will see that there are some things which cannot be done with an application that uses OpenGL. Obviously, if CG was based on OpenGL, you wouldn't be able to do those things ever.
Finally, look at the Drawing Model page for iOS. At the top, it compares OpenGL to native drawing, indicating that they work separately from each other.
Core Graphics and OpenGL are separate technologies. UIKit and AppKit are built on top of both, as well as Core Animation. You can see the graphics technology stack inside Apple's documentation (Core Animation Programming Guide)
As of iOS 9 Core Graphics on iOS are based on Apple's Metal framework, not OpenGL.

How can I create a corner pin effect in XNA 4.0?

I am trying to write a strategy game using XNA 4.0, with a dynamically generating map, and it's really difficult to create all the ground textures, having to distort them individually in photoshop.
So what I want to do is create a flat image, and then apply the distortion programatically to simulate perspective, by moving the corners of the image.
Here is an example done in photoshop:
How can I do that in XNA?
My answer isn't XNA-specific as I've never actually used the library; however the concept should still apply.
In general, the best way to get a good perspective effect is to actually give 3d coordinates and transformations and let DirectX/OpenGL handle the rest. This has great benefits over attempting to do it yourself - specifically, ease of use, performance (much of the work is passed on to your graphics card), and perspective-correct texturing. And nothing's stopping you from doing 3d and 2d in the same scene, if that's a concern. There are numerous tutorials online for getting set up in the third dimension with XNA. I'd suggest heading over to MSDN.

Is there a visualization framework like JUNG for iOS?

Is there a visualization framework like JUNG for iOS?
I'd like to implement something similar to this.
Best graph plotting library for iOS is Core plot. It is very powerful, and easy to understand.
But for simple graphs you can use s7graphview library also.
If you want to do it yourself, you can do custom drawing using Core graphics.

Resources