Page 1 of 1

Importing image from Clipboard to Texture

Posted: Fri Oct 22, 2010 1:24 pm
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.

Posted: Fri Oct 22, 2010 1:38 pm
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().

Posted: Wed Oct 27, 2010 12:50 pm
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