I have an array of data that repres开发者_运维技巧ents PNG:
unsigned short systemFontTexture[] = {
...
0x5089,0x474E,0x0A0D,0x5089,0x474E,0x0A0D,0x5089,
0x474E,0x0A0D,0x5089,0x474E,0x474E,0x0A0D,0x5089,
0x474E,0x0A0D,0x5089,0x474E,0x474E,0x0A0D,0x5089,
...
}
Can I create PNG file using this data? If yes, then HOW?
Create a data provider to serve up the data, and then create an image with the data provider.
create a graphics context for an image and draw onto it. then save to png
Create a CGBitmapContext
draw your pixels
create a create a CGImage from from the CGBitmapContext
save the CGImage as PNG using CGImageDestination
really close, just use ofstream to save your array as "picture.png". If your hex is correct and have the 8 byte signature before your pixels, it should work.
精彩评论