Old 10th May 2014, 21:21   #1
thinktink
Forum King
 
thinktink's Avatar
 
Join Date: May 2009
Location: On the streets of Kings County, CA.
Posts: 2,948
Send a message via Skype™ to thinktink
ARGB32 and Windows API.

I'm trying to work with the ARGB32 values returned from ::GetAlbumArt and I'm having some difficulties. Using a seemingly simple algorithm to re-create ARGB32 image to a new HBITMAP is taking WAY too long to do. I've scoured the SDK for an API or a set of API's that will allow me to either reference or load the ARGB32 values reasonably fast but all that I get are handles to HBITMAPS that I can't seem to select into any hDC.

How is it normally done in Winamp?
thinktink is offline   Reply With Quote
Old 10th May 2014, 22:09   #2
thinktink
Forum King
 
thinktink's Avatar
 
Join Date: May 2009
Location: On the streets of Kings County, CA.
Posts: 2,948
Send a message via Skype™ to thinktink
I am thick. Thickety thick. Thick in the head. Thickety thickety thick thick thick.

Please delete this thread, chuck it in the recycle bin, or any other cruel, mean, evil, or wicked thing you wish to do to this thread.

Thanks anyways.





thinktink is offline   Reply With Quote
Old 11th May 2014, 20:33   #3
DrO
 
Join Date: Sep 2003
Posts: 27,873
Quote:
// cur_image is the ARGB32* value from the artwork api
// cur_w and cur_h are the width and height of the image from the artwork api
HDC srcDC = CreateCompatibleDC(dc);
BITMAPINFO bmi = {0};
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = cur_w;
bmi.bmiHeader.biHeight = -cur_h;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
void *bits = 0;
HBITMAP srcBMP = CreateDIBSection(srcDC, &bmi, DIB_RGB_COLORS, &bits, NULL, 0);
memcpy(bits, cur_image, cur_w*cur_h*4);
DeleteDC(srcDC);
i'll still answer the post for others benefits as it's pretty simple to create a HBITMAP from the ARGB32* provided from the artwork api (i.e. it's the raw bits that make up the image).
DrO is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump