ios 将图片变成圆形】的更多相关文章

利用CAShapeLayer能够制作出随意的几何图形,把它作为UIImageView的遮罩,达到把图片做成圆形效果. imgView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 35, 80, 80)]; imgView.image = [UIImage imageNamed:@"ma.jpg"]; UIBezierPath* path = [UIBezierPath bezierPathWithArcCenter:CGPoin…
#pragma mark - 将图片转换成圆形 -(UIImage*) circleImage:(UIImage*) image withParam:(CGFloat) inset { UIGraphicsBeginImageContext(image.size); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 2); CGContextSetStrokeColorWith…
UIImageView * imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"oiuyfdsa.png"]]; imageView.frame = CGRectMake(.f, .f, .f, .f); imageView.layer.masksToBounds = YES; imageView.layer.cornerRadius = ;…
转自http://blog.csdn.net/kkmike999/article/details/16359713 /** * 转换图片成圆形 * * @param bitmap * 传入Bitmap对象 * @return */ public Bitmap toRoundBitmap(Bitmap bitmap) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); float roundPx; float left…
iOS多图片下载.在cell里面下载图片.做了缓存优化. (app.icon是图片地址) // 先从内存缓存中取出图片 UIImage *image = self.images[app.icon]; if (image) { // 内存中有图片 cell.imageView.image = image; } else { // 内存中没有图片 // 获得Library/Caches文件夹 NSString *cachesPath = [NSSearchPathForDirectoriesInDo…
实现如图所示效果: 这是一个UIButton,需要改变image和title相对位置. 解决如下: //设置文字偏移:向下偏移图片高度+向左偏移图片宽度 (偏移量是根据[图片]大小来的,这点是关键)btnLeft.titleEdgeInsets = UIEdgeInsets(top: btnLeft.imageView!.frame.size.height, left: -btnLeft.imageView!.frame.size.width, bottom: 0, right: 0) //设置…
以下内容转载自:http://my.oschina.net/u/2340880/blog/403996 IOS中图片拉伸技巧与方法总结 一.了解几个图像拉伸的函数和方法 1.直接拉伸法 简单暴力,却是最最常用的方法,直接将图片设置为ImageView的image属性,图片便会随UIImageView对象的大小做自动拉伸.这种拉伸的方法有一个致命的缺陷,它会使图像发生失真与形变. 2.像素点的拉伸 - (UIImage *)stretchableImageWithLeftCapWidth:(NSI…
iOS 除去图片的白色背景(接近白色),或者其它颜色的替换 方法如下: //去除图片的白色背景 + (UIImage*) imageToTransparent:(UIImage*) image { // 分配内存 const int imageWidth = image.size.width; const int imageHeight = image.size.height; size_t bytesPerRow = imageWidth * 4; uint32_t* rgbImageBuf…
ios中图片的绘画和截图 CGImageCreateWithImageInRect截图和UIGraphicsGetImageFromCurrentImageContext绘画图片 使用CGImageCreateWithImageInRect截图 UIImage *img1 = [UIImage imageNamed:@"123"]; //截取图片 CGImageRef imgSmall = CGImageCreateWithImageInRect(img1.CGImage, CGRec…
原文 对于大多数 iOS 应用来说,图片往往是最占用手机内存的资源之一,同时也是不可或缺的组成部分.将一张图片从磁盘中加载出来,并最终显示到屏幕上,中间其实经过了一系列复杂的处理过程,其中就包括了对图片的解压缩. 图片加载的工作流 概括来说,从磁盘中加载一张图片,并将它显示到屏幕上,中间的主要工作流如下: 1.假设我们使用 +imageWithContentsOfFile: 方法从磁盘中加载一张图片,这个时候的图片并没有解压缩: 2.然后将生成的 UIImage 赋值给 UIImageView…