本文整理匯總了C++中GdiFlush函數的典型用法代碼示例。如果您正苦於以下問題:C++ GdiFlush函數的具體用法?C++ GdiFlush怎麽用?C++ GdiFlush使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GdiFlush函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: PaintWindowThread
static void PaintWindowThread(void *)
{
/* First tell the main thread we're started */
_draw_mutex->BeginCritical();
SetEvent(_draw_thread_initialized);
/* Now wait for the first thing to draw! */
_draw_mutex->WaitForSignal();
while (_draw_continue) {
/* Convert update region from logical to device coordinates. */
POINT pt = {0, 0};
ClientToScreen(_wnd.main_wnd, &pt);
OffsetRect(&_wnd.update_rect, pt.x, pt.y);
/* Create a device context that is clipped to the region we need to draw.
* GetDCEx 'consumes' the update region, so we may not destroy it ourself. */
HRGN rgn = CreateRectRgnIndirect(&_wnd.update_rect);
HDC dc = GetDCEx(_wnd.main_wnd, rgn, DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | DCX_INTERSECTRGN);
PaintWindow(dc);
/* Clear update rect. */
SetRectEmpty(&_wnd.update_rect);
ReleaseDC(_wnd.main_wnd, dc);
/* Flush GDI buffer to ensure drawing here doesn't conflict with any GDI usage in the main WndProc. */
GdiFlush();
_draw_mutex->WaitForSignal();
}
_draw_mutex->EndCritical();
_draw_thread->Exit();
}
示例2: InterfaceDrawElements
/*
* InterfaceDrawElements: Draw spiffy interface elements.
*/
void InterfaceDrawElements(HDC hdc)
{
int i, x, y;
InterfaceElement *e;
Bool vertical;
for (i=0; i < NUM_AUTO_ELEMENTS; i++)
{
// Temp. disable xxx
/* if( i >= ELEMENT_ULTOP && i <= ELEMENT_LRRIGHT )
continue;
if( i >= ELEMENT_IULTOP && i <= ELEMENT_ILRRIGHT )
continue;
if( i == ELEMENT_BLLBOTTOM || i == ELEMENT_BLRBOTTOM )
continue;*/
OffscreenWindowBackground(NULL, elements[i].x, elements[i].y, elements[i].width, elements[i].height);
OffscreenBitBlt(hdc, elements[i].x, elements[i].y, elements[i].width, elements[i].height,
elements[i].bits, 0, 0, DIBWIDTH(elements[i].width),
OBB_COPY | OBB_FLIP | OBB_TRANSPARENT);
GdiFlush();
}
for (i=0; i < NUM_AUTO_REPEATERS; i++)
{
// Temp. disable xxx
if( i >= ELEMENT_ITOP && i <= ELEMENT_IRIGHT )
continue;
// disable xxx
if( i >= ELEMENT_TOP && i <= ELEMENT_RIGHT )
continue;
if( i == ELEMENT_BBOTTOM )
continue;
e = &repeaters[i].element;
x = e->x;
y = e->y;
vertical = repeaters[i].vertical;
while (1)
{
if ((vertical && y > repeaters[i].end) || (!vertical && x > repeaters[i].end))
break;
OffscreenWindowBackground(NULL, x, y, e->width, e->height);
OffscreenBitBlt(hdc, x, y, e->width, e->height, e->bits, 0, 0, DIBWIDTH(e->width),
OBB_COPY | OBB_FLIP | OBB_TRANSPARENT);
if (vertical)
y += e->height;
else x += e->width;
GdiFlush();
}
}
}
示例3: AmbireCaptureCapture
FREObject __cdecl AmbireCaptureCapture(FREContext ctx, void * functionData, uint32_t argc, FREObject argv[]) {
bool success = false;
POINT pt = { 0 };
FREBitmapData bd = { 0 };
FREResult result = FREAcquireBitmapData(argv[0], &bd);
if(result == FRE_OK) {
int width = bd.width;
int height = bd.height;
BITMAPINFOHEADER bmi = { 0 };
bmi.biSize = sizeof(bmi);
bmi.biWidth = width;
bmi.biHeight = height;
bmi.biPlanes = 1;
bmi.biBitCount = 24;
int stride = ((width * 3 + 3) / 4) * 4;
bmi.biSizeImage = stride * height;
void * ppvBits = 0;
HDC hdcDesktop = GetDC(0);
if(hdcDesktop) {
HDC hdcMem = CreateCompatibleDC(hdcDesktop);
if(hdcMem) {
HBITMAP hbm = CreateDIBSection(hdcMem, (const BITMAPINFO *)&bmi, 0, &ppvBits, 0, 0);
if(hbm) {
SelectObject(hdcMem, hbm);
BitBlt(hdcMem, 0, 0, width, height, hdcDesktop, 0, 0, SRCCOPY);
GdiFlush();
ReleaseDC(0, hdcDesktop);
DeleteDC(hdcMem);
GdiFlush();
for(int y = 0; y < height; ++y) {
const unsigned char * p = reinterpret_cast<unsigned char *>(ppvBits) + y * stride;
uint32_t * q = reinterpret_cast<uint32_t *>(bd.bits32) + y * bd.lineStride32;
for(int x = 0; x < width; ++x, p += 3, ++q) {
*q = 0xFF000000 | (p[2] << 16) | (p[1] << 8) | p[0];
}
}
success = true;
DeleteObject(hbm);
} else {
DeleteDC(hdcMem);
}
} else {
ReleaseDC(0, hdcDesktop);
}
}
FREReleaseBitmapData(argv[0]);
}
FREObject rv = 0;
FRENewObjectFromBool(success ? 1 : 0, &rv);
return rv;
}
示例4: text_bitmap
// Draw text to full-screen sized bitmap, cleared to <bgcolor>
// Draw boxes for each word on EyeLink tracker display if <dotrack> set
// Use font selected with get_new_font(), and draws it in <fgcolor>
// RECT <margins> sets margins, and <lspace> sets pixels between lines
HBITMAP text_bitmap(char *txt, COLORREF fgcolor, COLORREF bgcolor,
RECT margins, int lspace, int dotrack)
{
HDC hdc;
HBITMAP hbm;
HDC mdc;
HBRUSH oBrush;
HBITMAP obm;
hdc = GetDC(NULL);
mdc = CreateCompatibleDC(hdc); // create display-compatible memory context
hbm = CreateCompatibleBitmap(hdc, SCRWIDTH, SCRHEIGHT);
obm = SelectObject(mdc, hbm); // create DDB bitmap, select into context
oBrush = SelectObject(mdc, CreateSolidBrush(bgcolor | 0x02000000L)); // brush to fill with
PatBlt(mdc, 0, 0, SCRWIDTH, SCRHEIGHT, PATCOPY); // CLEAR BITMAP
DeleteObject(SelectObject(mdc, oBrush));
draw_text_box(mdc, txt, fgcolor, margins, lspace, dotrack); // DRAW THE TEXT
GdiFlush(); // ADDED for Wimdows 2000/XP: Forces drawing to be immediate
SelectBitmap(mdc, obm); // Release the GDI resources
DeleteDC(mdc);
ReleaseDC(NULL, hdc);
return hbm; // Return the new bitmap
}
示例5: destroy
bool Bitmap::create(int widthPixels, int heightPixels)
{
destroy();
width = widthPixels;
height = heightPixels;
pitch = ((width * 32 + 31) & ~31) >> 3;
dc = CreateCompatibleDC(0);
if (!dc)
return false;
memset(&info, 0, sizeof(info));
info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
info.bmiHeader.biBitCount = 32;
info.bmiHeader.biWidth = width;
info.bmiHeader.biHeight = -height;
info.bmiHeader.biCompression = BI_RGB;
info.bmiHeader.biPlanes = 1;
hBitmap = CreateDIBSection(dc, &info, DIB_RGB_COLORS,
reinterpret_cast<void**>(&m_pBits), 0, 0);
if (!hBitmap)
{
destroy();
return false;
}
GdiFlush();
return true;
}
示例6: wf_create_dib
HBITMAP wf_create_dib(wfInfo* wfi, int width, int height, int bpp, uint8* data)
{
HDC hdc;
int negHeight;
HBITMAP bitmap;
BITMAPINFO bmi;
uint8* cdata = NULL;
/**
* See: http://msdn.microsoft.com/en-us/library/dd183376
* if biHeight is positive, the bitmap is bottom-up
* if biHeight is negative, the bitmap is top-down
* Since we get top-down bitmaps, let's keep it that way
*/
negHeight = (height < 0) ? height : height * (-1);
hdc = GetDC(NULL);
bmi.bmiHeader.biSize = sizeof(BITMAPINFO);
bmi.bmiHeader.biWidth = width;
bmi.bmiHeader.biHeight = negHeight;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 24;
bmi.bmiHeader.biCompression = BI_RGB;
bitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**) &cdata, NULL, 0);
if (data != NULL)
freerdp_image_convert(data, cdata, width, height, bpp, 24, wfi->clrconv);
ReleaseDC(NULL, hdc);
GdiFlush();
return bitmap;
}
示例7: GdiFlush
void plTextGenerator::FlushToHost( void )
{
#if HS_BUILD_FOR_WIN32
// Flush the GDI first, to make sure it's done
GdiFlush();
// Now copy our alpha channel over. I hate the GDI
uint32_t i = fHost->fWidth * fHost->fHeight;
uint32_t *dest = fWinRGBBits;
uint8_t *src = fWinAlphaBits;
/* while( i-- )
{
*dest &= 0x00ffffff;
*dest |= ( *src ) << 24;
// *dest |= ( *dest << 16 ) & 0xff000000;
dest++;
src++;
}
*/
do
{
i--;
dest[ i ] &= 0x00ffffff;
dest[ i ] |= src[ i ] << 24;
} while( i );
#endif
// Dirty the mipmap's deviceRef, if there is one
if( fHost->GetDeviceRef() != nil )
fHost->GetDeviceRef()->SetDirty( true );
}
示例8: AeroPaintControl
static void AeroPaintControl(HWND hwnd, HDC hdc, WNDPROC OldWndProc, UINT msg = WM_PRINT, LPARAM lpFlags = PRF_CLIENT | PRF_NONCLIENT)
{
HBITMAP hBmp, hOldBmp;
RECT rc; GetClientRect(hwnd, &rc);
BYTE *pBits;
HDC tempDC = CreateCompatibleDC(hdc);
BITMAPINFO bmi;
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = rc.right;
bmi.bmiHeader.biHeight = -rc.bottom;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, (void **)&pBits, NULL, 0);
hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp);
//paint
SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)TRUE);
mir_callNextSubclass(hwnd, OldWndProc, msg, (WPARAM)tempDC, lpFlags);
SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)FALSE);
// Fix alpha channel
GdiFlush();
for (int i = 0; i < rc.right*rc.bottom; i++, pBits += 4)
if (!pBits[3]) pBits[3] = 255;
//Copy to output
BitBlt(hdc, 0, 0, rc.right, rc.bottom, tempDC, 0, 0, SRCCOPY);
SelectObject(tempDC, hOldBmp);
DeleteObject(hBmp);
DeleteDC(tempDC);
}
示例9: __glutFinishMenu
void
__glutFinishMenu(Window win, int x, int y)
{
unmapMenu(__glutMappedMenu);
/* XXX Put in a GdiFlush just in case. Probably unnecessary. -mjk */
GdiFlush();
if (__glutMenuStatusFunc) {
__glutSetWindow(__glutMenuWindow);
__glutSetMenu(__glutMappedMenu);
/* Setting __glutMappedMenu to NULL permits operations that
change menus or destroy the menu window again. */
__glutMappedMenu = NULL;
__glutMenuStatusFunc(GLUT_MENU_NOT_IN_USE, x, y);
}
/* Setting __glutMappedMenu to NULL permits operations that
change menus or destroy the menu window again. */
__glutMappedMenu = NULL;
/* If an item is selected and it is not a submenu trigger,
generate menu callback. */
if (__glutItemSelected && !__glutItemSelected->isTrigger) {
__glutSetWindow(__glutMenuWindow);
/* When menu callback is triggered, current menu should be
set to the callback menu. */
__glutSetMenu(__glutItemSelected->menu);
__glutItemSelected->menu->select(__glutItemSelected->value);
}
__glutMenuWindow = NULL;
}
示例10: gdk_win32_display_sync
static void
gdk_win32_display_sync (GdkDisplay * display)
{
g_return_if_fail (display == _gdk_display);
GdiFlush ();
}
示例11: g_CreateHbitmapFromGdiplusBitmapData32bpp
HBITMAP g_CreateHbitmapFromGdiplusBitmapData32bpp(const Gdiplus::BitmapData & pBitmapData)
{
pfc::array_t<t_uint8> bm_data;
bm_data.set_size(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 0);
bm_data.fill(0);
BITMAPINFOHEADER bmi;
memset(&bmi, 0, sizeof(bmi));
bmi.biSize = sizeof(bmi);
bmi.biWidth = pBitmapData.Width;
bmi.biHeight = -pBitmapData.Height;
bmi.biPlanes = 1;
bmi.biBitCount = 32;
bmi.biCompression = BI_RGB;
bmi.biClrUsed = 0;
bmi.biClrImportant = 0;
BITMAPINFO & bi = *(BITMAPINFO*)bm_data.get_ptr();
bi.bmiHeader = bmi;
void * data = 0;
HBITMAP bm = CreateDIBSection(0, &bi, DIB_RGB_COLORS, &data, 0, 0);
if (data)
{
char * ptr = (char*)data;
GdiFlush();
memcpy(ptr, pBitmapData.Scan0, pBitmapData.Stride*pBitmapData.Height);
}
return bm;
}
示例12: GDI_LockTexture
static int
GDI_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty, void **pixels,
int *pitch)
{
GDI_TextureData *data = (GDI_TextureData *) texture->driverdata;
if (data->yuv) {
return SDL_SW_LockYUVTexture(data->yuv, rect, markDirty, pixels,
pitch);
} else if (data->pixels) {
#ifndef _WIN32_WCE
/* WinCE has no GdiFlush */
GdiFlush();
#endif
*pixels =
(void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
rect->x * SDL_BYTESPERPIXEL(texture->format));
*pitch = data->pitch;
return 0;
} else {
SDL_SetError("No pixels available");
return -1;
}
}
示例13: icvGetBitmapData
// returns TRUE if there is a problem such as ERROR_IO_PENDING.
static bool icvGetBitmapData( CvWindow* window, SIZE* size, int* channels, void** data )
{
BITMAP bmp;
GdiFlush();
HGDIOBJ h = GetCurrentObject( window->dc, OBJ_BITMAP );
if( size )
size->cx = size->cy = 0;
if( data )
*data = 0;
if (h == NULL)
return true;
if (GetObject(h, sizeof(bmp), &bmp) == 0)
return true;
if( size )
{
size->cx = abs(bmp.bmWidth);
size->cy = abs(bmp.bmHeight);
}
if( channels )
*channels = bmp.bmBitsPixel/8;
if( data )
*data = bmp.bmBits;
return false;
}
示例14: SaveAlpha
void SaveAlpha(LPRECT lpRect)
{
if (skin.colSavedBits) {
mir_free(skin.colSavedBits);
skin.colSavedBits = 0;
}
GdiFlush();
if (lpRect->left < 0) lpRect->left = 0;
if (lpRect->top < 0) lpRect->top = 0;
if (lpRect->right - lpRect->left > skin.iWidth) lpRect->right = lpRect->left + skin.iWidth;
if (lpRect->bottom - lpRect->top > skin.iHeight) lpRect->bottom = lpRect->top + skin.iHeight;
int x = lpRect->left;
int y = lpRect->top;
int w = lpRect->right - lpRect->left;
int h = lpRect->bottom - lpRect->top;
skin.colSavedBits = (COLOR32 *)mir_alloc(sizeof(COLOR32) * w * h);
COLOR32 *p1 = skin.colSavedBits;
for (int i = 0; i < h; i++) {
if (i+y < 0) continue;
if (i+y >= skin.iHeight) break;
COLOR32 *p2 = skin.colBits + (y+i)*skin.iWidth + x;
for (int j = 0; j < w; j++) {
if (j+x < 0) continue;
if (j+x >= skin.iWidth) break;
*p1++ = *p2++;
}
}
}
示例15: IupGLWait
void IupGLWait(int gl)
{
if (gl)
glFinish();
else
GdiFlush();
}