Пример #1
0
static void UnLoad() {
  MemFreeAuto(uvmap);
  DeletePalette(texture->palette);
  DeletePixmap(texture);
  DeleteBitmap(screen[0]);
  DeleteBitmap(screen[1]);
}
Пример #2
0
static void KillWaveScope() {
  WORD i;

  for (i = 0; i < 4; i++)
    DeleteBitmap(wavescope.channel[i].bm);
  DeleteBitmap(wavescope.spans);
}
Пример #3
0
void Label::Destroy()
{
    if (mBackgroundImage)
    {
        // Free background image
        DeleteBitmap(mBackgroundImage);
        mBackgroundImage = NULL;
    }
    
    if (mFont)
    {
        // Free font
        DeleteFont(mFont);
        mFont = NULL;
    }
    
    if (mImage)
    {
        // Free image
        DeleteBitmap(mImage);
        mImage = NULL;
    }
    
    if (mWindow)
    {
        // Destroy the window
        DestroyWindow(mWindow);
    }
}
Пример #4
0
HICON Win32Window::CreateIconFromTexture(ptr<Graphics::RawTextureData> texture, BOOL isIcon, int hotX, int hotY)
{
	int width = texture->GetImageWidth();
	int height = texture->GetImageHeight();
	int pitch = (width * 3 + 3) & ~3;
	BITMAPV5HEADER h;
	ZeroMemory(&h, sizeof(h));
	h.bV5Size = sizeof(h);
	h.bV5Width = width;
	h.bV5Height = height;
	h.bV5Planes = 1;
	h.bV5BitCount = 32;
	h.bV5Compression = BI_BITFIELDS;
	h.bV5RedMask = 0x00FF0000;
	h.bV5GreenMask = 0x0000FF00;
	h.bV5BlueMask = 0x000000FF;
	h.bV5AlphaMask = 0xFF000000;
	const uint8_t* pixels = (const uint8_t*)texture->GetMipData();
	uint8_t* buf = new uint8_t[width * 4 * height];
	for(int i = 0; i < height; ++i)
	{
		const uint8_t* linePixels = pixels + i * width * 4;
		uint8_t* lineBuf = buf + (height - 1 - i) * width * 4;
		for(int j = 0; j < width; ++j)
		{
			lineBuf[j * 4 + 0] = linePixels[j * 4 + 2];
			lineBuf[j * 4 + 1] = linePixels[j * 4 + 1];
			lineBuf[j * 4 + 2] = linePixels[j * 4 + 0];
			lineBuf[j * 4 + 3] = linePixels[j * 4 + 3];
		}
	}

	HDC hdc = GetDC(NULL);
	HBITMAP hbmpColor = CreateDIBitmap(hdc, (BITMAPINFOHEADER*)&h, CBM_INIT, buf, (BITMAPINFO*)&h, DIB_RGB_COLORS);
	HBITMAP hbmpMask = CreateBitmap(width, height, 1, 1, NULL);
	ReleaseDC(NULL, hdc);

	delete [] buf;

	if(!hbmpColor || !hbmpMask)
	{
		if(hbmpColor) DeleteBitmap(hbmpColor);
		if(hbmpMask) DeleteBitmap(hbmpMask);
		THROW("Can't create bitmaps");
	}

	ICONINFO ii;
	ii.fIcon = isIcon;
	ii.xHotspot = hotX;
	ii.yHotspot = hotY;
	ii.hbmMask = hbmpMask;
	ii.hbmColor = hbmpColor;
	HICON icon = CreateIconIndirect(&ii);

	DeleteBitmap(hbmpColor);
	DeleteBitmap(hbmpMask);

	return icon;
}
Пример #5
0
/*!
	プレビューウインドウクラスを作成
	@param[in]	hInstance	アプリのインスタンス
	@param[in]	hParentWnd	親ウインドウのハンドル
	@return	なし
*/
VOID PreviewInitialise( HINSTANCE hInstance, HWND hParentWnd )
{
	WNDCLASSEX	wcex;
	GUID	guid;

	HBITMAP	hImg, hMsq;

	if( hInstance )
	{
		ghInst = hInstance;

		_Module.Init( ObjectMap, hInstance, &guid );

		//	専用のウインドウクラス作成
		ZeroMemory( &wcex, sizeof(WNDCLASSEX) );
		wcex.cbSize			= sizeof(WNDCLASSEX);
		wcex.style			= CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc	= PreviewWndProc;
		wcex.cbClsExtra		= 0;
		wcex.cbWndExtra		= 0;
		wcex.hInstance		= hInstance;
		wcex.hIcon			= NULL;
		wcex.hCursor		= LoadCursor(NULL, IDC_ARROW);
		wcex.hbrBackground	= (HBRUSH)(COLOR_WINDOW+1);
		wcex.lpszMenuName	= NULL;
		wcex.lpszClassName	= DOC_PREVIEW_CLASS;
		wcex.hIconSm		= NULL;

		RegisterClassEx( &wcex );

		ghPrevWnd = NULL;

		PreviewHeaderGet(  );

		CoInitialize( NULL );

		giViewMode = 0;

		ghPrevwImgLst = ImageList_Create( 16, 16, ILC_COLOR24 | ILC_MASK, 1, 1 );
		hImg = LoadBitmap( ghInst, MAKEINTRESOURCE( (IDBMP_PREVIEW_ALL) ) );
		hMsq = LoadBitmap( ghInst, MAKEINTRESOURCE( (IDBMQ_PREVIEW_ALL) ) );
		ImageList_Add( ghPrevwImgLst , hImg, hMsq );	//	イメージリストにイメージを追加
		DeleteBitmap( hImg );	DeleteBitmap( hMsq );
	}
	else
	{
		//	もし開けたままだったら綺麗に閉じないとメモリリーク
		if( ghPrevWnd ){	SendMessage( ghPrevWnd, WM_CLOSE, 0, 0 );	}

		CoUninitialize( );

		FREE(gpcHtmlHdr);

		ImageList_Destroy( ghPrevwImgLst );
	}

	return;
}
Пример #6
0
static void UnLoad() {
  DeleteSprite(sprite[0]);
  DeleteSprite(sprite[1]);
  DeleteSprite(sprite[2]);
  DeleteCopList(cp);
  DeletePalette(bitmap->palette);
  DeleteBitmap(bitmap);
  DeleteBitmap(screen);
}
Пример #7
0
static void UnLoad() {
  ITER(i, 0, PNUM - 1, DeleteBitmap(greeting[i].bitmap));
  DeleteBitmap(background);
  DeletePalette(palette[0]);
  DeletePalette(palette[1]);
  DeletePalette(palette[2]);
  DeleteBitmap(screen[0]);
  DeleteBitmap(screen[1]);
}
Пример #8
0
/**
 * @param hdc - drawing conImage.
 * @param prcPaint - the rectangle where the painting is requested.
 */
void CImageView::DrawImageView(HDC hdc, const RECT* prcPaint)
{
	_ASSERTE(g_pResManager != NULL);
	RECT rcClient;
	GetClientRect(m_hwnd, &rcClient);
	if (prcPaint == NULL)
		prcPaint = &rcClient;
	if (IsRectEmpty(prcPaint))
		return;

#ifdef USE_MEM_DC
	int nClientWidth = prcPaint->right - prcPaint->left;
	int nClientHeight = prcPaint->bottom - prcPaint->top;
	HBITMAP hbmpMem;
	hbmpMem = CreateCompatibleBitmap(hdc, nClientWidth, nClientHeight);
	if (hbmpMem == NULL)
		return;
	HDC hdcMem;
	hdcMem = CreateCompatibleDC(hdc);
	if (hdcMem == NULL)
	{
		DeleteBitmap(hbmpMem);
		return;
	}
	SetViewportOrgEx(hdcMem, -prcPaint->left, -prcPaint->top, NULL);
	HBITMAP hbmpSafe = SelectBitmap(hdcMem, hbmpMem);
#else
	// CS_PARENTDC sets the clipping rectangle of the child window to that of the parent window
	// so that the child can draw on the parent. Text view inherits this style from sub-classed
	// static control. This causes problems with unclipped TabbedTextOut() output.
	HRGN hrgn = CreateRectRgnIndirect(prcPaint);
	SelectClipRgn(hdc, hrgn);
	DeleteRgn(hrgn);
	HDC hdcMem = hdc;
#endif

	FillRect(hdcMem, prcPaint, g_pResManager->m_hbrWindowBrush);
	HDC hdcTemp = CreateCompatibleDC(hdc);
	if (hdcTemp)
	{
		HBITMAP hbmpSafe2 = SelectBitmap(hdcTemp, m_hAdjustedBitmap);
		int nHorPos = GetScrollPos(m_hwnd, SB_HORZ);
		int nVertPos = GetScrollPos(m_hwnd, SB_VERT);
		int nImageLeft = rcClient.right > m_szAjustedBitmapSize.cx ? (rcClient.right - m_szAjustedBitmapSize.cx) / 2 : -nHorPos;
		int nImageTop = rcClient.bottom > m_szAjustedBitmapSize.cy ? (rcClient.bottom - m_szAjustedBitmapSize.cy) / 2 : -nVertPos;
		BitBlt(hdcMem, nImageLeft, nImageTop, m_szAjustedBitmapSize.cx, m_szAjustedBitmapSize.cy, hdcTemp, 0, 0, SRCCOPY);
		SelectBitmap(hdcTemp, hbmpSafe2);
		DeleteDC(hdcTemp);
	}

#ifdef USE_MEM_DC
	BitBlt(hdc, prcPaint->left, prcPaint->top, nClientWidth, nClientHeight, hdcMem, prcPaint->left, prcPaint->top, SRCCOPY);
	SelectBitmap(hdcMem, hbmpSafe);
	DeleteDC(hdcMem);
	DeleteBitmap(hbmpMem);
#endif
}
Пример #9
0
static void Kill() {
  custom->dmacon = DMAF_COPPER | DMAF_BLITTER | DMAF_RASTER;

  ITER(i, 0, 7, DeleteBitmap(flare[i]));
  DeleteBitmap(carry);
  DeleteBitmap(screen[0]);
  DeleteBitmap(screen[1]);
  DeleteCopList(cp);
}
Пример #10
0
// ÓÎÏ·Çå³ý
BOOL GameClearup(HWND hWnd)
{
	DeleteDC(g_hdcMem);
	DeleteDC(g_hdcMem1);
	
	DeleteBitmap(g_hBmpMem);
	DeleteBitmap(g_hBmpBackground);
	DeleteBitmap(g_hBmpPlayer);

	return TRUE;
}
Пример #11
0
HRGN Label::CreateBackgroundRegion()
{
    HRGN region = NULL;
    
    if (mBackgroundImage)
    {
        // Draw the background into a memory bitmap, then create a region from
        // non-transparent pixels in that bitmap.
        HDC windowDC = GetDC(mWindow);
        
        HDC bufferDC = CreateCompatibleDC(windowDC);
        HBITMAP bufferBitmap = CreateCompatibleBitmap(windowDC, mWidth, mHeight);
        HBITMAP oldBufferBitmap = SelectBitmap(bufferDC, bufferBitmap);
        
        DrawBackground(bufferDC);
        SelectBitmap(bufferDC, oldBufferBitmap);
        region = BitmapToRegion(bufferBitmap, RGB(255, 0, 255), 0, 0, 0);
        
        DeleteDC(bufferDC);
        DeleteBitmap(bufferBitmap);
        
        ReleaseDC(mWindow, windowDC);
    }
    else
    {
        // If there is no background image, the window is always rectangular
        region = CreateRectRgn(0, 0, mWidth, mHeight);
    }
    
    return region;
}
Пример #12
0
static BOOL ListViewOnErase(HWND hWnd, HDC hDC)
{
	RECT		rcClient;
	HRGN		rgnBitmap;
	HPALETTE	hPAL;

	int 		i = 0, j = 0;
	HDC 		htempDC;
	POINT		ptOrigin;
	POINT		pt = {0,0};
	HBITMAP 	hOldBitmap;
	MYBITMAPINFO *pbmDesc = GetBackgroundInfo();
	HBITMAP		hBackground = GetBackgroundBitmap();
	HPALETTE	hPALbg = GetBackgroundPalette();

	// this does not draw the background properly in report view

	GetClientRect(hWnd, &rcClient);

	htempDC = CreateCompatibleDC(hDC);
	hOldBitmap = (HBITMAP)SelectObject(htempDC, hBackground);

	rgnBitmap = CreateRectRgnIndirect(&rcClient);
	SelectClipRgn(hDC, rgnBitmap);
	DeleteBitmap(rgnBitmap);

	hPAL = (!hPALbg) ? CreateHalftonePalette(hDC) : hPALbg;

	if (GetDeviceCaps(htempDC, RASTERCAPS) & RC_PALETTE && hPAL != NULL)
	{
		SelectPalette(htempDC, hPAL, FALSE);
		RealizePalette(htempDC);
	}

	// Get x and y offset
	MapWindowPoints(hWnd, GetTreeView(), &pt, 1);
	GetDCOrgEx(hDC, &ptOrigin);
	ptOrigin.x -= pt.x;
	ptOrigin.y -= pt.y;
	ptOrigin.x = -GetScrollPos(hWnd, SB_HORZ);
	ptOrigin.y = -GetScrollPos(hWnd, SB_VERT);

	if (pbmDesc->bmWidth && pbmDesc->bmHeight)
	{
		for (i = ptOrigin.x; i < rcClient.right; i += pbmDesc->bmWidth)
			for (j = ptOrigin.y; j < rcClient.bottom; j += pbmDesc->bmHeight)
				BitBlt(hDC, i, j, pbmDesc->bmWidth, pbmDesc->bmHeight, htempDC, 0, 0, SRCCOPY);
	}

	SelectObject(htempDC, hOldBitmap);
	DeleteDC(htempDC);

	if (!pbmDesc->bmColors)
	{
		DeletePalette(hPAL);
		hPAL = 0;
	}

	return TRUE;
}
Пример #13
0
void SavePixmap(Pixmap* px, char* name) {
	Bitmap* b =NewBitmap(px->width,px->height,px->bitsPerPixel); 
	b->data=(char*)px->data;
	SaveBitmap(b,name);
	b->data=NULL;
	DeleteBitmap(b);
}
Пример #14
0
/*!
	対象アイテム削除・REDRAWの面倒は別で見る
	@param[in]	iTarget	対象の通し番号・マイナスなら全削除
	@return	非0削除した 0削除できんかった
*/
INT DraughtItemDelete( CONST INT iTarget )
{
	INT_PTR	iItems, i;
	INT		delCnt;
	MAAM_ITR	itItem;

	iItems = gvcDrtItems.size( );	//	現在個数
	if( 0 >= iItems )	return 0;

	delCnt = 0;
	for( i = 0, itItem = gvcDrtItems.begin(); gvcDrtItems.end() != itItem; i++, itItem++ )
	{
		if( iTarget == i || 0 > iTarget )
		{
			FREE( itItem->pcItem );
			DeleteBitmap( itItem->hThumbBmp );
			delCnt++;

			if( iTarget == i )
			{
				gvcDrtItems.erase( itItem );
				return 1;
			}
		}
	}

	if( 0 > iTarget ){	gvcDrtItems.clear( );	}

	return delCnt;
}
Пример #15
0
TaskBarMap::~TaskBarMap()
{
	while(!empty()) {
		iterator it = begin();
		DeleteBitmap(it->second._hbmp);
		erase(it);
	}
}
Пример #16
0
QuickLaunchMap::~QuickLaunchMap()
{
	while(!empty()) {
		iterator it = begin();
		DeleteBitmap(it->second._hbmp);
		erase(it);
	}
}
Пример #17
0
static void create_memory_dc(struct graphics_priv *gr)
{
    HDC hdc;
    BITMAPINFO bOverlayInfo;

    if (gr->hMemDC)
    {
        (void)SelectBitmap(gr->hMemDC, gr->hOldBitmap);
        DeleteBitmap(gr->hBitmap);
        DeleteDC(gr->hMemDC);

        (void)SelectBitmap(gr->hPrebuildDC, gr->hOldPrebuildBitmap);
        DeleteBitmap(gr->hPrebuildBitmap);
        DeleteDC(gr->hPrebuildDC);
        gr->hPrebuildDC = 0;
    }


    hdc = GetDC( gr->wnd_handle );
    // Creates memory DC
    gr->hMemDC = CreateCompatibleDC(hdc);
    dbg(0, "resize memDC to: %d %d \n", gr->width, gr->height );


#ifndef  FAST_TRANSPARENCY

    memset(&bOverlayInfo, 0, sizeof(BITMAPINFO));
    bOverlayInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
    bOverlayInfo.bmiHeader.biWidth = gr->width;
    bOverlayInfo.bmiHeader.biHeight = -gr->height;
    bOverlayInfo.bmiHeader.biBitCount = 32;
    bOverlayInfo.bmiHeader.biCompression = BI_RGB;
    bOverlayInfo.bmiHeader.biPlanes = 1;
    gr->hPrebuildDC = CreateCompatibleDC(NULL);
    gr->hPrebuildBitmap = CreateDIBSection(gr->hMemDC, &bOverlayInfo, DIB_RGB_COLORS , (void **)&gr->pPixelData, NULL, 0);
    gr->hOldPrebuildBitmap = SelectBitmap(gr->hPrebuildDC, gr->hPrebuildBitmap);

#endif
    gr->hBitmap = CreateCompatibleBitmap(hdc, gr->width, gr->height );

    if ( gr->hBitmap )
    {
        gr->hOldBitmap = SelectBitmap( gr->hMemDC, gr->hBitmap);
    }
    ReleaseDC( gr->wnd_handle, hdc );
}
Пример #18
0
static int
TkcCreateBitmap(
    Tcl_Interp *interp,		/* Interpreter for error reporting. */
    Tk_Canvas canvas,		/* Canvas to hold new item. */
    Tk_Item *itemPtr,		/* Record to hold new item; header has been
				 * initialized by caller. */
    int objc,			/* Number of arguments in objv. */
    Tcl_Obj *const objv[])	/* Arguments describing rectangle. */
{
    BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
    int i;

    if (objc == 0) {
	Tcl_Panic("canvas did not pass any coords");
    }

    /*
     * Initialize item's record.
     */

    bmapPtr->anchor = TK_ANCHOR_CENTER;
    bmapPtr->bitmap = None;
    bmapPtr->activeBitmap = None;
    bmapPtr->disabledBitmap = None;
    bmapPtr->fgColor = NULL;
    bmapPtr->activeFgColor = NULL;
    bmapPtr->disabledFgColor = NULL;
    bmapPtr->bgColor = NULL;
    bmapPtr->activeBgColor = NULL;
    bmapPtr->disabledBgColor = NULL;
    bmapPtr->gc = None;

    /*
     * Process the arguments to fill in the item record. Only 1 (list) or 2 (x
     * y) coords are allowed.
     */

    if (objc == 1) {
	i = 1;
    } else {
	const char *arg = Tcl_GetString(objv[1]);
	i = 2;
	if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
	    i = 1;
	}
    }
    if (BitmapCoords(interp, canvas, itemPtr, i, objv) != TCL_OK) {
	goto error;
    }
    if (ConfigureBitmap(interp, canvas, itemPtr, objc-i, objv+i, 0)
	    == TCL_OK) {
	return TCL_OK;
    }

  error:
    DeleteBitmap(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas)));
    return TCL_ERROR;
}
Пример #19
0
void OnDestroy(HWND hwnd)
{
    if (g_hdcMem != NULL) {
        HBITMAP hBmpOld = SelectBitmap(g_hdcMem, NULL);
        if (hBmpOld != NULL) DeleteBitmap(hBmpOld);
        DeleteDC(g_hdcMem);
    }
    PostQuitMessage(0);
}
Пример #20
0
static void UnLoad() {
  DeleteSprite(left[0]);
  DeleteSprite(left[1]);
  DeleteSprite(right[0]);
  DeleteSprite(right[1]);
  DeleteBitmap(twister);
  DeletePixmap(texture);
  DeletePalette(gradient);
}
Пример #21
0
static void Load() {
  twister = LoadILBMCustom("twister.ilbm", BM_DISPLAYABLE);
  texture = LoadPNG("twister-texture.png", PM_RGB12, MEMF_PUBLIC);
  gradient = LoadPalette("twister-gradient.ilbm");

  {
    BitmapT *_left = LoadILBMCustom("twister-left.ilbm", 0);
    BitmapT *_right = LoadILBMCustom("twister-right.ilbm", 0);

    left[0] = NewSpriteFromBitmap(256, _left, 0, 0);
    left[1] = NewSpriteFromBitmap(256, _left, 16, 0);
    right[0] = NewSpriteFromBitmap(256, _right, 0, 0);
    right[1] = NewSpriteFromBitmap(256, _right, 16, 0);

    DeleteBitmap(_right);
    DeleteBitmap(_left);
  }
}
Пример #22
0
/* This finishes a drag operation.
 */
WINCOMMCTRLAPI void WINAPI EXPORT Amctl_ImageList_EndDrag( void )
{
   Amctl_ImageList_DragLeave( hwndDrag );
   SelectBitmap( hdcSaved, hbmpOldSaved );
   DeleteDC( hdcSaved );
   DeleteBitmap( hbmpSaved );
   Amctl_ImageList_Destroy( himlDrag );
   himlDrag = NULL;
}
Пример #23
0
void CImageView::ResetImage(void)
{
	if (m_hAdjustedBitmap)
	{
		DeleteBitmap(m_hAdjustedBitmap);
		m_hAdjustedBitmap = NULL;
	}
	m_hBitmap = NULL;
}
Пример #24
0
void drawHwndToFile(HWND hwnd, char *filename) {
	HDC hdc, hdcMem;
	HBITMAP hBitmap, hbmpOld;
	RECT rect;
	long w,h;

	FILE *fp = NULL;
	unsigned char *pixels;
	BITMAPINFO bmi;
	BITMAPFILEHEADER bmfilehdr;
	
	GetClientRect(hwnd, &rect);
	w = rect.right - rect.left;
	h = rect.bottom - rect.top;
	hdc = GetDC(hwnd);
	/* use a temp DC to copy the bits to a new bitmap */
	hBitmap = CreateCompatibleBitmap(hdc, w, h);
	hdcMem = CreateCompatibleDC(hdc);
	hbmpOld = SelectBitmap(hdcMem, hBitmap);
	BitBlt(hdcMem, 0, 0, w, h, hdc, 0, 0, SRCCOPY);
	SelectBitmap(hdcMem, hbmpOld);
	DeleteDC(hdcMem);

	/* copy over the bits to memory */
	memset(&bmi, 0, sizeof(BITMAPINFO));
	bmi.bmiHeader.biSize = sizeof(BITMAPINFO);
	bmi.bmiHeader.biPlanes = 1;
	bmi.bmiHeader.biWidth = w;
	bmi.bmiHeader.biHeight = h;
	bmi.bmiHeader.biBitCount = 24;
	bmi.bmiHeader.biCompression = BI_RGB;
	pixels = malloc((w + w%4) * h * 3); //scanlines must end on 4 byte boundries
	if (pixels == NULL) {
		MessageBox(hwnd, "Could not allocate memory for bitmap", "Error", MB_OK|MB_ICONERROR);
		return;
	}

	GetDIBits(hdc, hBitmap, 0, h, pixels, &bmi, DIB_RGB_COLORS);

	bmfilehdr.bfReserved1 = 0;
	bmfilehdr.bfReserved2 = 0;
	bmfilehdr.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + bmi.bmiHeader.biSizeImage;
	bmfilehdr.bfType = 'MB';
	bmfilehdr.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);

	fopen_s(&fp, filename, "wb");
	fwrite(&bmfilehdr, sizeof(BITMAPFILEHEADER), 1, fp);
	fwrite(&bmi.bmiHeader, sizeof(BITMAPINFOHEADER), 1, fp);
	fwrite(pixels, bmi.bmiHeader.biSizeImage, 1, fp);
	fclose(fp);

	free(pixels);
	DeleteBitmap(hBitmap);
	//DeleteDC(hdcMem);
	ReleaseDC(hwnd, hdc);
}
Пример #25
0
void OnDestroy(HWND hwnd)
{
    for (int i = 1; i <= 4; i++)
        KillTimer(hwnd, i);
    DeleteFont(g_app.hFont);
    DeletePen(g_app.hPen);
    DeleteDC(g_app.hdcMem);
    DeleteBitmap(g_app.hBmp);
    PostQuitMessage(0);
}
Пример #26
0
/* This function handles the WM_DRAWITEM message
 */
void FASTCALL Comms_Blink_OnDrawItem( HWND hwnd, const DRAWITEMSTRUCT FAR * lpDrawItem )
{
   COLORREF tmpT, tmpB;
   HBITMAP hbmpFont;
   char sz[ 100 ];
   COLORREF T, B;
   HFONT hFont;
   HBRUSH hbr;
   SIZE size;
   RECT rc;
   int y;

   /* Get the text we're drawing.
    */
   ListBox_GetText( lpDrawItem->hwndItem, lpDrawItem->itemID, sz );
   rc = lpDrawItem->rcItem;

   /* Set the drawing colours.
    */
   GetOwnerDrawListItemColours( lpDrawItem, &T, &B );

   /* Blank out the line we're drawing.
    */
   hbr = CreateSolidBrush( GetSysColor( COLOR_WINDOW ) );
   FillRect( lpDrawItem->hDC, &rc, hbr );

   /* Draw the standard bitmap for this entry.
    */
   hbmpFont = LoadBitmap( hRscLib, MAKEINTRESOURCE(IDB_BLINKMAN) );
   Amuser_DrawBitmap( lpDrawItem->hDC, rc.left, rc.top, 16, 16, hbmpFont, 0 );
   DeleteBitmap( hbmpFont );

   /* Draw the label.
    */
   tmpT = SetTextColor( lpDrawItem->hDC, T );
   tmpB = SetBkColor( lpDrawItem->hDC, B );
   hFont = SelectFont( lpDrawItem->hDC, hHelvB8Font );
   GetTextExtentPoint( lpDrawItem->hDC, sz, strlen(sz), &size );
   rc.left += 16;
   rc.right = rc.left + size.cx + 6;
   y = rc.top + ( ( rc.bottom - rc.top ) - size.cy ) / 2;
   ExtTextOut( lpDrawItem->hDC, rc.left + 2, y, ETO_OPAQUE, &rc, sz, strlen(sz), NULL );
   SelectFont( lpDrawItem->hDC, hFont );

   /* Draw a focus if needed.
    */
   if( lpDrawItem->itemState & ODS_FOCUS )
      DrawFocusRect( lpDrawItem->hDC, &rc );

   /* Clean up before we go home.
    */
   SetTextColor( lpDrawItem->hDC, tmpT );
   SetBkColor( lpDrawItem->hDC, tmpB );
   DeleteBrush( hbr );
}
Пример #27
0
static void PrepareResultsList(HWND hwnd){
	LVCOLUMNW	lvc;
	HBITMAP		hBmp;
	HMODULE		hIcons;

	hIcons = LoadLibraryExW(g_NotePaths.IconsPath, NULL, LOAD_LIBRARY_AS_DATAFILE);
	if(hIcons){
		//prepare and set list view image lists
		hBmp = LoadBitmapW(hIcons, MAKEINTRESOURCEW(IDB_CTRL_SMALL));
		m_hImlSearch = ImageList_Create(16, 16, ILC_COLOR24 | ILC_MASK, 0, 1);
		ImageList_AddMasked(m_hImlSearch, hBmp, CLR_MASK);
		DeleteBitmap(hBmp);
		DeleteObject((void *)CLR_MASK);
		//prepare image list for check image
		hBmp = LoadBitmapW(hIcons, MAKEINTRESOURCEW(IDB_CHECKS));
		m_hImlDefCheck = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
		ImageList_AddMasked(m_hImlDefCheck, hBmp, CLR_MASK);
		DeleteBitmap(hBmp);
		DeleteObject((void *)CLR_MASK);
		FreeLibrary(hIcons);
	}
	ListView_SetImageList(m_hListResults, m_hImlSearch, LVSIL_SMALL);
	SendMessageW(m_hListResults, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES, LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES);
	ZeroMemory(&lvc, sizeof(lvc));
	lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH;
	for(int i = 0; i < NELEMS(m_cols); i++){
		if(i > 0){
			lvc.cx = 240;
		}
		else{
			lvc.cx = 180;
		}
		lvc.iSubItem = i;
		lvc.pszText = m_cols[i];
		SendMessageW(m_hListResults, LVM_INSERTCOLUMNW, i, (LPARAM)&lvc);
	}

	//add checks
	CTreeView_Subclass(GetDlgItem(hwnd, IDC_TVW_SEARCH_DATES));
	TreeView_SetImageList(GetDlgItem(hwnd, IDC_TVW_SEARCH_DATES), m_hImlDefCheck, TVSIL_NORMAL);
	PrepareChecksList(GetDlgItem(hwnd, IDC_TVW_SEARCH_DATES));
}
Пример #28
0
void ScreenDown(HDC hdc, HDC hdc_src, int width, int height, int split_width, int delay, double accelerate, COLORREF background_color)
{
  HBITMAP hbm_buffer = CreateCompatibleBitmap(hdc, width, height);
  HDC hdc_buffer = CreateCompatibleDC(hdc);
  HBRUSH hbr_backgound = CreateSolidBrush(background_color);
  int *arr, arr_count = width / split_width + (width % split_width == 0 ? 0 : 1);
  int i, t = 0;

  SelectBitmap(hdc_buffer, hbm_buffer);

  arr = (int *)malloc(sizeof(*arr) * arr_count);

  if (!arr)
  {
    return;
  }

  for (i = 0; i < arr_count; i++)
  {
    arr[i] = -i * delay;
  }

  BitBlt(hdc_buffer, 0, 0, width, height, hdc_src, 0, 0, SRCCOPY);

  while (t < arr_count)
  {
    t = DrawScreenBitmap1(hdc_src, hdc, hdc_buffer, arr, arr_count, split_width, width, height, accelerate, hbr_backgound);
    for (i = 0; i < arr_count; i++)
    {
      arr[i]++;
    }
  }

  for (i = 0; i < arr_count; i++)
  {
    arr[i] = -i * delay;
  }

  t = 0;
  while (t < arr_count)
  {
    t = DrawScreenBitmap2(hdc_src, hdc, hdc_buffer, arr, arr_count, split_width, width, height, accelerate, hbr_backgound);
    for (i = 0; i < arr_count; i++)
    {
      arr[i]++;
    }
  }

  DeleteBrush(hbr_backgound);
  DeleteDC(hdc_buffer);
  DeleteBitmap(hbm_buffer);

  free(arr);
}
Пример #29
0
// Draws the bitmap in a disabled appearance. This routine assumes the
// bitmap has already been selected into the memory DC
static void NEAR
DisabledBitBlt(HDC hDestDC, RECT &r, HDC hMemDC)
{
	HDC			hMonoDC;
	HBITMAP		hMonoBitmap, hOldBitmap;
	HBRUSH		hOldBrush;
	int			nWidth = r.right - r.left;
	int			nHeight = r.bottom - r.top;
#ifndef _WIN32
	HBRUSH		hShadowBrush = CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW));
#endif

	// Create a monochrome bitmap and HDC
	hMonoBitmap = CreateBitmap(nWidth, nHeight, 1, 1, NULL);
	hMonoDC = CreateCompatibleDC(NULL);
	hOldBitmap = SelectBitmap(hMonoDC, hMonoBitmap);

	// Create a mask where the button face color is 1 and everything else is 0
	SetBkColor(hMemDC, GetSysColor(COLOR_BTNFACE));
	BitBlt(hMonoDC, 0, 0, nWidth, nHeight, hMemDC, 0, 0, SRCCOPY);

	SetTextColor(hDestDC, 0L);                  // 0's in mono -> 0 (for ROP)
	SetBkColor(hDestDC, (COLORREF)0x00FFFFFFL); // 1's in mono -> 1
	
	// Every place the mask has a 0 pixel draw with button highlight color
#ifdef _WIN32
	hOldBrush = SelectBrush(hDestDC, GetSysColorBrush(COLOR_BTNHILIGHT));
#else
	hOldBrush = SelectBrush(hDestDC, GetStockObject(WHITE_BRUSH));
#endif
	BitBlt(hDestDC, r.left + 1, r.top + 1, nWidth - 1, nHeight - 1, hMonoDC,
		0, 0, ROP_PSDPxax);

	// Every place the mask has a 0 pixel draw with button shadow color
#ifdef _WIN32
	SelectBrush(hDestDC, GetSysColorBrush(COLOR_BTNSHADOW));
#else
	SelectBrush(hDestDC, hShadowBrush);
#endif
	BitBlt(hDestDC, r.left, r.top, nWidth, nHeight, hMonoDC,
		0, 0, ROP_PSDPxax);

	// Restore the destination HDC
	SelectBrush(hDestDC, hOldBrush);
#ifndef _WIN32
	DeleteObject(hShadowBrush);
#endif

	// Destroy the GDI objects
	SelectBitmap(hMonoDC, hOldBitmap);
	DeleteBitmap(hMonoBitmap);
	DeleteDC(hMonoDC);
}
void ZLWin32ApplicationWindow::Toolbar::clear() {
	hwnd = 0;
	SeparatorNumbers.clear();
	ActionCodeById.clear();
	ParameterCodeById.clear();
	TBItemByActionCode.clear();
	for (std::map<HICON,HBITMAP>::const_iterator it = BitmapByIcon.begin(); it != BitmapByIcon.end(); ++it) {
		DestroyIcon(it->first);
		DeleteBitmap(it->second);
	}
	BitmapByIcon.clear();
}