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

    Objective-C 程序实现在图片上添加文字

    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); //create a graphic context with CGBitmapContextCreate CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst

    1.4K40发布于 2021-10-29
  • 来自专栏iOS面试技术问题

    探讨iOS 图片解压缩到渲染过程

    其中,用到的最核心的函数是 CGBitmapContextCreate : CG_EXTERN CGContextRef __nullable CGBitmapContextCreate(void * kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst; CGContextRef context = CGBitmapContextCreate } else { ... } } 它接受一个原始的位图参数 imageRef ,最终返回一个新的解压缩后的位图 newImage ,中间主要经过了以下三个步骤: 使用 CGBitmapContextCreate 事实上,SDWebImage 中对图片的解压缩过程与上述完全一致,只是传递给 CGBitmapContextCreate 函数的部分参数存在细微的差别 性能对比: 在解压PNG图片,SDWebImage

    2.1K40发布于 2020-09-17
  • 来自专栏大师级码师

    ios通过按钮点击异步加载图片代码

    logo.size.height; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); //create a graphic context with CGBitmapContextCreate CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst

    2.1K10发布于 2021-10-29
  • 来自专栏程序员——iOS开发

    iOS开发 - 图片的解压缩到渲染过程

    其中,用到的最核心的函数是 CGBitmapContextCreate : CG_EXTERN CGContextRef __nullable CGBitmapContextCreate(void * kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst; CGContextRef context = CGBitmapContextCreate } else { ... } } 它接受一个原始的位图参数 imageRef ,最终返回一个新的解压缩后的位图 newImage ,中间主要经过了以下三个步骤: 使用 CGBitmapContextCreate 事实上,SDWebImage 中对图片的解压缩过程与上述完全一致,只是传递给 CGBitmapContextCreate 函数的部分参数存在细微的差别 性能对比: 在解压PNG图片,SDWebImage

    2K00发布于 2019-04-25
  • 来自专栏直播知识

    短视频直播源码,iOS图片去背景

    imageSize {     CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();     CGContextRef context = CGBitmapContextCreate image.size.height *4);     CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();     CGContextRef context = CGBitmapContextCreate

    83830发布于 2020-11-20
  • 来自专栏Hello world

    iOS图片像素点颜色处理

    grayBytesPerRow = grayImgWidth * 2;//每一行所占的byte数 //创建一个位图绘制环境(BitmapContext) CGContextRef grayContext = CGBitmapContextCreate gryImgRef); CGColorSpaceRelease(graySpaceRef); CGContextRelease(grayContext);给CGBitmapContextCreate size_t bytesPerRow = foreImgWidth * 4; //创建一个位图绘制环境(BitmapContext) CGContextRef context = CGBitmapContextCreate context); CGColorSpaceRelease(colorSpace);这里有一个这个参数值 kCGImageAlphaFirst | kCGBitmapByteOrder32Big,和上边CGBitmapContextCreate 这个参数也可以是:kCGImageAlphaLast | kCGBitmapByteOrder32Little,但要注意的是CGBitmapContextCreate这个的参数也需要改成:kCGImageAlphaNoneSkipLast

    2.3K50编辑于 2022-11-17
  • 来自专栏云原生布道专栏

    【IOS开发基础系列】SDWebImageDownloader专题

    colorSpaceInfo =CGImageGetColorSpace(imageRef); //    CGContextRef bitmapContext; //    bitmapContext = CGBitmapContextCreate kCGImageAlphaNone || infoMask ==kCGImageAlphaNoneSkipFirst || infoMask ==kCGImageAlphaNoneSkipLast);     // CGBitmapContextCreate CGContextRef context = CGBitmapContextCreate(NULL, imageSize.width, imageSize.height,  CGImageGetBitsPerComponent stackoverflow.com/questions/1434714/another-iphone-cgbitmapcontextcreateimage-leak UIGraphicsBeginImageContext vs CGBitmapContextCreate http://stackoverflow.com/questions/4683448/uigraphicsbeginimagecontext-vs-cgbitmapcontextcreate iPhone

    1.4K20编辑于 2023-10-16
  • 来自专栏云原生布道专栏

    【IOS开发高级系列】异步绘制专题

    CGContextRef context = CGBitmapContextCreate(NULL, imageSize.width, imageSize.height colorSpaceInfo = CGImageGetColorSpace(imageRef); // CGContextRef bitmapContext; // bitmapContext = CGBitmapContextCreate CGContextRelease(bitmapContext); // CGImageRelease(imgref); // // return newImage; //方案四,CGBitmapContextCreate http://stackoverflow.com/questions/4683448/uigraphicsbeginimagecontext-vs-cgbitmapcontextcreate iPhone blog.sina.com.cn/s/blog_5fb39f9101017n1v.html iOS绘图教程 http://blog.csdn.net/nogodoss/article/details/18660153 CGBitmapContextCreate

    1.9K20编辑于 2022-03-08
  • 来自专栏云原生布道专栏

    【IOS开发进阶系列】APP性能优化专题

    UIGraphicsEndImageContext();     //    CGContextRelease(context);     //     //    return colouredImage;     //方案三,CGBitmapContextCreate colorSpaceInfo = CGImageGetColorSpace(imageRef);     //    CGContextRef bitmapContext;     //    bitmapContext = CGBitmapContextCreate CGContextRelease(bitmapContext);     //    CGImageRelease(imgref);     //    return newImage;     //方案四,CGBitmapContextCreate colorSpaceInfo = CGImageGetColorSpace(imageRef);     //    CGContextRef bitmapContext;     //    bitmapContext = CGBitmapContextCreate

    1.2K20编辑于 2023-10-16
  • 来自专栏APP自动化测试

    UIImage 图片处理:截图,缩放,设定大小,存储

    255 - m_PixelBuf[index + 1];// g m_PixelBuf[index + 2] = 255 - m_PixelBuf[index + 2];// r } ctx = CGBitmapContextCreate (显示图像数据区,也就是unsigned char*转为graphics context或者UIImage或和CGImageRef) CGContextRef ctx = CGBitmapContextCreate

    2.6K61发布于 2019-10-15
  • 来自专栏陈满iOS

    iOS复习中有关SDWebImage可能知识点总结(2)

    size_t bytesPerRow = kBytesPerPixel * width; // kCGImageAlphaNone is not supported in CGBitmapContextCreate CGContextRef context = CGBitmapContextCreate(NULL,

    1K10发布于 2018-09-10
  • 来自专栏岑志军的专栏

    iOS系统生成二维码

    extent) * scale; CGColorSpaceRef cs = CGColorSpaceCreateDeviceGray(); CGContextRef bitmapRef = CGBitmapContextCreate

    83840发布于 2018-05-28
  • 来自专栏HelloCode开发者学习平台

    看完必懂 【iOS图片解压缩】流程总结

    为图片开辟一片内存区域 // 一个像素点的颜色值包含 RGBA 各8位,共4个字节 void *imageData = malloc(width * height * 4); // 创建上下文 /** CGBitmapContextCreate * 4 space:颜色空间 bitmapInfo:位图的信息,此处采用RGBA,即kCGImageAlphaPremultipliedLast */ CGContextRef context = CGBitmapContextCreate

    1.4K20发布于 2021-08-25
  • 来自专栏落影的专栏

    iOS开发笔记(七)

    创建context CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate void lyProviderReleaseData (void *info, const void *data, size_t size) { free((void*)data); } 问题1:CGBitmapContextCreate

    1.8K90发布于 2018-04-27
  • 来自专栏正则

    AFNetworking源码探究(十二) —— 数据解析之子类中协议方法的实现

    return image; } // CGImageGetBytesPerRow() calculates incorrectly in iOS 5.0, so defer to CGBitmapContextCreate kCGImageAlphaPremultipliedFirst; } #pragma clang diagnostic pop } CGContextRef context = CGBitmapContextCreate

    74730发布于 2021-09-03
  • 来自专栏一棹烟波

    OpenCV Mat与UIImage之间的转换

    (rows, cols, CV_8UC4); // 8 bits per component, 4 channels 8 9 CGContextRef contextRef = CGBitmapContextCreate

    1.6K30发布于 2019-05-25
  • 来自专栏Rindew的iOS技术分享

    iOS 刮奖

    * 4); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); CGContextRef context = CGBitmapContextCreate

    65610发布于 2019-12-24
  • 来自专栏阿林前端开发攻城狮

    iOS从背景图中取色的代码

    malloc( bitmapByteCount ); //创建CoreGraphic的图形上下文,该上下文描述了bitmaData指向的内存空间需要绘制的图像的一些绘制参数 context = CGBitmapContextCreate

    1.3K20发布于 2021-10-29
  • 来自专栏我只不过是出来写写iOS

    AFNetworking框架分析(五)——响应的序列化AFURLResponseSerialization分析

    return image; } // CGImageGetBytesPerRow() calculates incorrectly in iOS 5.0, so defer to CGBitmapContextCreate kCGImageAlphaPremultipliedFirst; } #pragma clang diagnostic pop } CGContextRef context = CGBitmapContextCreate

    1.7K30发布于 2019-04-02
  • 来自专栏编程语言

    iOS:AVCaptureSession 通过摄像头获取某一帧的画面

    CGColorSpaceCreateDeviceRGB(); // 用抽样缓存的数据创建一个位图格式的图形上下文(graphics context)对象 CGContextRef context = CGBitmapContextCreate

    3.2K31发布于 2018-09-19
领券