当前位置: 首页>>代码示例>>C++>>正文


C++ CreateCompatibleBitmap函数代码示例

本文整理汇总了C++中CreateCompatibleBitmap函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateCompatibleBitmap函数的具体用法?C++ CreateCompatibleBitmap怎么用?C++ CreateCompatibleBitmap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CreateCompatibleBitmap函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main()
{
// Create a normal DC and a memory DC for the entire screen. The
// normal DC provides a "snapshot" of the screen contents. The
// memory DC keeps a copy of this "snapshot" in the associated
// bitmap.
HDC hdcScreen, hdcCompatible;
HBITMAP hbmScreen;
SYSTEMTIME time;
char* filename;
char* filepath;
char* regSubKeyBase = "Software\\PJBSoftware\\ScreenShooter";

bool isRegVersion = false;

filepath = (char*)malloc(100 * sizeof(char));
if (!filepath) return 1;


HKEY progKey;
//Get the screenshot location from the registry, else stuff 'em in "My Documents"
if (RegOpenKeyEx(HKEY_CURRENT_USER,regSubKeyBase,0,KEY_QUERY_VALUE,&progKey) == ERROR_SUCCESS)
{
    DWORD buffsize = 100;
    DWORD type;
    if (RegQueryValueEx(progKey,"ScreenshotPath",NULL,&type,(LPBYTE)filepath,&buffsize) != ERROR_SUCCESS) return 1;
 }
else
{
    char* username = (char*) malloc(25 * sizeof(char));
    if (! username) return 1;
    DWORD buffsize = 25;
    BOOL st = GetUserName(username,&buffsize);
    if (!st) return 1;


    sprintf(filepath,"C:\\Documents and Settings\\%s\\My Documents",username);
    free (username);
}

// Get the time
GetLocalTime((LPSYSTEMTIME)&time);

hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
hdcCompatible = CreateCompatibleDC(hdcScreen);

// Create a compatible bitmap for hdcScreen.

hbmScreen = CreateCompatibleBitmap(hdcScreen,
                     GetDeviceCaps(hdcScreen, HORZRES),
                     GetDeviceCaps(hdcScreen, VERTRES));

if (hbmScreen == 0)
    printf("Could not create bitmap\n");

// Select the bitmaps into the compatible DC.

if (!SelectObject(hdcCompatible, hbmScreen))
    printf("Could not select bitmap\n");



         //Copy color data for the entire display into a
         //bitmap that is selected into a compatible DC.

        if (!BitBlt(hdcCompatible,
               0,0,
               GetDeviceCaps(hdcScreen, HORZRES), GetDeviceCaps(hdcScreen, VERTRES),
               hdcScreen,
               0,0,
               SRCCOPY))

         printf("Screen to Compat Blt Failed\n");

    filename = (char*)malloc(150 * sizeof(char));
    if (!filename) return 1;

    sprintf(filename,"%s\\screenshot-%04u-%02u-%02u-%02u%02u%02u.bmp",filepath,time.wYear,time.wMonth,time.wDay,time.wHour,time.wMinute,time.wSecond);
    free(filepath);


    CreateBMPFile(filename,CreateBitmapInfoStruct(hbmScreen),hbmScreen,hdcCompatible);

    free(filename);

 	return 0;


}
开发者ID:peejaybee,项目名称:ScreenShooter,代码行数:89,代码来源:main.cpp

示例2: readscreen

static void readscreen(void)
{
#if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN)
  HDC		hScrDC;		/* screen DC */
  HDC		hMemDC;		/* memory DC */
  HBITMAP	hBitmap;	/* handle for our bitmap */
  HBITMAP	hOldBitmap;	/* handle for previous bitmap */
  BITMAP	bm;		/* bitmap properties */
  unsigned int	size;		/* size of bitmap */
  char		*bmbits;	/* contents of bitmap */
  int		w;		/* screen width */
  int		h;		/* screen height */
  int		y;		/* y-coordinate of screen lines to grab */
  int		n = 16;		/* number of screen lines to grab at a time */

  if (GetVersion() >= 0x80000000 || !OPENSSL_isservice())
    return;

  /* Create a screen DC and a memory DC compatible to screen DC */
  hScrDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
  hMemDC = CreateCompatibleDC(hScrDC);

  /* Get screen resolution */
  w = GetDeviceCaps(hScrDC, HORZRES);
  h = GetDeviceCaps(hScrDC, VERTRES);

  /* Create a bitmap compatible with the screen DC */
  hBitmap = CreateCompatibleBitmap(hScrDC, w, n);

  /* Select new bitmap into memory DC */
  hOldBitmap = SelectObject(hMemDC, hBitmap);

  /* Get bitmap properties */
  GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
  size = (unsigned int)bm.bmWidthBytes * bm.bmHeight * bm.bmPlanes;

  bmbits = OPENSSL_malloc(size);
  if (bmbits) {
    /* Now go through the whole screen, repeatedly grabbing n lines */
    for (y = 0; y < h-n; y += n)
    	{
	unsigned char md[MD_DIGEST_LENGTH];

	/* Bitblt screen DC to memory DC */
	BitBlt(hMemDC, 0, 0, w, n, hScrDC, 0, y, SRCCOPY);

	/* Copy bitmap bits from memory DC to bmbits */
	GetBitmapBits(hBitmap, size, bmbits);

	/* Get the hash of the bitmap */
	MD(bmbits,size,md);

	/* Seed the random generator with the hash value */
	RAND_add(md, MD_DIGEST_LENGTH, 0);
	}

    OPENSSL_free(bmbits);
  }

  /* Select old bitmap back into memory DC */
  hBitmap = SelectObject(hMemDC, hOldBitmap);

  /* Clean up */
  DeleteObject(hBitmap);
  DeleteDC(hMemDC);
  DeleteDC(hScrDC);
#endif /* !OPENSSL_SYS_WINCE */
}
开发者ID:LucidOne,项目名称:Rovio,代码行数:68,代码来源:rand_win.c

示例3: GetDC

//Loosely based on writeWindowText() @ 0x0041F2B0
void Bitmap::blitKoreanChar(const char *ch, int &x, int &y, u8 fontSize, u8 color) {
  static HFONT gulim_8pt = NULL, gulim_9pt = NULL, gulim_10pt = NULL, gulim_11pt = NULL;
  static HDC bufferDc = NULL;
  static HBITMAP bufferBmp = NULL; //Temporary bitmap to draw the character
  
  //Load Korean fonts
  if (!gulim_9pt) {
    HDC screenDc = GetDC(NULL);
    LOGFONT lFont = {};
    strcpy(lFont.lfFaceName, "±¼¸²");
    lFont.lfCharSet = HANGUL_CHARSET;
    
    lFont.lfHeight = -MulDiv(8, GetDeviceCaps(screenDc, LOGPIXELSY), 72); //Not in StarCraft
    gulim_8pt = CreateFontIndirect(&lFont);
    
    lFont.lfHeight = -MulDiv(9, GetDeviceCaps(screenDc, LOGPIXELSY), 72);
    gulim_9pt = CreateFontIndirect(&lFont);
    
    lFont.lfWeight = FW_BOLD;
    lFont.lfHeight = -MulDiv(10, GetDeviceCaps(screenDc, LOGPIXELSY), 72);
    gulim_10pt = CreateFontIndirect(&lFont);
    
    lFont.lfWeight = FW_BOLD;
    lFont.lfHeight = -MulDiv(11, GetDeviceCaps(screenDc, LOGPIXELSY), 72);
    gulim_11pt = CreateFontIndirect(&lFont);
    
    ReleaseDC(NULL, screenDc);
  }
  
  //Load main and buffer DCs
  if (!bufferBmp) {
    HDC mainDc = GetDC(*hWndMainSC);

    bufferDc = CreateCompatibleDC(mainDc);
    SetBkMode(bufferDc, OPAQUE);
    SetTextColor(bufferDc, RGB(255, 255, 255));
    SetBkColor(bufferDc, RGB(0, 0, 0));
    SelectObject(bufferDc, GetStockObject(BLACK_BRUSH));

    bufferBmp = CreateCompatibleBitmap(mainDc, KOR_CHAR_MAX_WIDTH, KOR_CHAR_MAX_HEIGHT);
    SelectObject(bufferDc, bufferBmp);
    
    ReleaseDC(*hWndMainSC, mainDc);
  }

  //Assume this function is only drawing in-game stuff
  HFONT currentFont;
  switch (fontSize) {
    case 0:
      currentFont = gulim_8pt; break;   //SC uses 9pt, but who cares :P
    case 1:
      currentFont = gulim_9pt; break;
    case 2:
      currentFont = gulim_10pt; break;  //SC uses 11pt, but who cares :P
    case 3:
    default:
      currentFont = gulim_11pt; break;
  }

  SelectObject(bufferDc, currentFont);
  
  char koreanChars[3];
  *(u16*)koreanChars = *(u16*) ch;
  koreanChars[2] = '\0';

  //Retrieve the size of the rectangular area to draw the character
  RECT chRect = {};
  DrawText(bufferDc, koreanChars, strlen(koreanChars), &chRect, DT_CALCRECT);
  
  //Fill the character rectangle with black background
  Rectangle(bufferDc, chRect.left - 1, chRect.top - 1, chRect.right + 1, chRect.bottom + 1);

  //Write character into temporary bitmap buffer
  DrawText(bufferDc, koreanChars, strlen(koreanChars), &chRect, 0);

  //Copy pixel data from temporary bitmap into temporary buffer
  static u8 bitmapBuffer[KOR_CHAR_MAX_WIDTH * KOR_CHAR_MAX_HEIGHT];
  GetBitmapBits(bufferBmp, KOR_CHAR_MAX_WIDTH * chRect.bottom, bitmapBuffer);
  
  //Copy pixels from temporary buffer into StarCraft's own buffer
  for (int yOff = 0; yOff < chRect.bottom; ++yOff) {
    for (int xOff = 0; xOff < chRect.right; ++xOff) {
      if (bitmapBuffer[xOff + KOR_CHAR_MAX_WIDTH * yOff]) {
        this->drawDot(x + xOff + 1, y + yOff + 3, gbFontColors[color][0]); //Shadow
        this->drawDot(x + xOff, y + yOff + 2, gbFontColors[color][1]);
      }
    }
  }

  //Advance pixels
  x += chRect.right;
}
开发者ID:KYSXD,项目名称:general-plugin-template-project,代码行数:93,代码来源:Bitmap.cpp

示例4: Initialize

bool
Initialize () {

    // no WinMain so get the module handle:
    g_hInstance = GetModuleHandle(NULL);
    if (g_hInstance == NULL)
        return false;

    // register the window class:
    WNDCLASS wc;

    wc.style         = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = g_hInstance;
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = WINDOW_TITLE;

    if (RegisterClass(&wc) == 0)
        return false;

    // create the window:
    g_hWnd = CreateWindow(
        WINDOW_TITLE,                                             // class name
        WINDOW_TITLE,                                             // title
        WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, // style
        CW_USEDEFAULT, CW_USEDEFAULT,                             // position
        CW_USEDEFAULT, CW_USEDEFAULT,                             // size
        NULL,                                                     // no parent
        NULL,                                                     // no menu
        g_hInstance,                                              // instance
        NULL                                                      // no special
    );

    if (g_hWnd == NULL)
        return false;

    // setup double buffering:
    g_hDC = GetDC(g_hWnd);
    if (g_hDC == NULL)
        return false;

    g_hMemDC = CreateCompatibleDC(g_hDC);
    if (g_hMemDC == NULL)
        return false;

    g_hMemBMP = CreateCompatibleBitmap(g_hDC, WINDOW_WIDTH, WINDOW_HEIGHT);
    if (g_hMemBMP == NULL)
        return false;

    SelectObject(g_hMemDC, g_hMemBMP);

    // color used to draw the background:
    g_hBlue = CreateSolidBrush(RGB(100, 149, 237));
    if (g_hBlue == NULL)
        return FALSE;

    // setup octocat:
    octocat_hdc = CreateCompatibleDC(g_hDC);
    if (octocat_hdc == NULL)
        return FALSE;

    octocat_bmp = CreateCompatibleBitmap(g_hDC, octocat_w, octocat_h);
    if (octocat_bmp == NULL)
        return FALSE;

    SelectObject(octocat_hdc, octocat_bmp);
    SetDIBits(octocat_hdc, octocat_bmp, 0, 320, octocat, &sprbmi, DIB_RGB_COLORS);

    return true;
}
开发者ID:Beluki,项目名称:EmbedDIBits,代码行数:75,代码来源:example.cpp

示例5: Initialize

bool
Initialize () {

    // no WinMain so get the module handle:
    g_hInstance = GetModuleHandle(NULL);
    if (g_hInstance == NULL)
        return false;

    // register the window class:
    WNDCLASS wc;

    wc.style         = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = g_hInstance;
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = WINDOW_TITLE;

    if (RegisterClass(&wc) == 0)
        return false;

    // create the window:
    g_hWnd = CreateWindow(
        WINDOW_TITLE,                                             // class name
        WINDOW_TITLE,                                             // title
        WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, // style
        CW_USEDEFAULT, CW_USEDEFAULT,                             // position
        CW_USEDEFAULT, CW_USEDEFAULT,                             // size
        NULL,                                                     // no parent
        NULL,                                                     // no menu
        g_hInstance,                                              // instance
        NULL                                                      // no special
    );

    if (g_hWnd == NULL)
        return false;

    // setup double buffering:
    g_hDC = GetDC(g_hWnd);
    if (g_hDC == NULL)
        return false;

    g_hMemDC = CreateCompatibleDC(g_hDC);
    if (g_hMemDC == NULL)
        return false;

    g_hMemBMP = CreateCompatibleBitmap(g_hDC, WINDOW_WIDTH, WINDOW_HEIGHT);
    if (g_hMemBMP == NULL)
        return false;

    SelectObject(g_hMemDC, g_hMemBMP);

    // colors used to draw the effect:
    g_hColor1 = CreateSolidBrush(RGB(184, 178, 251));
    g_hColor2 = CreateSolidBrush(RGB(98, 72, 124));

    if (g_hColor1 == NULL || g_hColor2 == NULL)
        return false;

    return true;
}
开发者ID:Beluki,项目名称:4k-Example,代码行数:65,代码来源:4k.cpp

示例6: WndProc

//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND	- process the application menu
//  WM_PAINT	- Paint the main window
//  WM_DESTROY	- post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

	switch (message)
	{
	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Parse the menu selections:
		switch (wmId)
		{
		case IDM_ABOUT:
			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
	case WM_CREATE:
		break;
	case WM_PAINT:

		hdc = BeginPaint(hWnd, &ps);

		{
			RECT cr;
			GetClientRect(hWnd, &cr);

			int width = cr.right - cr.left;
			int height = cr.bottom - cr.top;

			HDC bufDC;
			HBITMAP bufBMP;

			bufDC = CreateCompatibleDC(hdc);
			bufBMP = CreateCompatibleBitmap(hdc, width, height);
			SelectObject(bufDC, bufBMP);

			setPaintDC(bufDC);

			RECT r = {0};
			r.right = width;
			r.bottom = height;

			FillRect(bufDC, &r, GetStockBrush(WHITE_BRUSH));

			paint();

			setPaintDC(NULL);

			BitBlt(hdc, 0, 0, width, height, bufDC, 0, 0, SRCCOPY);

			DeleteObject(bufBMP);
			DeleteDC(bufDC);
		}

		EndPaint(hWnd, &ps);
		break;
	
	case WM_MOUSEMOVE:
		{
			int x = GET_X_LPARAM(lParam); 
			int y = GET_Y_LPARAM(lParam);

			mouseMove(x, y);
		}
	break;
	
	case WM_LBUTTONDOWN:
		SetCapture(hWnd);
		mouseDown();
	break;

	case WM_LBUTTONUP:
		ReleaseCapture();
		mouseUp();
	break;

	case WM_KEYDOWN:
		{
			int vk = wParam;
			char ch = MapVirtualKey(vk, MAPVK_VK_TO_CHAR);

			keyDown(ch, vk);
//.........这里部分代码省略.........
开发者ID:nalune,项目名称:MarkTwain,代码行数:101,代码来源:MarkTwain.cpp

示例7: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
	if( argc < 2 )
	{
		_tprintf(_T("converts a picture to a tank map\n"));
		_tprintf(_T("supported formats: bmp, gif, jpg, wmf, ico\n"));
		_tprintf(_T("using: mkmap bmpfile.bmp [mapfile]\n"));
		return 0;
	}

	_tprintf(_T("input file: \n  %s\n"), argv[1]);


	IPicture *pPicture = LoadPicture(argv[1]);

	if( NULL == pPicture )
	{
		_tprintf(_T("Loading FAILED!\n"));
		return -1;
	}


	HDC hdc = GetDC(NULL);


	long height, width;
	pPicture->get_Height(&height);
	pPicture->get_Width(&width);

    long height_ = MulDiv(height, GetDeviceCaps(hdc, LOGPIXELSY), HIMETRIC_INCH);
    long width_  = MulDiv(width,  GetDeviceCaps(hdc, LOGPIXELSX), HIMETRIC_INCH);


	_tprintf(_T("width  %d px\n"), width_);
	_tprintf(_T("height %d px\n"), height_);


	HDC hdc_tmp = CreateCompatibleDC(hdc);
	HBITMAP bmp = CreateCompatibleBitmap(hdc, width_, height_);

	ReleaseDC(NULL, hdc);


	HBITMAP old = (HBITMAP) SelectObject(hdc_tmp, bmp);

	pPicture->Render(hdc_tmp, 0, 0, width_, height_, 0, height, width, -height, NULL);
    

	_TCHAR outfn[MAX_PATH];
	if( argc > 2 )
		_tcscpy(outfn, argv[2]);
	else
		_stprintf(outfn, _T("%s.tankmap"), argv[1]);

    FILE *file = _tfopen(outfn, _T("wt"));
	if( NULL != file )
	{
		_tprintf(_T("writing map to '%s'\n"), outfn);
		try 
		{
			fwassert(_ftprintf(file, _T("<tank map>\n")));
			fwassert(_ftprintf(file, _T("width %d\n"), width_));
			fwassert(_ftprintf(file, _T("height %d\n"), height_));

			_TCHAR name[MAX_OBJNAME];

			int objcount = 0;
			for( int y = 0; y < height_; y++ )
			for( int x = 0; x < width_; x++ )
			{
				if( ObjectFromColor(name, GetPixel(hdc_tmp, x, y)) )
				{
					fwassert(_ftprintf(file, _T("%s %d %d\n"), name, 16 + x * 32, 16 + y * 32));
					objcount++;
				}
			}

			_tprintf(_T("%d objects written\n"), objcount);
			_tprintf(_T("done.\n"), objcount);
		}
		catch(const _TCHAR *msg)
		{
			fclose(file);
			_tprintf(msg);
		}
	}
	else
	{
		_tprintf(_T("can't open file '%s' for writing\n"), outfn);
	}


	SelectObject(hdc_tmp, old);
	DeleteObject(bmp);
	DeleteDC(hdc_tmp);

	SAFE_RELEASE(pPicture);

	return 0;
}
开发者ID:Asqwel,项目名称:TZOD-Modified,代码行数:100,代码来源:mkmap.cpp

示例8: WndProc


//.........这里部分代码省略.........
			currentBitmap = NULL;
		}
		break;
	}
	case WM_LBUTTONDOWN:
	{
		x1 = x2 = GET_X_LPARAM(lParam);
		y1 = y2 = GET_Y_LPARAM(lParam);
		
		break;
	}

	case WM_LBUTTONUP:
	{

		if (isCopy)
		{
			
			hdc = GetDC(hWnd);
			HDC memDC = CreateCompatibleDC(hdc);
			SetROP2(hdc, R2_NOTXORPEN);
			Rectangle(hdc, min(x1, x2), min(y1, y2), max(x1, x2), max(y1, y2));
			//
			if (x1 > x2)
				std::swap(x1, x2);
			if (y1 > y2)
				std::swap(y1, y2);
			//
			
			if (currentBitmap != NULL)
				DeleteObject(currentBitmap);
			
			
			HBITMAP temp = (HBITMAP)SelectObject(memDC, CreateCompatibleBitmap(hdc, x2 - x1, y2 - y1));

			BitBlt(memDC, 0, 0, x2 - x1, y2 - y1, hdc, x1, y1, SRCCOPY);
			
			temp = (HBITMAP) SelectObject(memDC, temp);
			
			DeleteDC(memDC);
			ReleaseDC(hWnd, hdc);

			//int gg = sizeof(BITMAP);
			if (temp != NULL)
			{
				
				OpenClipboard(hWnd);
				EmptyClipboard();
				

				SetClipboardData(CF_BITMAP, NULL);
				CloseClipboard();
				
				currentBitmap = temp;
				MessageBox(hWnd, L"The Image has been copied to clipboard.", L"Copy Successfully", MB_OK);
			}
			else
			{
				MessageBox(hWnd, L"Cannot copy image to clipboard.", L"Error", MB_OK);
			}
			x1 = x2;
			y1 = y2;
		}
		else
		{
			
开发者ID:hungnguyen0606,项目名称:Winprogramming,代码行数:66,代码来源:TestDelayRender.cpp

示例9: InitGui

void __cdecl InitGui(void *param)
{
  HWND hparentwnd;
  HANDLE hinst;
  WNDCLASSEX wndclass;
  char szFile[80];

  hinst = GetModuleHandle(NULL);
  GetModuleFileName (hinst, szFile, sizeof(szFile));
#ifdef DEBUG
  printf ("hinst = %x\n", hinst);
  printf ("File = %s\n", szFile);
#endif
  /* Fill in window class structure with parameters that describe
     the main window. */
  /* CS_OWNDC : un DC pour chaque fenêtre de la classe */
  wndclass.cbSize        = sizeof(wndclass);
  wndclass.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
  wndclass.lpfnWndProc   = (WNDPROC)WndProc;
  wndclass.cbClsExtra    = 0;
  wndclass.cbWndExtra    = 0;
  wndclass.hInstance     = hinst;
  wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION);
  wndclass.hIconSm       = LoadIcon (NULL, IDI_APPLICATION);
  wndclass.hCursor       = LoadCursor(NULL, IDC_ARROW);
  wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
  wndclass.lpszClassName = szFile;
  wndclass.lpszMenuName  = NULL;

  if (!RegisterClassEx(&wndclass))
    Win32Error("Register class");

  hparentwnd = GetFocus();
  my_window = CreateWindow(szFile, szTitle, 
			   WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,
			   CW_USEDEFAULT, 0, 
			   CW_USEDEFAULT, 0,
			   /* screenwidth, screendepth, */
			   hparentwnd, NULL, hinst, NULL);
  if (!my_window) {
    Win32Error("Create window");
  }
#ifdef DEBUG
  fprintf(stderr, "my_window = %x\n", my_window);
#endif
  
#ifdef LOOPMSG
  /* Acknowledge for UpdateWindow() (WM_PAINT message generated) */
  hMutex = CreateMutex(NULL, FALSE, "DrawingMutex");
  my_dc = GetDC(my_window);
  /* Device context for drawing and the associated bitmap. */
  drawing_dc = CreateCompatibleDC(my_dc);
  hbm = CreateCompatibleBitmap(my_dc, screenwidth, screendepth);
  SelectObject(drawing_dc, hbm);
  /* Blank the bitmap */
  SelectObject(drawing_dc, GetStockObject(WHITE_BRUSH));
  PatBlt(drawing_dc, 0, 0, screenwidth, screendepth, PATCOPY);
  hAccelTable = LoadAccelerators (hinst, szTitle);

  ShowWindow(my_window, SW_SHOWNORMAL);
  UpdateWindow(my_window);

  /* Running the message loop */
  while (GetMessage(&msg, my_window, 0, 0)) {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
  }

#else
  drawing_dc = my_dc = GetDC(my_window);
#endif
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:72,代码来源:win32.c

示例10: WIN_GetDisplayMode

static SDL_bool
WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode)
{
    SDL_VideoData *vid_data = (SDL_VideoData *) _this->driverdata;
    SDL_DisplayModeData *data;
    DEVMODE devmode;
    HDC hdc;

    devmode.dmSize = sizeof(devmode);
    devmode.dmDriverExtra = 0;
    if (!EnumDisplaySettings(deviceName, index, &devmode)) {
        return SDL_FALSE;
    }

    data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
    if (!data) {
        return SDL_FALSE;
    }
    data->DeviceMode = devmode;
    data->DeviceMode.dmFields =
        (DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY |
         DM_DISPLAYFLAGS);
    data->ScaleX = 1.0f;
    data->ScaleY = 1.0f;
    data->DiagDPI = 0.0f;
    data->HorzDPI = 0.0f;
    data->VertDPI = 0.0f;

    /* Fill in the mode information */
    mode->format = SDL_PIXELFORMAT_UNKNOWN;
    mode->w = devmode.dmPelsWidth;
    mode->h = devmode.dmPelsHeight;
    mode->refresh_rate = devmode.dmDisplayFrequency;
    mode->driverdata = data;

    if (index == ENUM_CURRENT_SETTINGS
        && (hdc = CreateDC(deviceName, NULL, NULL, NULL)) != NULL) {
        char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
        LPBITMAPINFO bmi;
        HBITMAP hbm;

#if 0
        int logical_width = GetDeviceCaps( hdc, HORZRES );
        int logical_height = GetDeviceCaps( hdc, VERTRES );

        data->ScaleX = (float)logical_width / devmode.dmPelsWidth;
        data->ScaleY = (float)logical_height / devmode.dmPelsHeight;
        mode->w = logical_width;
        mode->h = logical_height;
#endif
        
        // WIN_GetMonitorDPI needs mode->w and mode->h
        // so only call after those are set.
        if (vid_data->GetDpiForMonitor) {
            WIN_GetMonitorDPIData dpi_data;
            RECT monitor_rect;

            dpi_data.vid_data = vid_data;
            dpi_data.mode = mode;
            dpi_data.mode_data = data;
            monitor_rect.left = devmode.dmPosition.x;
            monitor_rect.top = devmode.dmPosition.y;
            monitor_rect.right = monitor_rect.left + 1;
            monitor_rect.bottom = monitor_rect.top + 1;
            EnumDisplayMonitors(NULL, &monitor_rect, WIN_GetMonitorDPI, (LPARAM)&dpi_data);
        } else {
            // We don't have the Windows 8.1 routine so just
            // get system DPI.
            data->HorzDPI = (float)GetDeviceCaps( hdc, LOGPIXELSX );
            data->VertDPI = (float)GetDeviceCaps( hdc, LOGPIXELSY );
            if (data->HorzDPI == data->VertDPI) {
                data->DiagDPI = data->HorzDPI;
            } else {
                data->DiagDPI = SDL_ComputeDiagonalDPI( mode->w,
                                                        mode->h,
                                                        (float)GetDeviceCaps( hdc, HORZSIZE ) / 25.4f,
                                                        (float)GetDeviceCaps( hdc, VERTSIZE ) / 25.4f );
            }
        }
        
        SDL_zero(bmi_data);
        bmi = (LPBITMAPINFO) bmi_data;
        bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);

        hbm = CreateCompatibleBitmap(hdc, 1, 1);
        GetDIBits(hdc, hbm, 0, 1, NULL, bmi, DIB_RGB_COLORS);
        GetDIBits(hdc, hbm, 0, 1, NULL, bmi, DIB_RGB_COLORS);
        DeleteObject(hbm);
        DeleteDC(hdc);
        if (bmi->bmiHeader.biCompression == BI_BITFIELDS) {
            switch (*(Uint32 *) bmi->bmiColors) {
            case 0x00FF0000:
                mode->format = SDL_PIXELFORMAT_RGB888;
                break;
            case 0x000000FF:
                mode->format = SDL_PIXELFORMAT_BGR888;
                break;
            case 0xF800:
                mode->format = SDL_PIXELFORMAT_RGB565;
                break;
//.........这里部分代码省略.........
开发者ID:renpy,项目名称:SDL2,代码行数:101,代码来源:SDL_windowsmodes.c

示例11: drawbmp

static void drawbmp(fz_context *ctx, fz_document *doc, fz_page *page, fz_display_list *list, int pagenum, fz_cookie *cookie)
{
	float zoom;
	fz_matrix ctm;
	fz_irect ibounds;
	fz_rect bounds, tbounds;

	int w, h;
	fz_device *dev;
	HDC dc, dc_main;
	RECT rc;
	HBRUSH bg_brush;
	HBITMAP hbmp;
	BITMAPINFO bmi = { 0 };
	int bmp_data_len;
	unsigned char *bmp_data;

	fz_bound_page(doc, page, &bounds);
	zoom = resolution / 72;
	fz_pre_scale(fz_rotate(&ctm, rotation), zoom, zoom);
	tbounds = bounds;
	fz_round_rect(&ibounds, fz_transform_rect(&tbounds, &ctm));

	w = width;
	h = height;
	if (res_specified)
	{
		fz_round_rect(&ibounds, &tbounds);
		if (w && ibounds.x1 - ibounds.x0 <= w)
			w = 0;
		if (h && ibounds.y1 - ibounds.y0 <= h)
			h = 0;
	}
	if (w || h)
	{
		float scalex = w / (tbounds.x1 - tbounds.x0);
		float scaley = h / (tbounds.y1 - tbounds.y0);
		fz_matrix scale_mat;
		if (w == 0)
			scalex = fit ? 1.0f : scaley;
		if (h == 0)
			scaley = fit ? 1.0f : scalex;
		if (!fit)
			scalex = scaley = min(scalex, scaley);
		fz_concat(&ctm, &ctm, fz_scale(&scale_mat, scalex, scaley));
		tbounds = bounds;
		fz_transform_rect(&tbounds, &ctm);
	}
	fz_round_rect(&ibounds, &tbounds);
	fz_rect_from_irect(&tbounds, &ibounds);

	w = ibounds.x1 - ibounds.x0;
	h = ibounds.y1 - ibounds.y0;

	dc_main = GetDC(NULL);
	hbmp = CreateCompatibleBitmap(dc_main, w, h);
	if (!hbmp)
		fz_throw(ctx, FZ_ERROR_GENERIC, "failed to create a %d x %d bitmap for page %d", w, h, pagenum);
	dc = CreateCompatibleDC(dc_main);
	DeleteObject(SelectObject(dc, hbmp));

	SetRect(&rc, 0, 0, w, h);
	bg_brush = CreateSolidBrush(RGB(0xFF,0xFF,0xFF));
	FillRect(dc, &rc, bg_brush);
	DeleteObject(bg_brush);

	dev = fz_new_gdiplus_device(ctx, dc, &tbounds);
	if (list)
		fz_run_display_list(list, dev, &ctm, &tbounds, cookie);
	else
		fz_run_page(doc, page, dev, &ctm, cookie);
	fz_free_device(dev);

	bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
	bmi.bmiHeader.biWidth = w;
	bmi.bmiHeader.biHeight = output_format == OUT_TGA ? -h : h;
	bmi.bmiHeader.biPlanes = 1;
	bmi.bmiHeader.biBitCount = output_format == OUT_TGA ? 32 : 24;
	bmi.bmiHeader.biCompression = BI_RGB;

	bmp_data_len = output_format == OUT_TGA ? w * h * 4 : ((w * 3 + 3) / 4) * 4 * h;
	bmp_data = fz_malloc(ctx, bmp_data_len);
	if (!GetDIBits(dc, hbmp, 0, h, bmp_data, &bmi, DIB_RGB_COLORS))
		fz_throw(ctx, FZ_ERROR_GENERIC, "cannot draw page %d", pagenum, filename);

	DeleteDC(dc);
	ReleaseDC(NULL, dc_main);
	DeleteObject(hbmp);

	if (output)
	{
		char buf[512];
		FILE *f;

		sprintf(buf, output, pagenum);
		f = fopen(buf, "wb");
		if (!f)
			fz_throw(ctx, FZ_ERROR_GENERIC, "could not create raster file '%s'", buf);

		if (output_format == OUT_TGA)
//.........这里部分代码省略.........
开发者ID:azaleafisitania,项目名称:sumatrapdf,代码行数:101,代码来源:mudraw.c

示例12: BeginPaint

void CtrlMemView::onPaint(WPARAM wParam, LPARAM lParam)
{
	// draw to a bitmap for double buffering
	PAINTSTRUCT ps;	
	HDC actualHdc = BeginPaint(wnd, &ps);
	HDC hdc = CreateCompatibleDC(actualHdc);
	HBITMAP hBM = CreateCompatibleBitmap(actualHdc, rect.right-rect.left, rect.bottom-rect.top);
	SelectObject(hdc, hBM);

	SetBkMode(hdc,OPAQUE);
	HPEN standardPen = CreatePen(0,0,0xFFFFFF);
	HBRUSH standardBrush = CreateSolidBrush(0xFFFFFF);

	HPEN oldPen = (HPEN) SelectObject(hdc,standardPen);
	HBRUSH oldBrush = (HBRUSH) SelectObject(hdc,standardBrush);
   	HFONT oldFont = (HFONT) SelectObject(hdc,(HGDIOBJ)font);

	// white background
	SelectObject(hdc,standardPen);
	SelectObject(hdc,standardBrush);
	Rectangle(hdc,0,0,rect.right,rect.bottom);

	// draw one extra row that may be partially visible
	for (int i = 0; i < visibleRows+1; i++)
	{
		char temp[32];

		unsigned int address=windowStart + i*rowSize;
		int rowY = rowHeight*i;
		
		sprintf(temp,"%08X",address);
		SetTextColor(hdc,0x600000);
		TextOutA(hdc,addressStart,rowY,temp,(int)strlen(temp));

		SetTextColor(hdc,0x000000);

		u32 memory[4];
		bool valid = debugger != NULL && debugger->isAlive() && Memory::IsValidAddress(address);
		if (valid)
		{
			memory[0] = debugger->readMemory(address);
			memory[1] = debugger->readMemory(address+4);
			memory[2] = debugger->readMemory(address+8);
			memory[3] = debugger->readMemory(address+12);
		}

		u8* m = (u8*) memory;
		for (int j = 0; j < rowSize; j++)
		{
			if (valid) sprintf(temp,"%02X",m[j]);
			else strcpy(temp,"??");

			unsigned char c = m[j];
			if (c < 32 || c >= 128 || valid == false) c = '.';

			if (address+j == curAddress && searching == false)
			{
				COLORREF oldBkColor = GetBkColor(hdc);
				COLORREF oldTextColor = GetTextColor(hdc);

				if (hasFocus && !asciiSelected)
				{
					SetTextColor(hdc,0xFFFFFF);
					SetBkColor(hdc,0xFF9933);
					if (selectedNibble == 0) SelectObject(hdc,(HGDIOBJ)underlineFont);
				} else {
					SetTextColor(hdc,0);
					SetBkColor(hdc,0xC0C0C0);
				}
				TextOutA(hdc,hexStart+j*3*charWidth,rowY,&temp[0],1);
							
				if (hasFocus && !asciiSelected)
				{
					if (selectedNibble == 1) SelectObject(hdc,(HGDIOBJ)underlineFont);
					else SelectObject(hdc,(HGDIOBJ)font);
				}
				TextOutA(hdc,hexStart+j*3*charWidth+charWidth,rowY,&temp[1],1);

				if (hasFocus && asciiSelected)
				{
					SetTextColor(hdc,0xFFFFFF);
					SetBkColor(hdc,0xFF9933);
				} else {
					SetTextColor(hdc,0);
					SetBkColor(hdc,0xC0C0C0);
					SelectObject(hdc,(HGDIOBJ)font);
				}
				TextOutA(hdc,asciiStart+j*(charWidth+2),rowY,(char*)&c,1);

				SetTextColor(hdc,oldTextColor);
				SetBkColor(hdc,oldBkColor);
			} else {
				TextOutA(hdc,hexStart+j*3*charWidth,rowY,temp,2);
				TextOutA(hdc,asciiStart+j*(charWidth+2),rowY,(char*)&c,1);
			}
		}
	}

	SelectObject(hdc,oldFont);
	SelectObject(hdc,oldPen);
//.........这里部分代码省略.........
开发者ID:Carter07,项目名称:ppsspp,代码行数:101,代码来源:CtrlMemView.cpp

示例13: color

HBITMAP Explorerplusplus::CaptureTabScreenshot(int iTabId)
{
	HDC hdc;
	HDC hdcSrc;
	HBITMAP hBitmap;
	HBITMAP hPrevBitmap;
	Gdiplus::Color color(0,0,0);
	RECT rcMain;
	RECT rcTab;

	HWND hTab = m_hListView[iTabId];

	GetClientRect(m_hContainer,&rcMain);
	GetClientRect(hTab,&rcTab);

	/* Main window BitBlt. */
	hdc = GetDC(m_hContainer);
	hdcSrc = CreateCompatibleDC(hdc);

	/* Any bitmap sent back to the operating system will need to be in 32-bit
	ARGB format. */
	Gdiplus::Bitmap bi(GetRectWidth(&rcMain),GetRectHeight(&rcMain),PixelFormat32bppARGB);
	bi.GetHBITMAP(color,&hBitmap);

	/* BitBlt the main window into the bitmap. */
	hPrevBitmap = (HBITMAP)SelectObject(hdcSrc,hBitmap);
	BitBlt(hdcSrc,0,0,GetRectWidth(&rcMain),GetRectHeight(&rcMain),hdc,0,0,SRCCOPY);


	/* Now BitBlt the tab onto the main window. */
	HDC hdcTab;
	HDC hdcTabSrc;
	HBITMAP hbmTab;
	HBITMAP hbmTabPrev;
	BOOL bVisible;

	hdcTab = GetDC(hTab);
	hdcTabSrc = CreateCompatibleDC(hdcTab);
	hbmTab = CreateCompatibleBitmap(hdcTab,GetRectWidth(&rcTab),GetRectHeight(&rcTab));

	hbmTabPrev = (HBITMAP)SelectObject(hdcTabSrc,hbmTab);

	bVisible = IsWindowVisible(hTab);

	if(!bVisible)
	{
		ShowWindow(hTab,SW_SHOW);
	}

	PrintWindow(hTab,hdcTabSrc,PW_CLIENTONLY);

	if(!bVisible)
	{
		ShowWindow(hTab,SW_HIDE);
	}

	MapWindowPoints(hTab,m_hContainer,(LPPOINT)&rcTab,2);
	BitBlt(hdcSrc,rcTab.left,rcTab.top,GetRectWidth(&rcTab),GetRectHeight(&rcTab),hdcTabSrc,0,0,SRCCOPY);

	SelectObject(hdcTabSrc,hbmTabPrev);
	DeleteObject(hbmTab);
	DeleteDC(hdcTabSrc);
	ReleaseDC(hTab,hdcTab);


	/* Shrink the bitmap. */
	HDC hdcThumbnailSrc;
	HBITMAP hbmThumbnail;
	POINT pt;

	hdcThumbnailSrc = CreateCompatibleDC(hdc);

	/* Thumbnail bitmap. */
	Gdiplus::Bitmap bmpThumbnail(GetRectWidth(&rcMain),GetRectHeight(&rcMain),PixelFormat32bppARGB);

	bmpThumbnail.GetHBITMAP(color,&hbmThumbnail);

	hPrevBitmap = (HBITMAP)SelectObject(hdcThumbnailSrc,hbmThumbnail);

	/* Finally, shrink the full-scale bitmap down into a thumbnail. */
	SetStretchBltMode(hdcThumbnailSrc,HALFTONE);
	SetBrushOrgEx(hdcThumbnailSrc,0,0,&pt);
	BitBlt(hdcThumbnailSrc,0,0,GetRectWidth(&rcMain),GetRectHeight(&rcMain),hdcSrc,0,0,SRCCOPY);

	SetBitmapDimensionEx(hbmThumbnail,GetRectWidth(&rcMain),GetRectHeight(&rcMain),NULL);

	SelectObject(hdcThumbnailSrc,hPrevBitmap);
	DeleteDC(hdcThumbnailSrc);

	DeleteObject(hBitmap);

	SelectObject(hdcSrc,hPrevBitmap);

	DeleteDC(hdcSrc);
	ReleaseDC(m_hContainer,hdc);

	return hbmThumbnail;
}
开发者ID:3scp8,项目名称:explorerplusplus,代码行数:98,代码来源:TaskbarThumbnails.cpp

示例14: WndProc


//.........这里部分代码省略.........
          DeleteDC(cdc);
        }
        else {
          COLORREF   cColor;
          HBITMAP    bmAndBack, bmAndObject, bmAndMem, bmSave;
          HBITMAP    bmBackOld, bmObjectOld, bmMemOld, bmSaveOld;
          HDC        hdcMem, hdcBack, hdcObject, hdcTemp, hdcSave;
          POINT      ptSize;

          HBITMAP hBitmap = img->hBitmap;

          hdcTemp = CreateCompatibleDC(hdc);
          SelectObject(hdcTemp, hBitmap);   // Select the bitmap

          ptSize.x = img->rPos.right - img->rPos.left;
          ptSize.y = img->rPos.bottom - img->rPos.top;
          DPtoLP(hdcTemp, &ptSize, 1);  // Convert from device to logical points

          // Create some DCs to hold temporary data.
          hdcBack   = CreateCompatibleDC(hdc);
          hdcObject = CreateCompatibleDC(hdc);
          hdcMem    = CreateCompatibleDC(hdc);
          hdcSave   = CreateCompatibleDC(hdc);

          // Create a bitmap for each DC. DCs are required for a number of
          // GDI functions.

          // Monochrome DC
          bmAndBack   = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);

          // Monochrome DC
          bmAndObject = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);

          bmAndMem    = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
          bmSave      = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);

          // Each DC must select a bitmap object to store pixel data.
          bmBackOld   = (HBITMAP)SelectObject(hdcBack, bmAndBack);
          bmObjectOld = (HBITMAP)SelectObject(hdcObject, bmAndObject);
          bmMemOld    = (HBITMAP)SelectObject(hdcMem, bmAndMem);
          bmSaveOld   = (HBITMAP)SelectObject(hdcSave, bmSave);

          // Set proper mapping mode.
          SetMapMode(hdcTemp, GetMapMode(hdc));

          // Save the bitmap sent here, because it will be overwritten.
          BitBlt(hdcSave, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCCOPY);

          // Set the background color of the source DC to the color.
          // contained in the parts of the bitmap that should be transparent
          cColor = SetBkColor(hdcTemp, img->cTransparent);

          // Create the object mask for the bitmap by performing a BitBlt
          // from the source bitmap to a monochrome bitmap.
          BitBlt(hdcObject, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0,
              SRCCOPY);

          // Set the background color of the source DC back to the original
          // color.
          SetBkColor(hdcTemp, cColor);

          // Create the inverse of the object mask.
          BitBlt(hdcBack, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0,
              NOTSRCCOPY);

          // Copy the background of the main DC to the destination.
开发者ID:kichik,项目名称:nsis-1,代码行数:67,代码来源:BgImage.cpp

示例15: WindowProc

//-----------------------------------WinProc-----------------------------
//
//-----------------------------------------------------------------------
LRESULT CALLBACK WindowProc(HWND hWnd, 
						                UINT msg, 
                            WPARAM wparam, 
                            LPARAM lparam)
{
	//these hold the dimensions of the client window area
	static int cxClient, cyClient;

	//used to create the back buffer
	static HDC		  hdcBackBuffer;
	static HBITMAP	hBitmap;
	static HBITMAP	hOldBitmap; 


	switch(msg)
	{	
		case WM_CREATE: 
		{
			//seed the random number generator
			srand((unsigned) time(NULL));

			//get the size of the client window
			RECT rect;
			GetClientRect(hWnd, &rect);

			cxClient = rect.right;
			cyClient = rect.bottom;

			//create a surface for us to render to(backbuffer)
			hdcBackBuffer = CreateCompatibleDC(NULL);

			HDC hdc = GetDC(hWnd);

			hBitmap = CreateCompatibleBitmap(hdc,
											                 cxClient,
											                 cyClient);
			ReleaseDC(hWnd, hdc);

			hOldBitmap = (HBITMAP)SelectObject(hdcBackBuffer, hBitmap); 

		} 
			
		break;
		
		//check key press messages
		case WM_KEYUP:
		{
			switch(wparam)
			{

				case VK_ESCAPE:
				{
					PostQuitMessage(0);
				}

				break;

			}//end WM_KEYUP switch
		}

		break;

		case WM_PAINT: 
		{
      
      
      PAINTSTRUCT ps;
      
		  BeginPaint(hWnd, &ps);
		
			//fill our backbuffer with white
			BitBlt(hdcBackBuffer,
             0,
             0,
             cxClient,
             cyClient,
             NULL,
             NULL,
             NULL,
             WHITENESS);
			
      //render the gun
      g_Gun.Render(hdcBackBuffer);
			
			//now blit backbuffer to front
			BitBlt(ps.hdc, 0, 0, cxClient, cyClient, hdcBackBuffer, 0, 0, SRCCOPY); 

			EndPaint(hWnd, &ps);
		} 
			
		break;

		case WM_DESTROY: 
		{
			SelectObject(hdcBackBuffer, hOldBitmap);
			
			//clean up our backbuffer objects
//.........这里部分代码省略.........
开发者ID:pxli168,项目名称:source,代码行数:101,代码来源:main.cpp


注:本文中的CreateCompatibleBitmap函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。