首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏落影的专栏

    iOS坐标系探究

    { [super drawRect:rect]; CGContextRef context = UIGraphicsGetCurrentContext(); NSLog(@"CGContext { [super drawRect:rect]; CGContextRef context = UIGraphicsGetCurrentContext(); NSLog(@"CGContext 先介绍一个图形上下文(graphics context)的概念,比如说我们常用的CGContext就是Quartz 2D的上下文。图形上下文包含绘制所需的信息,比如颜色、线宽、字体等。 我们回顾下上文提到的两个渲染结果,我们产生如下疑问: UIGraphicsGetCurrentContext返回的是CGContext,代表着是左下角为原点的坐标系,用UILabel(UIKit坐标系) 通常我们都会使用UIKit进行渲染,所以iOS系统在drawRect返回CGContext的时候,默认帮我们进行了一次变换,以方便开发者直接用UIKit坐标系进行渲染。

    3.4K30发布于 2018-11-01
  • 来自专栏日常技术分享

    iOS Charts实现非连续折线图

    self.dataProvider = dataProvider } open override func drawData(context: CGContext ILineChartDataSet) } } } @objc open func drawDataSet(context: CGContext context.restoreGState() } @objc open func drawCubicBezier(context: CGContext context.restoreGState() } open func drawCubicFill( context: CGContext ) { drawCircles(context: context) } private func drawCircles(context: CGContext

    2.1K30发布于 2018-12-05
  • 来自专栏Molier的小站

    iOS 中使用 OpenGL 实现增高功能

    kCGRenderingIntentDefault); UIGraphicsBeginImageContext(CGSizeMake(imageWidth, imgHeight)); CGContextRef cgcontext = UIGraphicsGetCurrentContext(); CGContextSetBlendMode(cgcontext, kCGBlendModeCopy); CGContextDrawImage (cgcontext, CGRectMake(0, 0, imageWidth, imgHeight), iref); CGImageRef imageMasked = CGBitmapContextCreateImage (cgcontext); UIImage * image = [UIImage imageWithCGImage:imageMasked scale:screenScale orientation

    79740编辑于 2022-11-03
  • 来自专栏哈雷彗星撞地球

    iOS 中获取某个视图的截图

    NSMutableArray *images = [NSMutableArray array]; while (contentHeight > 0) { // 5.获取CGContext 5.获取CGContext UIGraphicsBeginImageContextWithOptions(boundsSize, NO, 0.0); CGContextRef

    3.9K41发布于 2018-08-22
  • 来自专栏一“技”之长

    iOS开发CoreGraphics核心图形框架之四——变换函数

    iOS开发CoreGraphics核心图形框架之四——变换函数 一、引言     在上一篇博客中,介绍了有关CGContext相关操作方法,其中可以直接调用一些方法来进行所绘制图形的平移,缩放,翻转等变换 关于CGContext的相关内如博地址客如下:https://my.oschina.net/u/2340880/blog/759070。

    74810发布于 2018-08-15
  • 来自专栏iOSer成长记录

    iOS-Core系列框架介绍(一)

    CoreGraphics.CGShading // 变换 import CoreGraphics.CGAffineTransform // 绘图、图像I/O相关 import CoreGraphics.CGContext CGPath、CGImage等常用的对象 定义了CGPoint、CGSize、CGRect等常用的数据结构并提供了相关的几何运算函数, 定义了CGLayer并提供了渐变和变换矩阵的接口 提供了绘图接口(CGContext

    1.2K30发布于 2018-06-29
  • 来自专栏Dotnet9

    SwiftUI图片处理(缩放、拼图)

    (size: NSSize(width: imgW, height: imgH)) togetherImg.lockFocus() let imgContext: CGContext cgContext var imgX: CGFloat = 0 for imgItem in imgArray { if let img = imgItem var imageRect: NSRect = NSRect(x: 0, y: 0, width: 0, height: 0) // // var imageContext: CGContext cgContext // imageContext?.draw(imageRef, in: imageRect) // newImage?.

    4.8K20发布于 2021-12-01
  • 来自专栏韦弦的偶尔分享

    在Swift中标识对象

    } extension Circle: Renderable { func render(in context: CGContext) { context.drawCircle( self.renderable = renderable } } extension RenderableWrapper: Renderable { func render(in context: CGContext

    1K20编辑于 2022-03-30
  • 来自专栏Code_iOS

    OpenGL ES 2.0 (iOS)[06-1]:基础纹理

    // allocated bytes CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef cgContext CGColorSpaceRelease(colorSpace); // Flip the Core Graphics Y-axis for future drawing CGContextTranslateCTM (cgContext , 0, height); CGContextScaleCTM (cgContext, 1.0, -1.0); // Draw the loaded image into the Core Graphics context // resizing as necessary CGContextDrawImage(cgContext, CGRectMake(0, 0, width , height), cgImage); CGContextRelease(cgContext); *widthPtr = width; *heightPtr = height

    2.4K43发布于 2018-08-30
  • 来自专栏蜉蝣禅修之道

    iOS OpenGL ES常见问题整理

    glClearStencil(0xff)和glClear(GL_STENCIL_BUFFER_BIT) iOS9系统图片花屏 iOS 9上使用CGContextDrawImage解码图片时会带上上一次解码的残影,即使是一个新的CGContext

    3K50发布于 2020-06-14
  • 来自专栏码客

    iOS 图片处理 生成文字图片

    imageWidth); UIGraphicsBeginImageContextWithOptions(size, false, 0.0); let context:CGContext

    8.3K10发布于 2019-10-22
  • 来自专栏iOS开发干货分享

    iOS开发----JavaScriptCore、UIWebView及WKWebView交互的那些事

    在基本的交互过程中,其实最常使用的有三个:JSContext、JSValue、JSExport JSContext 简单的理解为执行JavaScript的一个环境,就好像我们在绘制View时候需要获取的CGContext

    2K20编辑于 2023-03-19
  • 来自专栏進无尽的文章

    绘图-Core Graphics

    前言 CGContext又叫图形上下文,相当于一块画布,以堆栈形式存放,只有在当前context上绘图才有效。 Paste_Image.png 让我们来看一下CGContext.h 里面的方法: CGContextRef context = UIGraphicsGetCurrentContext(); 设置上下文

    2K30发布于 2018-09-12
  • 来自专栏陈满iOS

    iOS图形处理概论:OpenGL ES,Metal,Core Graphics,Core Image,GPUImage,Scene Kit (3D) ,Sprite Kit (2D),OpenCV

    UIKit与Core Graphics的关系 在UIKit中,UIView类本身在绘制时自动创建一个图形环境,即Core Graphics层的CGContext类型,作为当前的图形绘制环境。 图形环境Context Quartz 2D中使用的图形环境也由一个类CGContext表示。 在Quartz 2D中可以把一个图形环境作为一个绘制目标。 Quartz 2D提供的主要类包括: CGContext:表示一个图形环境; CGPath:使用向量图形来创建路径,并能够填充和stroke; CGImage:用来表示位图; CGLayer:用来表示一个能够用于重复绘制和

    4.3K41发布于 2018-09-10
  • 来自专栏iOSDevLog

    Turi Create 机器学习模型实战:你也能轻松做出Prisma 风格的图片!

    // 4 let rgbColorSpace = CGColorSpaceCreateDeviceRGB() let context = CGContext(data: 接着,将所有数据创建为CGContext,当我们需要渲染(或改变)某些底层的属性时,就可以简单地调用它,这是我们在下列两行代码中透过转化及缩放图像所做的事。

    1.9K20发布于 2018-10-10
  • 来自专栏iOSDevLog

    初探 Core ML:学习建立一个图像识别 App

    let rgbColorSpace = CGColorSpaceCreateDeviceRGB() let context = CGContext(data: pixelData, width 接着把这些资料作成 CGContext。这样一来每当我们需要渲染(或是改变)一些底层属性时可以很轻易的呼叫使用。最后的两行代码即是以此进行翻转以及缩放。

    3.8K70发布于 2018-05-17
  • 来自专栏一“技”之长

    iOS开发CoreGraphics核心图形框架之二——深入理解图形上下文

    的值 kCGPDFContextSubject //设置文档的关键字 kCGPDFContextKeywords //设置密钥长度 kCGPDFContextEncryptionKeyLength 四、CGContext CoreGraphics框架中提供的CGContext绘制相关方法解析如下: //获取CGContext类在CoreGraphics框架中的id值 CFTypeID CGContextGetTypeID

    3.2K20发布于 2018-08-15
  • 来自专栏iOS面试技术问题

    Swift日常开发随笔

    viewSize.width, height: viewSize.height) UIGraphicsBeginImageContext(rect.size) let context: CGContext viewSize.width, height: viewSize.height) UIGraphicsBeginImageContext(rect.size) let context: CGContext

    2.3K22发布于 2020-10-11
  • 来自专栏哈雷彗星撞地球

    iOS Bluetooth 打印小票(二)

    NSMutableArray *images = [NSMutableArray array]; while (contentHeight > 0) { // 5.获取CGContext 5.获取CGContext UIGraphicsBeginImageContextWithOptions(boundsSize, NO, 0.0); CGContextRef

    3.7K20发布于 2018-08-22
  • 来自专栏一“技”之长

    iOS开发CoreGraphics核心图形框架之九——PDF文件的渲染与创建

    其中,CGPDFDocumentRef对应整个PDF文档,里面封装了许多文档相关的信息,CGPDFPageRef对应PDF文档中某一页的内容,通过它开发者可以将PDF内容通过CGContext上下文渲染到指定目标上

    1.5K31发布于 2018-08-15
领券