suchen

Heim  >  Fragen und Antworten  >  Hauptteil

objective-c - CoreAnimation 和 CoreGraphics这两个框架的区别

1.本人想知道CoreAnimation(核心动画)和CoreGraphics(核心?)这两个框架的区别

2.通过查询并未得到很令人满意的答案,所以来此想大牛提问

3.占用GPU的情况是如何的?

黄舟黄舟2758 Tage vor654

Antworte allen(1)Ich werde antworten

  • 天蓬老师

    天蓬老师2017-05-02 09:21:40

    首先说一下 Graphic是是图形的意思。

    对比一下头文件先

    CoreAnimation.h

    #ifndef COREANIMATION_H
    #define COREANIMATION_H
    
    #include <QuartzCore/CABase.h>
    #include <QuartzCore/CATransform3D.h>
    
    #ifdef __OBJC__
    #import <Foundation/Foundation.h>
    #import <QuartzCore/CAAnimation.h>
    #import <QuartzCore/CADisplayLink.h>
    #import <QuartzCore/CAEAGLLayer.h>
    #import <QuartzCore/CAMetalLayer.h>
    #import <QuartzCore/CAEmitterBehavior.h>
    #import <QuartzCore/CAEmitterCell.h>
    #import <QuartzCore/CAEmitterLayer.h>
    #import <QuartzCore/CAGradientLayer.h>
    #import <QuartzCore/CALayer.h>
    #import <QuartzCore/CAMediaTiming.h>
    #import <QuartzCore/CAMediaTimingFunction.h>
    #import <QuartzCore/CAReplicatorLayer.h>
    #import <QuartzCore/CAScrollLayer.h>
    #import <QuartzCore/CAShapeLayer.h>
    #import <QuartzCore/CATextLayer.h>
    #import <QuartzCore/CATiledLayer.h>
    #import <QuartzCore/CATransaction.h>
    #import <QuartzCore/CATransformLayer.h>
    #import <QuartzCore/CAValueFunction.h>
    #endif
    
    #endif /* COREANIMATION_H */

    CoreGraphics.h

    #ifndef COREGRAPHICS_H_
    #define COREGRAPHICS_H_
    
    #include <CoreGraphics/CGBase.h>
    #include <CoreGraphics/CGAffineTransform.h>
    #include <CoreGraphics/CGBitmapContext.h>
    #include <CoreGraphics/CGColor.h>
    #include <CoreGraphics/CGColorSpace.h>
    #include <CoreGraphics/CGContext.h>
    #include <CoreGraphics/CGDataConsumer.h>
    #include <CoreGraphics/CGDataProvider.h>
    #include <CoreGraphics/CGError.h>
    #include <CoreGraphics/CGFont.h>
    #include <CoreGraphics/CGFunction.h>
    #include <CoreGraphics/CGGeometry.h>
    #include <CoreGraphics/CGGradient.h>
    #include <CoreGraphics/CGImage.h>
    #include <CoreGraphics/CGLayer.h>
    #include <CoreGraphics/CGPDFArray.h>
    #include <CoreGraphics/CGPDFContentStream.h>
    #include <CoreGraphics/CGPDFContext.h>
    #include <CoreGraphics/CGPDFDictionary.h>
    #include <CoreGraphics/CGPDFDocument.h>
    #include <CoreGraphics/CGPDFObject.h>
    #include <CoreGraphics/CGPDFOperatorTable.h>
    #include <CoreGraphics/CGPDFPage.h>
    #include <CoreGraphics/CGPDFScanner.h>
    #include <CoreGraphics/CGPDFStream.h>
    #include <CoreGraphics/CGPDFString.h>
    #include <CoreGraphics/CGPath.h>
    #include <CoreGraphics/CGPattern.h>
    #include <CoreGraphics/CGShading.h>
    
    #endif    /* COREGRAPHICS_H_ */

    仔细观察可以看出,CoreGraphics是底层绘制框架,我们实际会用到的也就是CG开头的一些底层绘制函数和变量,这是一个纯C语言框架。

    QuartzCore也就是你说的包含了CoreAnimation的框架,是iOS系统的基本渲染框架,是一个OC语言框架,是一套基于CoreGraphics的OC语言封装,封装出了基本渲染类CALayer

    不知道说到这里,你能不能搞明白两者的区别。

    Antwort
    0
  • StornierenAntwort