Importing image from Clipboard to Texture

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
raveneyex
Posts: 19
Joined: Thu Jul 15, 2010 8:16 am
Contact:

Importing image from Clipboard to Texture

Post by raveneyex »

Hey Everyone!
How are the projects going?

Straight to the point:

I have certain data in memory and formatted as a Device Independent Bitmap (DIB), specifically said data is on the clipboard memory.
What I need to achieve is a way to use that data as a texture and apply it to a previosly displayed scenenode.

I've been looking in here and reading the API but I can't seem to find a way to do it; also, I DON'T care if the way to do it is platform dependent...
I lost platform independency a while ago, so it's ok to use WIN related methods...

Any idea or any place I should be looking?
Any clue will be very much appreciated.
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Post by Bate »

That's how you access the clipboard:

Code: Select all

HANDLE clip;

if (OpenClipboard(NULL))
{
  clip = GetClipboardData(CF_TEXT);
  CloseClipboard();
}

string text = (char*)clip;
However, there are different formats (other than CF_TEXT):
http://msdn.microsoft.com/en-us/library ... 85%29.aspx

So maybe some image format is helpful.

Finally, you will probably have to copy the data to a texture using lock() / unlock().
Never take advice from someone who likes to give advice, so take my advice and don't take it.
raveneyex
Posts: 19
Joined: Thu Jul 15, 2010 8:16 am
Contact:

Post by raveneyex »

Thanks Bate!

However, I already have access to the clipboard and the data formatted (it's a CF_DIB)
What I need to know it's what you're saying about copying the data to the texture using lock()/unlock()

Have any example or could point me out to one?
Thank you!
:D
Post Reply