Loading images from memory in PyCEGUI

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Sejten
Just popping in
Just popping in
Posts: 3
Joined: Mon Feb 11, 2013 21:21

Loading images from memory in PyCEGUI

Postby Sejten » Mon Feb 11, 2013 21:40

Hi,
I'm trying to display dynamically generated images in PyCEGUI but I do not know exactly how to do it. I have python buffer object with image data in RGB format which I want to load into gui. My guess is that I have to create PyCEGUI Texture, then put it into PyCEGUI imageset and then display it in Window, but I'm stuck on creating Texture step.
Example code(trying to create 15x15 image):

Code: Select all

       b = bytearray(675)
       b = buffer(b)   
       self.t = PyCEGUI.Texture()
       self.t.loadFromMemory(b,PyCEGUI.Size(15.0,15.0),PyCEGUI.Texture.PF_RGB)


Produces error:

Code: Select all

Texture.loadFromMemory(Texture, buffer, Size, PixelFormat)
did not match C++ signature:
    loadFromMemory(Texture_wrapper {lvalue}, void const*, CEGUI::Size, CEGUI::Texture::PixelFormat)
    loadFromMemory(CEGUI::Texture {lvalue}, void const* buffer, CEGUI::Size buffer_size, CEGUI::Texture::PixelFormat pixel_format)


Any help would be appreciated.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Loading images from memory in PyCEGUI

Postby Kulik » Mon Feb 11, 2013 23:33

Hmm, I am pretty sure we don't support this.

PyCEGUI would need a wrapper for this which I apparently forgot to implement.

Tracked in http://cegui.org.uk/mantis/view.php?id=957

Sejten
Just popping in
Just popping in
Posts: 3
Joined: Mon Feb 11, 2013 21:21

Re: Loading images from memory in PyCEGUI

Postby Sejten » Sun May 12, 2013 15:00

Then probably the best workaround to this is to load image as texture in imageset from hard-drive and then periodically overwrite image and refresh it in PyCegui. I loaded this image as part of my .scheme file so I need to find the imageset and refresh somehow this image. Am I correct? To find the imageset I tried to iterate through all imagesets but it seems ImagesetManager::ImagesetIterator is not working - .next() does nothing.

Code: Select all

        while not PyCEGUI.ImagesetManager.getSingleton().getIterator().isAtEnd():
            print PyCEGUI.ImagesetManager.getSingleton().getIterator().getCurrentKey()
            PyCEGUI.ImagesetManager.getSingleton().getIterator().next()


Also I see that there is no method to refresh already loaded texture so probably I should load it again with loadFromFile() ?


Return to “Help”

Who is online

Users browsing this forum: Bing [Bot] and 22 guests