Originally posted by: liping
void CMyView::DrawBitmap( CDC *pDC )
unsigned char * pData = new unsigned char [bm.bmHeight*bm.bmWidthBytes];
CDC MemDC;
CBitmap *pOldBitmap = (CBitmap *)MemDC.SelectObject( &bmp );
This is a piece of code copied directly from the book. But it display nothing when implemented in my machine. Any one can help me? thank you very much!
{
CBitmap bmp;
bmp.CreateBitmap( 50, 50, 1, 24, NULL );
BITMAP bm;
bmp.GetObject( sizeof(BITMAP), &bm );
for( int y = 0; y < bm.bmHeight; y ++ )
{
for( int x = 0; x < bm.bmWidth; x ++ )
{
pData[y*bm.bmWidthBytes+3*x] = 0;
pData[y*bm.bmWidthBytes+3*x+1] = 0;
pData[y*bm.bmWidthBytes+3*x+2] = 255;
}
}
bmp.SetBitmapBits( bm.bmHeight*bm.bmWidthBytes, pData );
delete [] pData;
MemDC.CreateCompatibleDC( pDC );
MemDC.SetMapMode( pDC->GetMapMode() );
pDC->BitBlt( 0,0,bm.bmWidth,bm.bmHeight,&MemDC,0,0,SRCCOPY);
MemDC.SelectObject( pOldBitmap );
}
Originally posted by: Ravi
How can I draw lines and shapes on a dialog. What I need is a picture on my dialog such that I can placed a static text label on the picture. If anyone can help please let me know
ReplyOriginally posted by: Pascal
int LargFen,HautFen;
if (pBitmapOld == NULL) return;
pxDes=m_rect.left;
pDC->StretchBlt(pxDes,pyDes-(LargFen-HautFen)/2,LargFen,LargFen/*HautFen*/,&dcMem,0,0,m_sizeBitmap.cx, m_sizeBitmap.cy,SRCCOPY);
Sorry for my terrible english and for this question probably easy for most of programmers.
My bitmap is correctly displayed on the screen or on previewPrint but doesn't appear on the printer. could you give me a easier way to do this.
Thanks for helping
My code is the next one.
void CRubbishObj::Draw(CDC *pDC)
{
CSize m_sizeBitmap=GetBitmapSize();
BITMAP bm;
CRect rcDest;
CDC dcMem;
if (!dcMem.CreateCompatibleDC(pDC)) return;
CBitmap* pBitmapOld = dcMem.SelectObject(&m_bitmap);
LargFen=m_rect.right-m_rect.left;
HautFen=m_rect.top-m_rect.bottom;
int pxDes,pyDes,pxSour,pySour;
pyDes=m_rect.bottom;
dcMem.SelectObject(pBitmapOld);
}
Originally posted by: balakrishnan
hello sir,
I am Balakrishnan,pursuing M.E.mechatronics at anna university ,chennai,India,
for my project work related to image processing,reading of pixel intensity values
using C or C++ source code.Please ,give some idea about how to read that pixel
intensity value.
bmp &tiff file formats using C source code
expecting your valuable ideas and guidence ,which will very much useful for me
thanking you sir
Balakrishnan.M
Originally posted by: Bourdaud'hui
but, when I want to print, the bitmap is black, not in printpreview? How can I do with that ?
Pascal
Good stuff,
Originally posted by: John
I need to draw a bitmap in a window. Is it somebody who can help me? It's my first step in c++ with visual c++ and I don't know how to begin.
It will be great to manage to read this bmp file in a first time....
Thanks for your help!
John
Originally posted by: Nitin
In many applications I have seen a full screen display, in which bitmap is drawn over a black background, that covers the whole screen, without any title bar or border. Can anyone show me how to do that. Preferably without using MFC.
Please reply to my e-mail address nitin_kg@yahoo.com.
Originally posted by: Nehal ahmed khan
Hi Zafir..
1) i need your help ..Actuelly i have a problem to findout Color value of Bitmap pixel....
the problem is following...i read a bitmapfile ..then
make a two dimension matrix of the picture...which represent the every pixel of picture. now how could i find out the RGB value of every pixel in the matrix???????
2)
After that i have to use the value to find out "X" and "Y"
and try to draw a Diagramm with "X" and "y" value ...Now the problem is how i could draw a Diagramm in Mfc ...without using COM or OLE ....
please help me urgently.....I have only 3 Days to solve my problem....please...
i repeate my question agaim
1) How to read rgb value of pixels
2) How to make Diagram in MFC without OLE or COM
nehal ahmed khan
ReplyOriginally posted by: NGUYEN NGOC ANH
please tell me how to display a bitmap picture by press add bitmap button, and make a token bus connect with pc bitmap picture
Originally posted by: Abdulrahim Benkasmi
if( bmInfo.bmiHeader.biBitCount > 8 )
Hi Zafir,
I would like to thank you for the help with this piece of code, I had
a problem when I try to "SetDibitsToDevice" a monochrome bitmap
the bitmap rendring start from a certain position, it's fixed after checking
the bitCounts:
lpDIBBits = (LPVOID)((LPDWORD)(bmInfo.bmiColors +
bmInfo.bmiHeader.biClrUsed) +
((bmInfo.bmiHeader.biCompression == BI_BITFIELDS) ? 3 : 0));
else
lpDIBBits = (LPVOID)(bmInfo.bmiColors + nColors);
Thank you again
Abdulrahim