StretchBlt macht Zicken
-
Hallo!
Wieso gibt mir dieser COde kein Bild aus? wenn ich bei Render dc angebe kriege ich ein Bild ://IPicture *m_bild; OleLoadPicturePath(m_logopath.AllocSysString(), 0, 0, 0, IID_IPicture,(void **)&m_bild); HDC newDC; newDC = CreateCompatibleDC(dc); CRect rc; GetClientRect(&rc); OLE_XSIZE_HIMETRIC width; OLE_YSIZE_HIMETRIC height; m_bild->get_Width(&width); m_bild->get_Height(&height); if(width > 300 || height > 400) { StretchBlt(newDC, 10,10,300,400,dc,10,10,width,height,SRCCOPY); } //m_bild->Render(dc, 100, 100, 50*96/2540, 50*96/2540, 0, 50, 50, -50, &rc); m_bild->Render(newDC, 25, 154, 300*96/2540, 400*96/2540, 0, 400, 300, -400, &rc);Danke
Kevin
-
Die Parameter bei stretchBlt sind erstens föllig falsch.
Gruß Crabbe
-
völlig mit v
2. kannst du mir sagen wieso?
-
Vielleicht hilft das weiter:
CDC::StretchBlt
Copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap if necessary to fit the dimensions of the destination rectangle.
BOOL StretchBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop );Parameters
x
Specifies the x-coordinate (in logical units) of the upper-left corner of the destination rectangle.y
Specifies the y-coordinate (in logical units) of the upper-left corner of the destination rectangle.nWidth
Specifies the width (in logical units) of the destination rectangle.nHeight
Specifies the height (in logical units) of the destination rectangle.pSrcDC
Specifies the source device context.xSrc
Specifies the x-coordinate (in logical units) of the upper-left corner of the source rectangle.ySrc
Specifies the x-coordinate (in logical units) of the upper-left corner of the source rectangle.nSrcWidth
Specifies the width (in logical units) of the source rectangle.nSrcHeight
Specifies the height (in logical units) of the source rectangle.dwRop
Specifies the raster operation to be performed. Raster operation codes define how GDI combines colors in output operations that involve a current brush, a possible source bitmap, and a destination bitmap. This parameter may be one of the following values:
BLACKNESS Turns all output black.
DSTINVERT Inverts the destination bitmap.
MERGECOPY Combines the pattern and the source bitmap using the Boolean AND operator.
MERGEPAINT Combines the inverted source bitmap with the destination bitmap using the Boolean OR operator.
NOTSRCCOPY Copies the inverted source bitmap to the destination.
NOTSRCERASE Inverts the result of combining the destination and source bitmaps using the Boolean OR operator.
PATCOPY Copies the pattern to the destination bitmap.
PATINVERT Combines the destination bitmap with the pattern using the Boolean XOR operator.
PATPAINT Combines the inverted source bitmap with the pattern using the Boolean OR operator. Combines the result of this operation with the destination bitmap using the Boolean OR operator.
SRCAND Combines pixels of the destination and source bitmaps using the Boolean AND operator.
SRCCOPY Copies the source bitmap to the destination bitmap.
SRCERASE Inverts the destination bitmap and combines the result with the source bitmap using the Boolean AND operator.
SRCINVERT Combines pixels of the destination and source bitmaps using the Boolean XOR operator.
SRCPAINT Combines pixels of the destination and source bitmaps using the Boolean OR operator.
WHITENESS Turns all output white.Return Value
Nonzero if the bitmap is drawn; otherwise 0.
-
Ey das kann net sein, jetzt hab ichs mal mit BitBlt probiert, aber das Bitmap wird nichtmal angezeigt!! Wenn ich bei Render dc angebe, wird es angezeigt aber wenn ich es kopieren will nicht! Wieso!?
IPicture *m_bild; OleLoadPicturePath(m_logopath.AllocSysString(), 0, 0, 0, IID_IPicture,(void **)&m_bild); HDC newDC; newDC = CreateCompatibleDC(dc); CRect rc; GetClientRect(&rc); OLE_XSIZE_HIMETRIC width; OLE_YSIZE_HIMETRIC height; m_bild->get_Width(&width); m_bild->get_Height(&height); m_bild->Render(newDC, 0, 0, width*96/2540, height*96/2540, 0, height, width, -height, &rc); BitBlt(newDC, 0, 0, 454, 341, dc, 0, 0, SRCCOPY);Kevin
-
Wohin soll StretchBlt denn was kopieren?
hdc ist doch nur ein Device Handle. Koordinaten sind nett, aber
nicht ausreichend.HDC hdcMem; hdcMem= CreateCompatibleDC(hdc); SelectObject(hdcMem,hBitmap); StretchBlt(hdc,x,y,cx,cy,hdcMem,0,0,BitmapSize.cx,BitmapSize.cy,SRCCOPY); DeleteDC(hdcMem);
-
Ja StretchBlt kopiert von einem HDC in den anderen!! Und das tue ich doch...
-
hmm StretchBlt mag wohl nur Bitmaps..ich will aber einen HDC stretchen...wie mach ich das? wie krieg ich aus nem HDC ein BitmaP?
-
Einen HDC stretchen??
Wie soll denn das aussehen?
Wo für brauch man das denn?Wenn ein DC angelegt wird, besteht er aus einem monochromen Pixel.