Very complicated probably

This is an extremely complicated question, probably, but does anyone know how to generate a png file by reading the file? As in not using display.newImage. Basically, does anyone know how display.newImage works? [import]uid: 147322 topic_id: 33173 reply_id: 333173[/import]

That will be handled by the underlying OpenGL layer. If you want to know how to load PNG files you’re probably better off reading up on file formats… google. But the mechanism behind the newImage function will be the file loading function in Obj-C, I should imagine. Don’t know what that is though, as I don’t know Obj-C. [import]uid: 8271 topic_id: 33173 reply_id: 131742[/import]

I’ll take a stab at trying to answer this though I could be way off base…

A PNG file is a lightly compressed file that contains some meta data and 4 arrays of single 8bit bytes of data. Each of these arrays are called channels. If your image is say 100x150, then each array is 100 columns and 150 rows of bytes. Each byte contains a value of 0-255 and represents the amount of either Red, Green, Blue or Transparency that byte can have. Each Channel represents one of the 3 colors or the alpha values.

Under the hood, a PNG file must be read into memory, uncompressed and saved into these channels. Then this data is blited onto the screen (http://en.wikipedia.org/wiki/Bit_blit) in a way that the video driver knows how to light up the right LCD’s in the right amounts of color. Then of course you have to manage drawing the screen for that frame off screen, then rapidly blitting the whole screen on for every frame. Oh the fun days when we had to do all this by hand… er. our own code.

Enter 4G languages.

Naturally, that’s a lot of code to deal with, so as our computers have improved in performance, our ability to write more advanced routines to deal with this makes our lives easier. Now OpenGL deals with all the frame buffers, blitting, processing the PNG file, etc. and they give us API calls to make it easier.

Still the OpenGL calls require a lot of code to get the image on the screen. That’s where Objective C and the iOS SDK come into play (or Java and the Android SDK). They know how to talk to Open GL and they make it easier to load an image and put it on the screen. But even that’s a bunch of code to write. Corona SDK abstracts that for us by giving us a single API call that will call the Objective C/iOS SDK to put the image on the screen for us. Then the iOS SDK calls the Open GL stuff, which then does all the actual image processing to get bits and bytes on the screen.

Corona SDK Does not give us pixel level access leaving all that work to the underlying layers.

If you want to do that, type of programming, you’re going to have to drop back at a minimum to Objective C and at that point you could do your own API that either called OpenGL or took over part of the screen to do your own thing.
[import]uid: 19626 topic_id: 33173 reply_id: 131754[/import]

So, in other words, don’t try it?

Do you know of any other way I could deform images, or is it not possible with Corona? [import]uid: 147322 topic_id: 33173 reply_id: 131777[/import]

PNG is not trivial. :slight_smile: libpng manual

When shaders do come along, they would give you this kind of control.

An idea that’s been floating around in my head has been to use the display.capture*() and / or display.save() machinery to build up images out of tiles (which could be taken down as far as pixels). I suspect this would be slow, but maybe if it was amortized across several frames, say loading this 1/8 one frame, this the next, etc…

Depending on how interactive you need it to be, you could go all out. Just apply your distortion transformations locally and try to get fine-grained enough to eliminate artifacts.

I have some tiling code here:

Sheet module

and a sample here:

Tiling sample [import]uid: 27791 topic_id: 33173 reply_id: 131802[/import]

That will be handled by the underlying OpenGL layer. If you want to know how to load PNG files you’re probably better off reading up on file formats… google. But the mechanism behind the newImage function will be the file loading function in Obj-C, I should imagine. Don’t know what that is though, as I don’t know Obj-C. [import]uid: 8271 topic_id: 33173 reply_id: 131742[/import]

You could get Corona Enterprise and have access to compiled C libraries and then you can pretty much do anything.

Corona SDK proper does not give you pixel level access to images.
[import]uid: 19626 topic_id: 33173 reply_id: 131823[/import]

I’ll take a stab at trying to answer this though I could be way off base…

A PNG file is a lightly compressed file that contains some meta data and 4 arrays of single 8bit bytes of data. Each of these arrays are called channels. If your image is say 100x150, then each array is 100 columns and 150 rows of bytes. Each byte contains a value of 0-255 and represents the amount of either Red, Green, Blue or Transparency that byte can have. Each Channel represents one of the 3 colors or the alpha values.

Under the hood, a PNG file must be read into memory, uncompressed and saved into these channels. Then this data is blited onto the screen (http://en.wikipedia.org/wiki/Bit_blit) in a way that the video driver knows how to light up the right LCD’s in the right amounts of color. Then of course you have to manage drawing the screen for that frame off screen, then rapidly blitting the whole screen on for every frame. Oh the fun days when we had to do all this by hand… er. our own code.

Enter 4G languages.

Naturally, that’s a lot of code to deal with, so as our computers have improved in performance, our ability to write more advanced routines to deal with this makes our lives easier. Now OpenGL deals with all the frame buffers, blitting, processing the PNG file, etc. and they give us API calls to make it easier.

Still the OpenGL calls require a lot of code to get the image on the screen. That’s where Objective C and the iOS SDK come into play (or Java and the Android SDK). They know how to talk to Open GL and they make it easier to load an image and put it on the screen. But even that’s a bunch of code to write. Corona SDK abstracts that for us by giving us a single API call that will call the Objective C/iOS SDK to put the image on the screen for us. Then the iOS SDK calls the Open GL stuff, which then does all the actual image processing to get bits and bytes on the screen.

Corona SDK Does not give us pixel level access leaving all that work to the underlying layers.

If you want to do that, type of programming, you’re going to have to drop back at a minimum to Objective C and at that point you could do your own API that either called OpenGL or took over part of the screen to do your own thing.
[import]uid: 19626 topic_id: 33173 reply_id: 131754[/import]

So, in other words, don’t try it?

Do you know of any other way I could deform images, or is it not possible with Corona? [import]uid: 147322 topic_id: 33173 reply_id: 131777[/import]

PNG is not trivial. :slight_smile: libpng manual

When shaders do come along, they would give you this kind of control.

An idea that’s been floating around in my head has been to use the display.capture*() and / or display.save() machinery to build up images out of tiles (which could be taken down as far as pixels). I suspect this would be slow, but maybe if it was amortized across several frames, say loading this 1/8 one frame, this the next, etc…

Depending on how interactive you need it to be, you could go all out. Just apply your distortion transformations locally and try to get fine-grained enough to eliminate artifacts.

I have some tiling code here:

Sheet module

and a sample here:

Tiling sample [import]uid: 27791 topic_id: 33173 reply_id: 131802[/import]

You could get Corona Enterprise and have access to compiled C libraries and then you can pretty much do anything.

Corona SDK proper does not give you pixel level access to images.
[import]uid: 19626 topic_id: 33173 reply_id: 131823[/import]

Hello friend I found this topic useful and found great app software to make free calls for iPhone and android using this free app for calls. [import]uid: 234713 topic_id: 33173 reply_id: 144854[/import]

Hello friend I found this topic useful and found great app software to make free calls for iPhone and android using this free app for calls. [import]uid: 234713 topic_id: 33173 reply_id: 144854[/import]

Hello friend I found this topic useful and found great app software to make free calls for iPhone and android using this free app for calls. [import]uid: 234713 topic_id: 33173 reply_id: 144854[/import]

Hello friend I found this topic useful and found great app software to make free calls for iPhone and android using this free app for calls. [import]uid: 234713 topic_id: 33173 reply_id: 144854[/import]