What's the difference between Quartz Core, Core Graphics and Quartz 2D?

浪子不回头ぞ 提交于 2019-11-28 15:20:44
Brad Larson

From the Quartz 2D Programming Guide:

The Quartz 2D API is part of the Core Graphics framework, so you may see Quartz referred to as Core Graphics or, simply, CG.

I have a tendency of using Quartz and Core Graphics interchangeably when referring to 2-D drawing on the Mac / iPhone, even if that's not technically correct.

The Quartz Core framework on the iPhone contains the classes and supporting elements for Core Animation and also contains items used for Core Image.

Quartz 2D is an API of the Core Graphics framework that implements drawing.
Quartz Core is a framework that includes APIs for animation and image processing.


Quartz frameworks and their APIs

CoreGraphics.framework

  • Quartz 2D API manages the graphic context and implements drawing.
  • Quartz Services API provides low level access to the window server. This includes display hardware, resolution, refresh rate, and others.

QuartzCore.framework

  • Core Animation: Objective-C API to do 2D animation.
  • Core Image: image and video processing (filters, warp, transitions).iOS 5

Quartz.frameworkOS X only

  • Image Kit: display and edit images.
  • PDF Kit: display and edit PDFs.
  • Quartz Composer: display Quartz Composer compositions.
  • QuickLookUI: preview media elements.

All three frameworks use OpenGL underneath because all drawing in iOS or OS X goes through OpenGL at some point. See the section Media Layer Frameworks of the Mac OS X Technology Overview for details.

Other "Quartz" technologies you may have heard of:

  • Quartz Extreme: GPU acceleration for Quartz Composer.
  • QuartzGL (aka "Quartz 2D Extreme"): GPU acceleration for Quartz 2D.

These are internal implementations of GPU rendering, not APIs. They decide whether to create the window buffer in the CPU and only use OpenGL to upload as a texture (the default) or to do the whole rendering using OpenGL, which not always improves performance. You can alternate between the two using the QuartzGLEnable Info.plist setting. For an explanation see John Siracusa review of Mac OS X 10.4 Tiger, pages 13 and 14.

“Quartz” and “Core” are marketing names sprinkled over frameworks and APIs in a random manner. If they wanted to create a confusing naming mess, they succeeded.

Be careful however, a new single view application will link the CoreGraphics framework by default but not QuartzCore. So you might quickly get an 'unknown object' error if you are doing anything with CAEAGLLayer for example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!