當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetBitmap函數代碼示例

本文整理匯總了C++中GetBitmap函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetBitmap函數的具體用法?C++ GetBitmap怎麽用?C++ GetBitmap使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetBitmap函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: GetHbitmapOf

size_t wxBitmapDataObject::GetDataSize() const
{
#if wxUSE_WXDIB
    return wxDIB::ConvertFromBitmap(NULL, GetHbitmapOf(GetBitmap()));
#else
    return 0;
#endif
}
開發者ID:Teodorrrro,項目名稱:wxWidgets,代碼行數:8,代碼來源:dataobj.cpp

示例2: wxCHECK_MSG

wxObject * MaxBitmapComboBoxXmlHandler::DoCreateResource()
{
    if (m_class == wxT("ownerdrawnitem"))
    {
        wxCHECK_MSG(m_combobox, NULL, wxT("Incorrect syntax of XRC resource: ownerdrawnitem not within a bitmapcombobox!"));

        m_combobox->Append(GetText(wxT("text")), GetBitmap(wxT("bitmap"), wxART_MISSING_IMAGE));

        return m_combobox;
    }
    else /*if( m_class == wxT("wxBitmapComboBox"))*/
    {
        // find the selection
        long selection = GetLong( wxT("selection"), -1 );

        XRC_MAKE_INSTANCE(control, MaxBitmapComboBox)

        control->Create(m_parentAsWindow,
                        GetID(),
                        GetText(wxT("value")),
                        GetPosition(), GetSize(),
                        0,
                        NULL,
                        GetStyle(),
                        wxDefaultValidator,
                        GetName());

		control->MaxBind(_wx_wxbitmapcombobox_wxBitmapComboBox__xrcNew(control));

        m_isInside = true;
        m_combobox = control;

        wxXmlNode *children_node = GetParamNode(wxT("object"));

        wxXmlNode *n = children_node;

        while (n)
        {
            if ((n->GetType() == wxXML_ELEMENT_NODE) &&
                (n->GetName() == wxT("object")))
            {
                CreateResFromNode(n, control, NULL);
            }
            n = n->GetNext();
        }

        m_isInside = false;
        m_combobox = NULL;

        if (selection != -1)
            control->SetSelection(selection);

        SetupWindow(control);

        return control;
    }
}
開發者ID:BlitzMaxModules,項目名稱:wx.mod,代碼行數:57,代碼來源:glue.cpp

示例3: wxStaticCast

wxObject* wxRibbonXmlHandler::Handle_galleryitem()
{
    wxRibbonGallery *gallery = wxStaticCast(m_parent, wxRibbonGallery);
    wxCHECK (gallery, NULL);

    gallery->Append (GetBitmap(), GetID());

    return NULL; // nothing to return
}
開發者ID:3v1n0,項目名稱:wxWidgets,代碼行數:9,代碼來源:xh_ribbon.cpp

示例4: GetBitmap

void Sprite::Render(Bitmap& bitmap)
	{
	if (!visible_)
		{
		return;
		}

	GetBitmap().Blit((int)GetCel(),bitmap,Round(GetX()-GetOriginX()),Round(GetY()-GetOriginY()),GetColor(),GetAlpha());
	}
開發者ID:RichardMarks,項目名稱:Pixie,代碼行數:9,代碼來源:Sprite.cpp

示例5: CreateCompatibleBitmap

void CBitmapEx::SethBitmap(int iWidth, int iHeight, HDC hdc)
{
	_hBitmap = CreateCompatibleBitmap(
		hdc, iWidth, iHeight);

	GetObject(hGethBitmap(), sizeof(BITMAP), &GetBitmap());


}
開發者ID:BlackHole02,項目名稱:GST-C,代碼行數:9,代碼來源:bitmap.cpp

示例6: _ASSERT_VALID

// Obtain a mask bitmap. A mask bitmap is a bitmap which has
// all pixels with the color "crColor" set to white and all
// other pixels set to black.
HBITMAP ClsBitmap::GetMaskBitmap( COLORREF crColor, int nXPos /* = 0 */, int nYPos /* = 0 */ ) const
{
	_ASSERT_VALID( m_hGdiObject ); // Must be valid.

	// Preset result.
	BOOL bResult = FALSE;
	HBITMAP hMaskBM = NULL;

	// Create the necessary device contexts.
	ClsDC dcSrc, dcDst;
	if ( dcSrc.CreateCompatibleDC( NULL ) &&
	     dcDst.CreateCompatibleDC( NULL ))
	{
		// Get source bitmap information.
		BITMAP bm;
		if ( GetBitmap( &bm ))
		{
			// Create a monochrome bitmap of the same size.
			hMaskBM = ::CreateBitmap( bm.bmWidth, bm.bmHeight, 1, 1, NULL );
			if ( hMaskBM )
			{
				// Select both the source and destination bitmaps.
				HGDIOBJ hOldSrc = dcSrc.SelectObject( m_hGdiObject );
				HGDIOBJ hOldDst = dcDst.SelectObject( hMaskBM );
				_ASSERT( hOldSrc && hOldDst );

				// Obtain the color used to create the mask bitmap.
				if ( crColor == CLR_DEFAULT )
					crColor = dcSrc.GetPixel( nXPos, nYPos );

				// Change the background color to the masked color.
				COLORREF crOldBkCol = dcSrc.SetBkColor( crColor );

				// Copy the source into the destination which creates
				// the mask.
				if ( dcDst.BitBlt( 0, 0, bm.bmWidth, bm.bmHeight, &dcSrc, 0, 0, SRCCOPY ))
					// Success...
					bResult = TRUE;
				
				// Restore background color.
				dcSrc.SetBkColor( crOldBkCol );

				// Restore old bitmaps.
				dcSrc.SelectObject( hOldSrc );
				dcDst.SelectObject( hOldDst );

				// Destroy it if no successful.
				if ( bResult == FALSE ) 
					::DeleteObject( hMaskBM );
			}
		}
	}
	// Destroy DCs
	if ( dcSrc.IsValid())    dcSrc.DeleteDC();
	if ( dcDst.IsValid())    dcDst.DeleteDC();
	return bResult == TRUE ? hMaskBM : NULL;
}
開發者ID:x2on,項目名稱:NiLogViewer,代碼行數:60,代碼來源:bitmap.cpp

示例7: switch

void C4DefGraphics::Draw(C4Facet &cgo, DWORD iColor, C4Object *pObj, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform* trans)
{
	// default: def picture rect
	C4Rect fctPicRect = pDef->PictureRect;
	C4Facet fctPicture;

	// if assigned: use object specific rect and graphics
	if (pObj) if (pObj->PictureRect.Wdt) fctPicRect = pObj->PictureRect;

	// specific object color?
	if (pObj) pObj->PrepareDrawing();

	switch(Type)
	{
	case C4DefGraphics::TYPE_Bitmap:
		fctPicture.Set(GetBitmap(iColor),fctPicRect.x,fctPicRect.y,fctPicRect.Wdt,fctPicRect.Hgt);
		fctPicture.DrawTUnscaled(cgo,true,iPhaseX,iPhaseY,trans);
		break;
	case C4DefGraphics::TYPE_Mesh:
		// TODO: Allow rendering of a mesh directly, without instance (to render pose; no animation)
		std::unique_ptr<StdMeshInstance> dummy;
		StdMeshInstance* instance;

		C4Value value;
		if (pObj)
		{
			instance = pObj->pMeshInstance;
			pObj->GetProperty(P_PictureTransformation, &value);
		}
		else
		{
			dummy.reset(new StdMeshInstance(*Mesh, 1.0f));
			instance = dummy.get();
			pDef->GetProperty(P_PictureTransformation, &value);
		}

		StdMeshMatrix matrix;
		if (C4ValueToMatrix(value, &matrix))
			pDraw->SetMeshTransform(&matrix);

		pDraw->SetPerspective(true);
		pDraw->RenderMesh(*instance, cgo.Surface, cgo.X,cgo.Y, cgo.Wdt, cgo.Hgt, pObj ? pObj->Color : iColor, trans);
		pDraw->SetPerspective(false);
		pDraw->SetMeshTransform(NULL);

		break;
	}

	if (pObj) pObj->FinishedDrawing();

	// draw overlays
	if (pObj && pObj->pGfxOverlay)
		for (C4GraphicsOverlay *pGfxOvrl = pObj->pGfxOverlay; pGfxOvrl; pGfxOvrl = pGfxOvrl->GetNext())
			if (pGfxOvrl->IsPicture())
				pGfxOvrl->DrawPicture(cgo, pObj, trans);
}
開發者ID:Meowtimer,項目名稱:openclonk,代碼行數:56,代碼來源:C4DefGraphics.cpp

示例8: Attach

//////////////////
// Attach is just like the CGdiObject version,
// except it also creates the palette
//
BOOL CDib::Attach(HGDIOBJ hbm)
{
	if (CBitmap::Attach(hbm)) {
		if (!GetBitmap(&m_bm))			// load BITMAP for speed
			return FALSE;
		m_pal.DeleteObject();			// in case one is already there
		return CreatePalette(m_pal);	// create palette
	}
	return FALSE;	
}
開發者ID:segafan,項目名稱:wme1_jankavan_tlc_edition-repo,代碼行數:14,代碼來源:Dib.cpp

示例9: fn

void ReconcileProjectDlg::OnUndoSelectedFiles(wxCommandEvent& event)
{
    wxDataViewItemArray items;
    m_dataviewAssigned->GetSelections(items);

    for(size_t i=0; i<items.GetCount(); ++i) {
        wxVariant v;
        ReconcileFileItemData* data = dynamic_cast<ReconcileFileItemData*>(m_dataviewAssignedModel->GetClientObject( items.Item(i) ));
        if ( data ) {
            wxFileName fn(data->GetFilename());
            fn.MakeRelativeTo(m_toplevelDir);

            wxVector<wxVariant> cols;
            cols.push_back(::MakeIconText(fn.GetFullPath(), GetBitmap(fn.GetFullName())));
            m_dvListCtrl1Unassigned->AppendItem( cols, (wxUIntPtr)NULL );

        }
    }

    // get the list of items
    wxArrayString allfiles;
    for(int i=0 ; i<m_dvListCtrl1Unassigned->GetItemCount(); ++i) {
        wxVariant v;
        m_dvListCtrl1Unassigned->GetValue(v, i, 0);
        wxDataViewIconText it;
        it << v;
        allfiles.Add(it.GetText());
    }

    m_dataviewAssignedModel->DeleteItems(wxDataViewItem(0), items);

    // Could not find a nicer way of doing this, but
    // we want the files to be sorted again
    m_dvListCtrl1Unassigned->DeleteAllItems();

    std::sort(allfiles.begin(), allfiles.end());
    for(size_t i=0; i<allfiles.GetCount(); ++i) {
        wxVector<wxVariant> cols;
        cols.push_back( ::MakeIconText(allfiles.Item(i), GetBitmap(allfiles.Item(i)) ) );
        m_dvListCtrl1Unassigned->AppendItem( cols, (wxUIntPtr)NULL);
    }
}
開發者ID:HTshandou,項目名稱:codelite,代碼行數:42,代碼來源:reconcileproject.cpp

示例10: Cmd

void cVnsiOsd::Flush(void)
{
  if (!Active())
     return;
  cBitmap *Bitmap;
  bool full = cVnsiOsdProvider::IsRequestFull();
  for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++)
  {
    uint8_t reset = !shown || full;
    Cmd(VNSI_OSD_OPEN, i, Bitmap->Bpp(), Left() + Bitmap->X0(), Top() + Bitmap->Y0(), Left() + Bitmap->X0() + Bitmap->Width() - 1, Top() + Bitmap->Y0() + Bitmap->Height() - 1, (void *)&reset, 1);
    int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
    if (!shown || Bitmap->Dirty(x1, y1, x2, y2) || full)
    {
      if (!shown || full)
      {
        x1 = y1 = 0;
        x2 = Bitmap->Width() - 1;
        y2 = Bitmap->Height() - 1;
      }
      // commit colors:
      int NumColors;
      const tColor *Colors = Bitmap->Colors(NumColors);
      if (Colors)
      {
        Cmd(VNSI_OSD_SETPALETTE, i, 0, NumColors, 0, 0, 0, Colors, NumColors*sizeof(tColor));
      }
      // commit modified data:
      int size = (y2-y1) * Bitmap->Width() + (x2-x1+1);
      Cmd(VNSI_OSD_SETBLOCK, i, Bitmap->Width(), x1, y1, x2, y2, Bitmap->Data(x1, y1), size);
    }
    Bitmap->Clean();
  }
  if (!shown)
  {
    // Showing the windows in a separate loop to avoid seeing them come up one after another
    for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++)
    {
      Cmd(VNSI_OSD_MOVEWINDOW, i, 0, Left() + Bitmap->X0(), Top() + Bitmap->Y0());
    }
    shown = true;
  }
}
開發者ID:AlwinEsch,項目名稱:vdr-plugin-vnsiserver,代碼行數:42,代碼來源:vnsiosd.c

示例11: NewBitmapCursor

int NewBitmapCursor(Cursor *cp, char *source, char *mask)
{
	XColor fore, back;
	int hotx, hoty;
	int sx, sy, mx, my;
	unsigned int sw, sh, mw, mh;
	Pixmap spm, mpm;
	Colormap cmap = Scr->RootColormaps.cwins[0]->colormap->c;

	if(dpy == NULL) {
		// Handle special cases like --cfgchk
		*cp = None;
		return 0;
	}

	fore.pixel = Scr->Black;
	XQueryColor(dpy, cmap, &fore);
	back.pixel = Scr->White;
	XQueryColor(dpy, cmap, &back);

	spm = GetBitmap(source);
	if((hotx = HotX) < 0) {
		hotx = 0;
	}
	if((hoty = HotY) < 0) {
		hoty = 0;
	}
	mpm = GetBitmap(mask);

	/* make sure they are the same size */

	XGetGeometry(dpy, spm, &JunkRoot, &sx, &sy, &sw, &sh, &JunkBW, &JunkDepth);
	XGetGeometry(dpy, mpm, &JunkRoot, &mx, &my, &mw, &mh, &JunkBW, &JunkDepth);
	if(sw != mw || sh != mh) {
		fprintf(stderr,
		        "%s:  cursor bitmaps \"%s\" and \"%s\" not the same size\n",
		        ProgramName, source, mask);
		return (1);
	}
	*cp = XCreatePixmapCursor(dpy, spm, mpm, &fore, &back, hotx, hoty);
	return (0);
}
開發者ID:fullermd,項目名稱:ctwm-mirror,代碼行數:42,代碼來源:cursor.c

示例12: GetBitmap

void MAS::Progress::UpdateSize() {
   Bitmap bmp = GetBitmap();
   if (!bmp) return;
      
   if (orientation == 1) {
      h(bmp.h());
   }
   else {
      w(bmp.w());
   }
}
開發者ID:bambams,項目名稱:ma5king,代碼行數:11,代碼來源:progress.cpp

示例13: GetHbitmapOf

bool wxBitmapDataObject::GetDataHere(void *buf) const
{
#if wxUSE_WXDIB && !defined(__WXWINCE__)
    BITMAPINFO * const pbi = (BITMAPINFO *)buf;

    return wxDIB::ConvertFromBitmap(pbi, GetHbitmapOf(GetBitmap())) != 0;
#else
    wxUnusedVar(buf);
    return false;
#endif
}
開發者ID:hazeeq090576,項目名稱:wxWidgets,代碼行數:11,代碼來源:dataobj.cpp

示例14: GetBitmap

void CMyStatic::OnLButtonDown(UINT nFlags, CPoint point)
{
	bool bHandled = false;
	HBITMAP hBitmap = GetBitmap();
	COleDataSourceEx *pDataSrc = NULL;
	if (m_bDelayRendering)
		pDataSrc = DelayRenderOleData(hBitmap);
	else
		pDataSrc = CacheOleData(hBitmap, false);
	if (pDataSrc)
	{
		if (m_bAllowDropDesc)						// Allow targets to show user defined text.
			pDataSrc->AllowDropDescriptionText();	// Must be called before setting the drag image.

		CPoint pt(-1, 30000);						// Cursor is centered below the image
		switch (m_nDragImageType & DRAG_IMAGE_FROM_MASK)
		{
		case DRAG_IMAGE_FROM_CAPT :
			// Get drag image from content with optional scaling
			pDataSrc->InitDragImage(hBitmap, m_nDragImageScale, &pt);
			break;
		case DRAG_IMAGE_FROM_RES :
			// Use bitmap from resources as drag image
			pDataSrc->InitDragImage(IDB_BITMAP_DRAGME, &pt, CLR_INVALID);
			break;
		case DRAG_IMAGE_FROM_HWND :
			// This window handles DI_GETDRAGIMAGE messages.
//			pDataSrc->SetDragImageWindow(m_hWnd, &point);
//			break;
		case DRAG_IMAGE_FROM_SYSTEM :
			// Let Windows create the drag image.
			// With file lists and provided "Shell IDList Array" data, file type images are shown.
			// Otherwise, a generic image is used.
			pDataSrc->SetDragImageWindow(NULL, &point);
			break;
		case DRAG_IMAGE_FROM_EXT :
			// Get drag image from file extension using the file type icon
			pDataSrc->InitDragImage(_T(".bmp"), m_nDragImageScale, &pt);
			break;
//		case DRAG_IMAGE_FROM_TEXT :
//		case DRAG_IMAGE_FROM_BITMAP :
		default :
			// Get drag image from content without scaling
			pDataSrc->InitDragImage(hBitmap, 100, &pt);
		}
		m_bDragging = true;							// to know when dragging over our own window
		pDataSrc->DoDragDropEx(DROPEFFECT_COPY);
		pDataSrc->InternalRelease();
		m_bDragging = false;
		bHandled = true;
	}
	if (!bHandled)
		CStatic::OnLButtonDown(nFlags, point);
}
開發者ID:halx99,項目名稱:OleDataDemo,代碼行數:54,代碼來源:MyStatic.cpp

示例15: GetObject

void CBitmapEx::SethBitmap(const TCHAR* szFileName)
{
	_hBitmap = (HBITMAP)LoadImage(
		NULL,			//hInstance=NULL lay cua so hien tai
		szFileName,		//File can lay hinh
		IMAGE_BITMAP,	//loai la bitmap
		0,
		0,
		LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE
		);
	GetObject(hGethBitmap(), sizeof(BITMAP), &GetBitmap());
}
開發者ID:BlackHole02,項目名稱:GST-C,代碼行數:12,代碼來源:bitmap.cpp


注:本文中的GetBitmap函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。