本文整理汇总了C++中SetDIBitsToDevice函数的典型用法代码示例。如果您正苦于以下问题:C++ SetDIBitsToDevice函数的具体用法?C++ SetDIBitsToDevice怎么用?C++ SetDIBitsToDevice使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetDIBitsToDevice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetDIBitsToDevice
void RWindows::UpdateRect(const TRect& aRect,const TSize& aSize)
{
if (iOrientation & 1)
SetDIBitsToDevice(iHdc,aRect.iTl.iX,aRect.iTl.iY,aRect.Width(),aRect.Height(),
aRect.iTl.iX,aSize.iWidth-aRect.iBr.iY,0,aSize.iWidth,i90BitmapBits,
((LPBITMAPINFO)i90BitmapInfo),DIB_RGB_COLORS);
else
SetDIBitsToDevice(iHdc,aRect.iTl.iX,aRect.iTl.iY,aRect.Width(),aRect.Height(),
aRect.iTl.iX,aSize.iHeight-aRect.iBr.iY,0,aSize.iHeight,iBitmapBits,
((LPBITMAPINFO)iBitmapInfo),DIB_RGB_COLORS);
}
示例2: Render
VOID Render()
{
//render into buffer here
HDC winDC=GetDC(hWnd);
RECT r={0,HEIGHT,WIDTH,HEIGHT+200};
FillRect(winDC,&r,(HBRUSH)GetStockObject(BLACK_BRUSH));
SetDIBitsToDevice(
winDC,
0,0,WIDTH,HEIGHT,
0,0,0,HEIGHT,
buffer,
&bmi,
DIB_RGB_COLORS
);
ReleaseDC(hWnd,winDC);
/*frames++;
int tickdiff=GetTickCount()-ticks;
if(tickdiff>=1000)
{
static char m1[100];
float fps=(frames*1000.0)/tickdiff;
sprintf(m1,"%d frames rendered in %d ms = %1.3f fps.", frames,tickdiff,fps);
SetWindowText(hWnd,m1);
frames=0;
ticks=GetTickCount();
}*/
}
示例3: DIBPaint
//---------------------------------------------------------------------
//
// Function: DIBPaint
//
// Purpose: Painting routine for a DIB. Calls StretchDIBits() or
// SetDIBitsToDevice() to paint the DIB. The DIB is
// output to the specified DC, at the coordinates given
// in lpDCRect. The area of the DIB to be output is
// given by lpDIBRect. The specified palette is used.
//
// Parms: hDC == DC to do output to.
// lpDCRect == Rectangle on DC to do output to.
// hDIB == Handle to global memory with a DIB spec
// in it (either a BITMAPINFO or BITMAPCOREINFO
// followed by the DIB bits).
// lpDIBRect == Rect of DIB to output into lpDCRect.
// hPal == Palette to be used.
//
// History: Date Reason
// 6/01/91 Created
//
//---------------------------------------------------------------------
static void DIBPaint (HDC hDC,LPRECT lpDCRect,HANDLE hDIB)
{
LPSTR lpDIBHdr, lpDIBBits;
if (!hDIB)
return;
// Lock down the DIB, and get a pointer to the beginning of the bit
// buffer.
lpDIBHdr = GlobalLock (hDIB);
lpDIBBits = FindDIBBits (lpDIBHdr);
// Make sure to use the stretching mode best for color pictures.
SetStretchBltMode (hDC, COLORONCOLOR);
SetDIBitsToDevice (hDC, // hDC
lpDCRect->left, // DestX
lpDCRect->top, // DestY
RECTWIDTH (lpDCRect), // nDestWidth
RECTHEIGHT (lpDCRect), // nDestHeight
0, // SrcX
0,
// (int) DIBHeight (lpDIBHdr), // SrcY
0, // nStartScan
(WORD) DIBHeight (lpDIBHdr), // nNumScans
lpDIBBits, // lpBits
(LPBITMAPINFO) lpDIBHdr, // lpBitsInfo
DIB_RGB_COLORS); // wUsage
GlobalUnlock (hDIB);
}
示例4: guiOpenDebug
void guiOpenDebug() {
if (!g_hwndDebugWindow)
g_hwndDebugWindow = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_DEBUGVAL), NULL, DebugDlgProc);
#pragma vdpragma_TODO("improve this")
#ifndef _M_AMD64
else if (GetKeyState(VK_CONTROL)<0) {
char *p = new char[16384+128];
static const struct {
BITMAPINFOHEADER bih;
unsigned long p[8];
} f={
{sizeof(BITMAPINFOHEADER),128,128,1,8,BI_RGB,128*128,0,0,0,0},
{
0xffffff,
0xf1f1f1,
0xdfdfdf,
0xc9c9c9,
0xafafaf,
0x919191,
0x6d6d6d,
0x404040,
}
};
ycblit(p,0);
HDC hdc = GetDC(g_hWnd);
SetDIBitsToDevice(hdc, 0, 0, 128, 128, 0, 0, 0, 128, p, (const BITMAPINFO *)&f.bih, DIB_RGB_COLORS);
ReleaseDC(g_hWnd, hdc);
delete[] p;
}
#endif
}
示例5: sw_SwapBuffers
BOOL sw_SwapBuffers(HDC hdc, struct wgl_dc_data* dc_data)
{
struct sw_framebuffer* fb = dc_data->sw_data;
struct sw_context* sw_ctx = (struct sw_context*)IntGetCurrentDHGLRC();
/* Notify mesa */
if(sw_ctx)
_mesa_notifySwapBuffers(&sw_ctx->mesa);
if(!(fb->flags & SW_FB_DOUBLEBUFFERED))
return TRUE;
/* Upload to the display */
return (SetDIBitsToDevice(hdc,
0,
0,
fb->bmi.bmiHeader.biWidth,
fb->bmi.bmiHeader.biHeight,
0,
0,
0,
fb->bmi.bmiHeader.biHeight,
fb->backbuffer.Buffer,
&fb->bmi,
DIB_RGB_COLORS) != 0);
}
示例6: ZeroMemory
void XYDrawbox::DisplayImage(HDC& hdc)
{
BITMAPINFO bmi;
if (this->pimgdata == NULL)
{
std::cout << ":D:" << "IMGDATA==NULL" << std::endl;
return;
}
else
{
ZeroMemory(&bmi, sizeof(BITMAPINFO));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = this->lengthXScroll;
bmi.bmiHeader.biHeight = this->lengthYScroll;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
SetDIBitsToDevice(hdc,
0, 0, this->lengthXScroll, this->lengthYScroll,
this->posXScroll, 0,
this->posYScroll, this->lengthYScroll,
this->pimgdata,
&bmi,
DIB_RGB_COLORS
);
}
}
示例7: BeginPaint
void Canvas::redraw() {
PAINTSTRUCT ps;
BeginPaint(widget->window, &ps);
SetDIBitsToDevice(ps.hdc, 0, 0, canvas->width, canvas->height, 0, 0, 0, canvas->height, (void*)canvas->buffer, &canvas->bmi, DIB_RGB_COLORS);
EndPaint(widget->window, &ps);
InvalidateRect(widget->window, 0, false);
}
示例8: ZeroMemory
void window_render_gdi::render_end()
{
BITMAPINFO bmi;
ZeroMemory(&bmi,sizeof(bmi));
BITMAPINFOHEADER& h = bmi.bmiHeader;
h.biSize = sizeof(BITMAPINFOHEADER);
h.biWidth = m_image->m_width;
h.biHeight = -m_image->m_height;
h.biPlanes = 1;
h.biBitCount = 24;
h.biCompression = BI_RGB;
h.biSizeImage = m_image->m_width * m_image->m_height;
//flip();
HDC dc = GetDC((HWND)m_window->m_hWnd);
m_image->rgb2bgr();
int err = SetDIBitsToDevice(dc,0,0,m_image->m_width,m_image->m_height,
0,0,0,m_image->m_height,
m_image->get_buffer() ,
&bmi,
DIB_RGB_COLORS);
if (err <= 0)
{
//GDI_ERROR
printf("error! SetDIBitsToDevice %d %d\n",err,GetLastError());
}
ReleaseDC((HWND)m_window->m_hWnd,dc);
window_render::render_end();
}
示例9: winblit
static void winblit(RECT r)
{
int x0 = r.left;
int y0 = r.top;
int x1 = r.right;
int y1 = r.bottom;
dibinf->bmiHeader.biWidth = gli_image_w;
dibinf->bmiHeader.biHeight = -gli_image_h;
dibinf->bmiHeader.biSizeImage = gli_image_h * gli_image_s;
SetDIBitsToDevice(hdc,
x0, /* destx */
y0, /* desty */
x1 - x0, /* destw */
y1 - y0, /* desth */
x0, /* srcx */
gli_image_h - y1, /* srcy */
0, /* startscan */
gli_image_h, /* numscans */
gli_image_rgb, /* pBits */
dibinf, /* pInfo */
DIB_RGB_COLORS /* color use flag */
);
}
示例10: redraw
void redraw(HWND hwnd, HDC dc)
{
DWORD t1, t2;
char s[2000];
unsigned ASX = align(SX);
if (!image_valid) {
alloc_data();
t1 = GetTickCount ();
calculate_multi();
t2 = GetTickCount();
sprintf (s, "Mandelbrot Set %s; Image: %d x %d; (%f, %f, d=%g) time: %d ms; %d cores; %5.1f FPS%s", method_names [func_index], ASX, SY,
X0, Y0, scale,
(t2 - t1),
processor_count,
1000.0 / (t2 - t1),
full_mode ? "; ALL MODES" : "");
SetWindowText(hwnd, s);
image_valid = TRUE;
}
bi.h.biWidth = ASX;
bi.h.biHeight = -(LONG)SY;
SetDIBitsToDevice(dc, 0, 0, ASX, SY, 0, 0, 0, SY, data, (BITMAPINFO*)&bi, DIB_RGB_COLORS);
}
示例11: DrawXORMask
/****************************************************************************
*
* FUNCTION: DrawXORMask
*
* PURPOSE: Using DIB functions, draw XOR mask on hDC in Rect
*
* PARAMS: HDC hDC - The DC on which to draw
* RECT Rect - Bounding rect for drawing area
* LPICONIMAGE lpIcon - pointer to icon image data
*
* RETURNS: BOOL - TRUE for success, FALSE for failure
*
* COMMENTS: Does not use any palette information since the
* OS won't when it draws the icon anyway.
*
* History:
* July '95 - Created
*
\****************************************************************************/
BOOL DrawXORMask( HDC hDC, RECT Rect, LPICONIMAGE lpIcon )
{
int x, y;
// Sanity checks
if( lpIcon == NULL )
return FALSE;
if( lpIcon->lpBits == NULL )
return FALSE;
// Account for height*2 thing
lpIcon->lpbi->bmiHeader.biHeight /= 2;
// Locate it
x = Rect.left + ((RectWidth(Rect)-lpIcon->lpbi->bmiHeader.biWidth)/2);
y = Rect.top + ((RectHeight(Rect)-lpIcon->lpbi->bmiHeader.biHeight)/2);
// Blast it to the screen
SetDIBitsToDevice( hDC, x, y, lpIcon->lpbi->bmiHeader.biWidth, lpIcon->lpbi->bmiHeader.biHeight, 0, 0, 0, lpIcon->lpbi->bmiHeader.biHeight, lpIcon->lpXOR, lpIcon->lpbi, DIB_RGB_COLORS );
// UnAccount for height*2 thing
lpIcon->lpbi->bmiHeader.biHeight *= 2;
return TRUE;
}
示例12: SetDIBitsToDevice
void ViewPort::ImageToViewDC( void ) // copies the already rendered view to DC
{
if ( view->bmi && viewDC ) // do only if have necessary ingredients
SetDIBitsToDevice( viewDC, 0, 0, view->width, view->height,
0, 0, 0, view->height, view->bits,
view->bmi, DIB_RGB_COLORS );
}
示例13: SelectObject
void
Bitmap::copyPixelsToDevice(
HDC aTargetDc,
int aXDest, // = 0
int aYDest, // = 0
int aHeight, // = 0
int aWidth, // = 0
int aXSrc, // = 0
int aYSrc) // = 0
{
if (aHeight == 0) {
aHeight = myHeight;
}
if (aWidth == 0) {
aWidth = myWidth;
}
SelectObject(aTargetDc, myBmp); // assign the dib section to the dc
SetDIBitsToDevice( aTargetDc,
aXDest,
aYDest,
aWidth,
aHeight,
aXSrc,
aYSrc,
0,
myHeight,
&myPixels[0],
&myBitmapInfo,
DIB_RGB_COLORS);
}
示例14: BufferOneColor
void GDIRenderTarget::Flip()
{
RECT client;
HDC hDC;
Color *FrontVPData;
unsigned int *DIBData;
Color BufferOneColor(100, 149, 237,0);
Color BufferTwoColor(100, 149, 237,0);
//set up pointers to destination and source
if(m_CurrentBackBuffer == m_VPage1)
{
FrontVPData = m_VPage1; //Set m_VPage1 as frontbuffer we want to present.
m_CurrentBackBuffer = m_VPage2; //Set m_VPage2 as backbuffer.
//memset(m_VPage2,0,(sizeof(Color) * m_frameBufferLength));
SetFrameBufferColor(BufferTwoColor,2); //Set the color of m_vPage2
m_CurrentZbuffer = m_ZBuffer2;
memset(m_ZBuffer2,0,(sizeof(float) * m_frameBufferLength)); //Clean ZBuffer2
}
else
{
FrontVPData = m_VPage2; //Set m_VPage2 as frontBuffer we want to present.
m_CurrentBackBuffer = m_VPage1; //Set m_vPage2 as backbuffer
//memset(m_VPage1,0,(sizeof(Color) * m_frameBufferLength));
SetFrameBufferColor(BufferOneColor,1); //Set the color of m_vPage1
m_CurrentZbuffer = m_ZBuffer1;
memset(m_ZBuffer1,0,(sizeof(float) * m_frameBufferLength)); //Clean ZBuffer1
}
DIBData = (unsigned int*)FrontVPData;
//Get the windows device context
hDC = GetDC(*(m_hWindow));
//If it's available
if(hDC != NULL)
{
//Get the window dimensions
GetClientRect(*(m_hWindow),&client);
SetDIBitsToDevice(
hDC,
client.left,
client.top,
m_width,
m_height,
0,
0,
0,
m_height,
DIBData,
&m_bitmapInfo,
DIB_RGB_COLORS);
//release the device context.
ReleaseDC(*(m_hWindow),hDC);
}
//Reset background
}
示例15: dc
void CChildView::OnPaint()
{
CPaintDC dc(this); // device context for painting
CPen Pen;
Pen.CreatePen(PS_SOLID, 1, RGB(0,0,255));
CPen *pOldPen;
pOldPen = dc.SelectObject(&Pen);
CBrush Brush;
Brush.CreateSolidBrush(RGB(0,255,0));
CBrush *pOldBrush = dc.SelectObject(&Brush);
{
dc.MoveTo(0,0);
dc.LineTo(100,100);
dc.Rectangle(100,100,200,200);
}
dc.SelectObject(pOldPen);
dc.SelectObject(pOldBrush);
Brush.DeleteObject();
Pen.DeleteObject();
if(dibData == NULL)
return;
SetDIBitsToDevice(dc.m_hDC,
0, 0, imageWidth, imageHeight,
0, 0, 0, imageHeight,
dstData, bitmapInfo, DIB_RGB_COLORS);
}