PIXMAP

Community Forums/Monkey2 Talk/PIXMAP

Richard Betson(Posted 2015) [#1]
Hi,

PIXMAP'S! Any chance of these wonderful things being in MX2?

Rock on,


Samah(Posted 2015) [#2]
This would be part of the scope of Mojo 2 rather than the language itself, but yes it would be something nice to have.


ImmutableOctet(SKNG)(Posted 2015) [#3]
Well, we have arrays, buffers, surfaces, and soon canvases. I don't think we need much else. Maybe image encoding and decoding. I know it's not much, but I already made these two modules. Nothing special, but there's also 'LoadImageData' and 'WritePixels'. I think once Mojo 2 comes out, we'll be pretty much set.


Richard Betson(Posted 2015) [#4]
^Yup. I thought this was a good place for that request. But it would be cool to have it in MX2. It is one feature I miss in MX1/Mojo1 and hard to workaround in some cases.

Mark tell me there are PIXMAP's in Mojo 2. :)


Skn3(Posted 2015) [#5]
It would be cool if pix maps were in. It was useful for apps and certain non game related things to be able to manipulate images in RAM instead of on the GPU.


DruggedBunny(Posted 2015) [#6]

And to render to image:

Local image:=New Image( 256,256 )
Local canvas:=New Canvas( image ) 'render to image!


Would definitely be nice to have for low-level access, but wouldn't the above mostly take care of what you'd actually want to do with a pixmap?


taumel(Posted 2015) [#7]
You always want fast and easy access to data (Amiga/PS4). Textures related this could be create/load/save/encode/decode, read/write/copy access on an per pixel/chunk/colour basis and having access to the framebuffer.


Skn3(Posted 2015) [#8]
And to render to image:

Local image:=New Image( 256,256 )
Local canvas:=New Canvas( image ) 'render to image!


The way I understood it, mojo2 does canvas rendering on GPU. This is really useful for sure but it's not the same as having access to images in RAM. I guess if we can set/get the pixels with a byte array/databuffer, that would be suitable!


Richard Betson(Posted 2015) [#9]
It was useful for apps and certain non game related things

Although generally true not all the time. For example I use PIXMAP's to display massive images as backgrounds in games. Having PIXMAP makes easy to dice up that large image into manageable chunks (ala. PixMapWindow() ). It also allows for easy customization as other large scale images can be loaded and quickly processed. Reading pixel data into arrays is a possibility bit requites a layer of management and is slow. In porting my Phoenix USC project I need to use really massive images so it's problem for me and working around it feels inefficient and kludge-ish.


marksibly(Posted 2015) [#10]
Yes, now that we actually have pointers to memory, pixmaps of some type will be back! I could probably have this with int[]'s or something in monkey1 - and I may still do! LoadImageData in monkey1's opengl module is definitely moving in this direction, only it returns width/height in a hacky way.

I think it is very useful to be able to store image data in a completely 'neutral' way that doesn't depend on textures/canvas etc.


Richard Betson(Posted 2015) [#11]
pixmaps of some type will be back!

OMG Thanks! Heart Heart. :) Very good news.


Skn3(Posted 2015) [#12]
Mark,

Any chance you could consider making the image loading routines modular. So for example maybe you register extensions to a particular function pointer or class instance. That in turn has code for loading the image data. This way we could write image loaders and plug them into the mojo pipeline.

A good example of where this could be useful is if we wanted to say wrap freeimage and override mojo's image loading. We could also add support for new image formats as extended modules.

Something like:
Class TGALoader implements MojoImageDataLoader
    Method OnLoad:int[](path:string)
    End
End

AddImageLoader("tga",new TGALoader)


Something like that.


k.o.g.(Posted 2015) [#13]
The idea of skn3 is cool!

Something similar to bmax factory system :)