美文网首页就你这辣鸡还来开发我的iOS
iOS CoreGraphics gif图片DIY框架

iOS CoreGraphics gif图片DIY框架

作者: 一本大书 | 来源:发表于2018-09-12 14:54 被阅读38次

使用方法

1、在头部导入 #import "ZZCoreEmoji.h"
2、创建一个画布、在画布上创建素材。
素材支持移动、旋转、缩放、文字素材支持双击替换文字、并且可以自定义文字样式。

效果
    // -----图片素材-----
    ZZMatterView *mView = [[ZZMatterView alloc]
                           initWithImage:[UIImage imageNamed:@"panda"]
                           center:CGPointMake(200, 200)];
    [self.canvasView addSubview:mView];
    [self.canvasView.matterViews addObject:mView];

    // -----文本素材-----
    ZZTextAttributes *attributes = [[ZZTextAttributes alloc]
                                    initWithText:@"哈哈哈\n呵呵额"
                                    font:[UIFont systemFontOfSize:40]
                                    textColor:[UIColor redColor]
                                    borderColor:[UIColor yellowColor]];
    UIImage *textImage = [UIImage zz_imageWithAttributes:attributes];
    mView = [[ZZMatterView alloc] initWithImage:textImage
                                         center:CGPointMake(100, 100)
                                           attributes:attributes];
    [self.canvasView addSubview:mView];
    [self.canvasView.matterViews addObject:mView];

图片制作方法调用

// 制作图片
    self.canvasView.currentView = nil;
    
    ZZDrawImageOptions *options = [[ZZDrawImageOptions alloc]
                                   initWithCanvasView:self.canvasView
                                   originalImage:self.iconView.image
                                   matterViews:self.canvasView.matterViews];
    
    ZZDrawImageManager *manager = [ZZDrawImageManager new];
    __weak typeof(self) weakSelf = self;
    [manager drawImageWithOptions:options complete:^(UIImage *image) {

    }];

大致架构设计


image.png

Demo地址:https://github.com/Linzehua2015/ZZCoreEmoji

相关文章

  • iOS CoreGraphics gif图片DIY框架

    使用方法 1、在头部导入 #import "ZZCoreEmoji.h"2、创建一个画布、在画布上创建素材。素材支...

  • iOS绘图框架CoreGraphics分析

    iOS绘图框架CoreGraphics分析 iOS绘图框架CoreGraphics分析

  • 压缩gif文件的二进制NSData

    利用CoreGraphics/CoreGraphics.h API转换GIF图片并再次转成符合要求的图片的二进制文...

  • iOS CoreGraphics 学习与使用

    iOS中绘制方法比较多, CoreGraphics ,UIKit 框架中都有一些方法. CoreGraphics中...

  • iOS开发CoreGraphics核心图形框架之一——CGPat

    iOS开发CoreGraphics核心图形框架之一——CGPath的应用一、引言CoreGraphics核心图形框...

  • SDWebImage

    SDWebImage介绍 iOS中著名的网络图片处理框架. 包含的功能:图片下载,图片缓存,下载进度监听,GIF处...

  • iOS动画(CoreAnimation)

    一、iOS核心动画介绍 CoreAnimation框架是基于OpenGL与CoreGraphics图像处理框架的一...

  • iOS核心动画

    iOS核心动画 核心动画框架 CoreAnimation框架是基于OpenGL与CoreGraphics图像处理框...

  • iOS动画合集

    iOS核心动画 CoreAnimation框架是基于OpenGL与CoreGraphics图像处理框架的一个跨平台...

  • SDWebImage

    一、简介 iOS中著名的牛逼的网络图片处理框架包含的功能:图片下载、图片缓存、下载进度监听、gif处理等等用法极其...

网友评论

    本文标题:iOS CoreGraphics gif图片DIY框架

    本文链接:https://www.haomeiwen.com/subject/gmqzwftx.html