 |
|
 |
Hi
How to create Multi page tiff images ??
thanks
|
|
|
|
 |
|
|
 |
|
 |
I haven't looked at this site in ages, but if you will notice, I never claimed it was my code.
If you notice where I say this the function i came up with with help from sites like this.
Obviously, if I had been searching so long, no one had an article explaining it.
Looking back I suppose, I could have credited MarcoFlip, but does it really matter?
LB
|
|
|
|
 |
|
 |
GetImageInfo() fails if the imagelist was created with the ILC_COLOR8 (or above) flag.
Anyone have an idea ?
|
|
|
|
 |
|
 |
void CMyWindowClass::GetImageFromList(CImageList *pImages, int nImageIdx, Gdiplus::Bitmap** ppDestBitmap) { if (pImages && ppDestBitmap) { HICON hIcon = pImages->ExtractIcon(nImageIdx); if (hIcon) { *ppDestBitmap = Gdiplus::Bitmap::FromHICON(hIcon); } } }
|
|
|
|
 |
|
 |
Ok good function, but the problem with your fucntion is that whenever i call this function it increases the Memory Usage of my program, i tried to free up the vairbles and other at end of the funtion but it doesnot work , this is serious problem cuz wheneva i chnage the skin of program is increases the mem usage soo u have to solve this
|
|
|
|
 |
|
 |
A Critial problem . do not use GetWindowDc()!!!
if you use it ,you should call Release();
thanks god ,this is a very very good fun!
|
|
|
|
 |
|
 |
Hii.. i realyy wnt this u made.. but i have a problemm reall problem.. plzz help me.
I tried ur Code but its jst Load Bitmap List from the Resourse but i want to load Bitmap list from outside from my Disk Drive:
/////////////////////////////////////
CImageList m_img;
m_img.Create("D:\\testBmp.bmp" ,64 , 32 , RGB(255,255,255));
CBitmap mBmp;
GetImageFromList(&m_img , 1 , &mBmp);
and then i try :
CImageList m_img;
m_img.Create("D:\\testBmp.bmp" , 64 , 32 , RGB(255,255,255));
CBitmap *mBmp = new CBitmap;
GetImageFromList(&m_img , 1 , &mBmp);
it compiles succesfully..but when i run its crash! please help me in this
thnk u
|
|
|
|
 |
|
 |
Manni Singh wrote: m_img.Create("D:\\testBmp.bmp" ,64 , 32 , RGB(255,255,255));
The first argument to Create() is supposed to be a string containing the resource IDs of the images, not a bitmap file.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
 |
|
 |
Thanks for sharing your function
Have nice Day
juergen
|
|
|
|
 |
|
 |
How do I create a CImageList object from a given set of CBitmap objects?
|
|
|
|
 |
|
 |
Of course, the member function Add does just that. A quick reply to my own question!
|
|
|
|
 |
|
 |
This function is what I searched the web for all the time. Thanks a lot. 5 of 5.
|
|
|
|
 |
|
 |
MSDN:
The CopyImage function creates a new image (icon, cursor, or bitmap) and copies the attributes of the specified image to the new one. If necessary, the function stretches the bits to fit the desired size of the new image.
Syntax
HANDLE CopyImage( HANDLE hImage,
UINT uType,
int cxDesired,
int cyDesired,
UINT fuFlags
);
|
|
|
|
 |
|
 |
Because it's not clear how to convert that HANDLE into a CBitmap.
Can you (or someone) help us out a bit?
|
|
|
|
 |
|
 |
I think you can try this ways:
1.
Using the 'CBitmap::FormHandle' member function to get a temp bitmap and put it in a mem DC, for example:
p_old_bmp= memDC.SelectObject( CBitmap::FromHandle(hbmp) );
// To put the bitmap in memDC. p_old_bmp is a pointer to a CBitmap object
2.
Using the base class 'CGdiObject::Attach' member function to get a CBitmap object
bmp.Attach(hbmp); // bmp is a CBitmap object
Is it ok for you?
|
|
|
|
 |
|
 |
As we know, CImageList has a member func. GetImageInfo().
we can use it to retrieve a IMAGEINFO. This struc has a member "hbmImage" which is the "Handle to the bitmap that contains the images"(from MSDN).
My question is what is the use of hbmImage. Can we get a bitmap from it? if we can,then HOW? If can't, WHY??
To be or not to be!
|
|
|
|
 |
|
 |
[quote]
//Then swap the requested image to the first spot in the list
tmpList.Copy( 0, nImage, ILCF_SWAP );
[/quote]
Why swap it to the 1st place? Is it necessary???
To be or not to be!
|
|
|
|
 |
|
 |
It is not necessary. You could remove that line, and change the second argument in the DrawIndirect() call from '0' to 'nImage'.
|
|
|
|
 |
 | Speed  |  | Francois Bedard | 10:59 8 Sep '03 |
|
 |
I had some speed issues with your code so I modified it a little and obtained this. I only erase the part where you made a copy of the CImageList.
IMAGEINFO lastImage;
lstImages->GetImageInfo(nImage,&lastImage);
CDC dcMem; dcMem.CreateCompatibleDC (&p_CDC);
CRect rect (lastImage.rcImage);
destBitmap->CreateCompatibleBitmap (&p_CDC,
rect.Width (), rect.Height ());
CBitmap* pBmpOld = dcMem.SelectObject (destBitmap);
lstImages->DrawIndirect (&dcMem, nImage, CPoint (0, 0),
CSize (rect.Width (), rect.Height ()), CPoint (0, 0));
dcMem.SelectObject (pBmpOld);
Francois Bedard
|
|
|
|
 |
|
 |
yes!!
u are right!!
To be or not to be!
|
|
|
|
 |
|
 |
I create my ImageList and add Bitmaps like this:
m_NewPageBMPList.Create(IDB_PAGE_,27,1,RGB(255,0,255));
bitmap.LoadBitmap(IDB_PAGE);
m_NewPageBMPList.Add(&bitmap, RGB(255,0,255));
bitmap.Detach();
and then somewhere later in my prog i try to change a BMP of my Toolbar like this:
CBitmap bitmap;
TBBUTTONINFO tbbi;
memset(&tbbi,0,sizeof(TBBUTTONINFO));
GetImageFromList(&m_NewPageBMPList,1,&bitmap);
int iPic = m_wndToolBar.GetToolBarCtrl().AddBitmap(1,&bitmap);
tbbi.cbSize = sizeof(TBBUTTONINFO);
tbbi.dwMask = TBIF_IMAGE;
tbbi.iImage = iPic;
m_wndToolBar.GetToolBarCtrl().SetButtonInfo(ID_NEW_PAGE,&tbbi);
and now the problem: instead is see a bitmap with transparent background i see an bitmap with black background. can U tell me what is wrong
Howard
|
|
|
|
 |
|
 |
When you create your imagelist, the COLORREF rgb(255,0,255) represents magenta (which im sure you know, and is the color you want to be transparent)
however, CImageList takes that colorref you pass it and convertas all pixels of that color to black.
Try using the opposite color to the magenta RGB(0,255,0) as the colorref instead, and this should work but don't ask me why..This is just what I do.
Good Luck!!
|
|
|
|
 |
|
 |
do u mean
m_NewPageBMPList.Add(&bitmap, RGB(0,255,0));
instead
m_NewPageBMPList.Add(&bitmap, RGB(255,0,255));
or what???
|
|
|
|
 |
|
 |
Yes, and you may need it in your m_NewPageBMPList.Create call as well
|
|
|
|
 |