Click here to Skip to main content
15,911,891 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Creating an iso Image Pin
gabbana21-Jul-08 3:40
gabbana21-Jul-08 3:40 
GeneralRe: Creating an iso Image Pin
gabbana21-Jul-08 14:57
gabbana21-Jul-08 14:57 
QuestionCacls(Access Control List ) Pin
Michael Adel20-Jul-08 14:28
Michael Adel20-Jul-08 14:28 
QuestionRe: Cacls(Access Control List ) Pin
David Crow21-Jul-08 3:15
David Crow21-Jul-08 3:15 
Questionproblem in CListCtrl Pin
sarat12in20-Jul-08 10:21
sarat12in20-Jul-08 10:21 
AnswerRe: problem in CListCtrl Pin
Nelek20-Jul-08 21:36
protectorNelek20-Jul-08 21:36 
QuestionWindows Anti-Virus Detection Pin
Jorge Jones20-Jul-08 8:44
Jorge Jones20-Jul-08 8:44 
Questionload image and resize image with windows method StretchBlt Pin
cmos20-Jul-08 3:48
cmos20-Jul-08 3:48 
Hello,
i want to resize a loaded bitmap and i thought about to use
the windows method StretchBlt.

I can create a Bitmap out of a ByteArray and I can stretch it
according to the size of the window where it will be displayed


That's my way how i create a bitmap out of a bytearray.
you can see that i use StretchBlt.
CClientDC dc(pWnd);
CDC cdc;
CBitmap* pBitmap    = NULL;
CBitmap* pOldBitmap = NULL;

cdc.CreateCompatibleDC(&dc);
dc.SetStretchBltMode(COLORONCOLOR);

::SetDIBits(NULL,hBitmap,0,dwHeight,pData,&Bitmapinfo,DIB_RGB_COLORS);
pBitmap = CBitmap::FromHandle(m_HBitmap);
pOldBitmap = cdc.SelectObject(pBitmap);

if(bStretchMode)
{
    dc.StretchBlt(rect.TopLeft().x,rect.TopLeft().y,rect.Width(),rect.Height(),&cdc,0,0,m_iSrcWidth,m_iSrcHeight,SRCCOPY);
}
else
{
    dc.BitBlt(rect.TopLeft().x,rect.TopLeft().y,rect.Width(),rect.Height(),&cdc,0,0,SRCCOPY);
}

cdc.SelectObject(pOldBitmap);
ReleaseDC(&cdc);
cdc.DeleteDC();


Now what I want is to load a bitmap from file, resize it and get a pointer
to the bytes of this resized bitmap. i dont need ti display the loaded
bitmap. the loaded bitmap is a binary bitmap,just black and white.

I load the image with this code
HBITMAP hBmp = (HBITMAP) ::LoadImage(NULL,                                  
										filename.GetBuffer(),              //filename
										IMAGE_BITMAP,					   //format hint
										0, 0,                             //whole bitmap
										LR_LOADFROMFILE |                 //load format
										LR_CREATEDIBSECTION);             // 


	BITMAP BM;                          // Get bitmap info.	
    GetObject (hBmp,sizeof (BM),&BM); //

	CBitmap* pBmp = CBitmap::FromHandle(hBmp);


So, any suggestions ?

greetings,
cmos
AnswerRe: load image and resize image with windows method StretchBlt Pin
Mark Salsbery20-Jul-08 8:36
Mark Salsbery20-Jul-08 8:36 
QuestionFile Parsing Pin
Preethi_12320-Jul-08 1:47
Preethi_12320-Jul-08 1:47 
Answer[OT] Re: File Parsing Pin
David Crow20-Jul-08 9:36
David Crow20-Jul-08 9:36 
AnswerRe: File Parsing Pin
Bram van Kampen20-Jul-08 14:43
Bram van Kampen20-Jul-08 14:43 
QuestionUnit testing in C++ Pin
eli1502197920-Jul-08 0:48
eli1502197920-Jul-08 0:48 
AnswerRe: Unit testing in C++ Pin
Ștefan-Mihai MOGA20-Jul-08 2:20
professionalȘtefan-Mihai MOGA20-Jul-08 2:20 
AnswerRe: Unit testing in C++ Pin
Stephen Hewitt20-Jul-08 18:49
Stephen Hewitt20-Jul-08 18:49 
QuestionUNICODE to MBCS problem Pin
followait20-Jul-08 0:32
followait20-Jul-08 0:32 
QuestionRe: UNICODE to MBCS problem Pin
CPallini20-Jul-08 3:11
mveCPallini20-Jul-08 3:11 
AnswerRe: UNICODE to MBCS problem Pin
followait20-Jul-08 7:52
followait20-Jul-08 7:52 
GeneralRe: UNICODE to MBCS problem Pin
CPallini20-Jul-08 7:56
mveCPallini20-Jul-08 7:56 
GeneralOT + THHB Attempt 1 Pin
Rajesh R Subramanian21-Jul-08 1:09
professionalRajesh R Subramanian21-Jul-08 1:09 
GeneralRe: OT + THHB Attempt 1 Pin
CPallini21-Jul-08 1:48
mveCPallini21-Jul-08 1:48 
GeneralRe: OT + THHB Attempt 1 Pin
Rajkumar R21-Jul-08 2:08
Rajkumar R21-Jul-08 2:08 
GeneralRe: OT + THHB Attempt 1 Pin
CPallini21-Jul-08 2:14
mveCPallini21-Jul-08 2:14 
GeneralRe: OT + THHB Attempt 1 Pin
Rajkumar R21-Jul-08 2:20
Rajkumar R21-Jul-08 2:20 
GeneralRe: OT + THHB Attempt 1 Pin
CPallini21-Jul-08 2:23
mveCPallini21-Jul-08 2:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.