![]() |
Changes to imagemanager, missing functionality |
Post Reply ![]() |
Author | |
Janomat ![]() Newbie ![]() ![]() Joined: 20 February 2006 Status: Offline Points: 5 |
![]() ![]() ![]() ![]() ![]() Posted: 15 February 2008 at 8:41am |
Hi there,
while appreciating the changes in the imagemanager in reducing the amount of needed handles for storing all the content iīm missing some functionality. In Toolkit 10.4 it was possible to extract the hbitmap or hicon from the imagemanager, depending on the way the image was stored in the imagemanger, with the following code. CXTPImageManagerIcon icon = XTPImageManager()->GetImage(IDC_MYICON, 16); CXTPImageManagerIconHandle xtphIcon = icon.GetIcon(); HBITMAP hBitmap = xtphIcon.GetBitmap(); HICON hIcon = xtphIcon.GetIcon(); Now it is absolutly impossible to get these informations from the imagemanager. This leads to the need of storing hbitmaps and hicons in seperate stores having the side effect of even more handle allocations. Why doesnīt the Imagemanager store appropriate functionality to create hbitmap and hicon from itīs internal store. Am i missing something? Thanks for reading so far, hoping for your answers :) Jan |
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi, Just copy it to som fre handle:
CXTPImageManagerIconHandle xtphIcon = icon.GetIcon();
CXTPImageManagerIconHandle hIconFree;
hIconFree.CopyHandle(xtphIcon);
or don't use resources feature - pImageManager->m_bUseResources = FALSE;
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Janomat ![]() Newbie ![]() ![]() Joined: 20 February 2006 Status: Offline Points: 5 |
![]() ![]() ![]() ![]() ![]() |
Hi Oleg,
i need it the other way round. I donīt want to copy a HBITMAP to the imagemanager, i need to get a HBITMAP or HICON FROM the Imagemanager. Even telling the imagemanager not to use ressources is the opposit of what i need and want. Your solution ist: // Summary: // Copies data from an HBITMAP or CXTPImageManagerIconHandle object I need functions to get the imagemanager to create a hicon or hbitmap of itīs internal image in memory and iīm wondering why the imagemanager doesnīt offer these. Best regards, Jan |
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Obviously you didn't try my solutions...
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Janomat ![]() Newbie ![]() ![]() Joined: 20 February 2006 Status: Offline Points: 5 |
![]() ![]() ![]() ![]() ![]() |
Sorry. Got it. Sample for others following this thread...
CXTPImageManagerIcon* pXTPIcon = XTPImageManager()->GetImage(MYICONID, 16); CXTPImageManagerIconHandle cXTPIconHandle = pXTPIcon->GetIcon(xtpImageNormal); CXTPImageManagerIconHandle cXTPnewIconHandle; cXTPnewIconHandle.CopyHandle(cXTPIconHandle); HBITMAP hBitmap = cXTPnewIconHandle.GetBitmap(); hBitmap can be used for creating an hIcon if needed using this code: HICON Helper::CreateAlphaIcon(HBITMAP hBitmap, const CSize& size) { HICON hIcon = NULL; CBitmap bmpResample; CImageList list; if (XTPImageManager()->IsAlphaIconsImageListSupported()) { list.Create(size.cx, size.cy, ILC_COLOR32, 0, 1); bmpResample.Attach(hBitmap); list.Add(&bmpResample, (CBitmap*)NULL); } else { list.Create(size.cx, size.cy, ILC_MASK | ILC_COLOR24, 0, 1); bmpResample.Attach(CXTPImageManager::ResampleAlphaLayer(hBitmap, RGB(255,255,255))); list.Add(&bmpResample, RGB(255,255,255)); } hIcon = list.ExtractIcon(0); bmpResample.Detach(); return hIcon; } Thanks oleg :) Jan |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |