PDA

View Full Version : Drawing an image into a Panel?



NanoGator
05-26-2014, 06:14 PM
Hey All,

I'm trying to draw a picture inside of a panel. I found Just Add Milk's blog about using the PIL module, so suppose that'd work... but I was wondering what happened to LScript's 'glyphs'? Isn't there a built-in way in the SDK to load an image and blit it into a panel or canvas? (I don't have PIL installed and was hoping to avoid it so I can use it at work as well...)

B

iain_r
05-29-2014, 01:24 PM
See this thread forums.newtek.com/showthread.php?140001-How-to-draw-data-graphics-in-Lightwave-Python

Regards

Iain

NanoGator
07-10-2014, 09:46 PM
See this thread forums.newtek.com/showthread.php?140001-How-to-draw-data-graphics-in-Lightwave-Python

Regards

Iain

Hmm I appreciate it, but I'm still stuck. I'd like to find a way to load in data from an image file, but without installing any 3rd party stuff. Does the LW SDK, per chance, offer this sort of functionality? I mean, if I can load in images, can I ask them their RGB values and blit them into a canvas or something?

iain_r
07-12-2014, 04:46 AM
If you can read the file into memory and know where the chunks containing the RGB values are then I guess it should be possible. If I get some time I'll have a look and see what I can do. I've not tried the SDK but there is an example binview that might give you some ideas.

Regards

Iain

iain_r
07-12-2014, 07:42 AM
Simple example of using image list to put and image on a panel. It loads the image into the image list, you can get the size and pixel information from there. There are probably more ways of doing this but this just uses the native functions. You'll need to change the path to the images.

Regards

Iain

NanoGator
07-17-2014, 09:22 PM
Simple example of using image list to put and image on a panel. It loads the image into the image list, you can get the size and pixel information from there. There are probably more ways of doing this but this just uses the native functions. You'll need to change the path to the images.

Regards

Iain

Thank you, thank you, thank you. That's one part of a huge problem solved. But I wanted to ask: Drawing that image is painfully slow. Are you aware of any ways that be done in a faster way? Is that what the blitPanel function you asked about in the SDK is supposed to do? (I'm asking because in ye-olden-days in LScript land there was something called a 'Glyph' that did this very well, you could even do animation with it.)

iain_r
07-18-2014, 02:38 PM
Not tried blitPanel, something else to look into, but just wanted to use the native capabilities with as little code as possible. It wasn't too slow on my machine, some of my other attempts were painfully slow, and yes I miss the lscript Glyph capabilities as well.

I'll see what I can try next with the panels and images.

Regards

Iain