ios - How to get UIImage from pixels in memory -


i have point of picture in memory, how uiimage?

i tried 2 methods below , use "uiimagewritetosavedphotosalbum(myimage, self, nil, nil);" save image album, didn't work. how solve this?

first:

nsdata *imagedata = [[nsdata alloc]initwithbytes:texture->data  length:picsize]; uiimage* myimage = [ [ uiimage alloc ]initwithdata:imagedata ]; 

second:

cgdataproviderref provider = cgdataprovidercreatewithdata(null, texture->data, texture->image_size.width * texture->image_size.height * texture->bytesperpixel, null); // prep ingredients int bitspercomponent = 8; int bitsperpixel = 32; int bytesperrow = 4 * 320; cgcolorspaceref colorspaceref = cgcolorspacecreatedevicergb(); cgbitmapinfo bitmapinfo = kcgbitmapbyteorderdefault; cgcolorrenderingintent renderingintent = kcgrenderingintentdefault; // make cgimage cgimageref imageref = cgimagecreate(320, 480, bitspercomponent, bitsperpixel, bytesperrow, colorspaceref, bitmapinfo, provider, null, no, renderingintent); uiimage *myimage = [uiimage imagewithcgimage:imageref]; 


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -