示例#1
0
// This function sets the bitmap to use to draw the progress bar.
//
// Parameters:
//		[IN]	nBitmap
//				Resource ID of the bitmap to use as background.
//				Pass NULL to remove any previous bitmap.
//		[IN]	bRepaint
//				If TRUE the control will be repainted.
//
// Return value:
//		PROGRESSST_OK
//			Function executed successfully.
//		PROGRESSST_INVALIDRESOURCE
//			The resource specified cannot be found or loaded.
//
DWORD CProgressCtrlST::SetBitmap(int nBitmap, BOOL bRepaint)
{
	HBITMAP		hBitmap			= NULL;
	HINSTANCE	hInstResource	= NULL;

	// Find correct resource handle
	hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nBitmap), RT_BITMAP);

	// Load bitmap
	hBitmap = (HBITMAP)::LoadImage(hInstResource, MAKEINTRESOURCE(nBitmap), IMAGE_BITMAP, 0, 0, 0);

	return SetBitmap(hBitmap, bRepaint);
} // End of SetBitmap
void BattleAnimation::OnBattle2SpriteReady(FileRequestResult* result) {
	if (result->success) {
		BitmapRef bitmap = Cache::Battle2(result->file);
		if (bitmap->GetWidth() == 640) {
			large = true;
		}
		SetBitmap(bitmap);
		SetSrcRect(Rect(0, 0, 0, 0));
	}
	else {
		Output::Warning("Couldn't find animation: %s", result->file.c_str());
	}
}
示例#3
0
文件: keysig.cpp 项目: trieck/source
//
// assign
//
void KeySignature::assign(int index)
{
    int count = sizeof(KeySignatures) / sizeof(tagKeySignature);

    ASSERT(index >= 0);
    ASSERT(index < count);

    m_index = index;

    memcpy(static_cast<tagKeySignature *>(this),
           &KeySignatures[m_index], sizeof(tagKeySignature));
    SetBitmap();
}
示例#4
0
BOOL CDIB::SetBitmap(LPCTSTR lpszRes, HINSTANCE hInst /*= NULL*/ )
{
    HBITMAP hBmp = (HBITMAP)::LoadImage(hInst, lpszRes, IMAGE_BITMAP, 0,0,0);
	if (!hBmp) 
	{
		TRACE0("Unable to LoadImage");
		return FALSE;
	}

	BOOL bResult = SetBitmap(hBmp);
	::DeleteObject(hBmp);
	return bResult;
}
void PalettePanel::SetBitmapFromPalette()
{
	if (!mCurrentPal->IsOk())
	{
		return;
	}

	SetBitmap( mCurrentPal->GeneratePalBitmap() );
	SetGridEnabled( mCurrentPal->IsIndexed() );
	CorrectColourPosition( false );
	CorrectColourPosition( true );
	SetBitmapScale( Palette::BitmapScale[ mCurrentPal->GetPalType() ] );
}
示例#6
0
void CMyButton::OnPaint()
{
    //CPaintDC dc(this); // device context for painting
    // TODO: 在此处添加消息处理程序代码
    // 不为绘图消息调用 CButton::OnPaint()
    CButton::OnPaint();

    if(!m_bPainted)
    {
        SetBitmap(m_U);
        m_bPainted = true;
    }
}
示例#7
0
void CXTPHeaderCtrl::SetBitmap(int iCol, UINT uBitmapID, DWORD dwRemove/*=NULL*/)
{
	if (dwRemove)
	{
		HD_ITEM hdi;
		hdi.mask = HDI_FORMAT;
		GetItem(iCol, &hdi);
		hdi.fmt &= ~dwRemove;
		SetItem(iCol, &hdi);
	}

	SetBitmap(iCol, uBitmapID, FALSE, RGB(192, 192, 192));
}
示例#8
0
void plPlasmaMAXLayer::RefreshBitmaps()
{
    int i, count = GetNumBitmaps(); 

    for( i = 0; i < count; i++ )
    {
        PBBitmap *pbbm = GetPBBitmap(i);
        if (pbbm)
        {
            SetBitmap(&pbbm->bi, i);
        }
    }
}
示例#9
0
// 设置图片
BOOL CControlBaseFont::SetImage(CString strImage)
{
	CStringA strImageA = CEncodingUtil::UnicodeToAnsi(strImage);
	// 通过Skin读取
	CStringA strSkin = "";
	if(strImageA.Find("skin:") == 0)
	{
		strSkin = DuiSystem::Instance()->GetSkin(strImageA);
		if (strSkin.IsEmpty()) return FALSE;
	}else
	{
		strSkin = strImageA;
	}

	if(strSkin.Find(".") != -1)	// 加载图片文件
	{
		CString strImgFile = DuiSystem::GetSkinPath() + CA2T(strSkin, CP_UTF8);
		if(strSkin.Find(":") != -1)
		{
			strImgFile = CA2T(strSkin, CP_UTF8);
		}
		if(!SetBitmap(strImgFile))
		{
			return FALSE;
		}
	}else	// 加载图片资源
	{
		UINT nResourceID = atoi(strSkin);
		if(!SetBitmap(nResourceID, TEXT("PNG")))
		{
			if(!SetBitmap(nResourceID, TEXT("BMP")))
			{
				return FALSE;
			}
		}
	}

	return TRUE;
}
示例#10
0
void Sprite_Character::OnCharSpriteReady(FileRequestResult*) {
	SetBitmap(Cache::Charset(character_name));

	SetOx(chara_width / 2);
	SetOy(chara_height);
	int sx = (character_index % 4) * chara_width * 3;
	int sy = (character_index / 4) * chara_height * 4;
	Rect r;
	r.Set(sx, sy, chara_width * 3, chara_height * 4);
	SetSpriteRect(r);

	Update();
}
示例#11
0
bool wxGenericStaticBitmap::Create(wxWindow *parent, wxWindowID id,
                                   const wxBitmap& bitmap,
                                   const wxPoint& pos, const wxSize& size,
                                   long style, const wxString& name)
{
    if (! wxControl::Create(parent, id, pos, size, style,
                            wxDefaultValidator, name))
        return false;
    m_scaleMode = Scale_None;
    SetBitmap(bitmap);
    Bind(wxEVT_PAINT, &wxGenericStaticBitmap::OnPaint, this);
    return true;
}
示例#12
0
void CSysColStatic::ReloadBitmap(int nImageID)
{
  if (nImageID != -1)
    m_nImageID = nImageID;

  if (m_nImageID == -1)
    return;

  // Need to convert the background colour to the user's
  // selected dialog colour.
  const COLORREF cr = GetSysColor(COLOR_3DFACE);
  const COLORREF cr192 = RGB(192, 192, 192);

  if (!m_imt.IsNull())
    m_imt.Detach();

  m_imt.LoadFromResource(AfxGetInstanceHandle(), m_nImageID);

  // Need to handle images with <= 8bpp (colour tables) and
  // those with higher colour information
  const int noOfCTableEntries = m_imt.GetMaxColorTableEntries();
  if (noOfCTableEntries > 0) {
    RGBQUAD *ctable = new RGBQUAD[noOfCTableEntries]; 
    m_imt.GetColorTable(0, noOfCTableEntries, ctable);

    for (int ic = 0; ic < noOfCTableEntries; ic++) {
      if (ctable[ic].rgbBlue  == 192 &&
          ctable[ic].rgbGreen == 192 &&
          ctable[ic].rgbRed   == 192) {
        ctable[ic].rgbBlue  = GetBValue(cr);
        ctable[ic].rgbGreen = GetGValue(cr);
        ctable[ic].rgbRed   = GetRValue(cr);
        break;
      }
    }
    m_imt.SetColorTable(0, noOfCTableEntries, ctable);
    delete[] ctable;
  } else {
    for (int x = 0; x < m_imt.GetWidth(); x++) {
      for (int y = 0; y < m_imt.GetHeight(); y++) {
        if (m_imt.GetPixel(x, y) == cr192)
          m_imt.SetPixel(x, y, cr);
      }
    }
  }

  HBITMAP hBmpOld = SetBitmap(HBITMAP(m_imt));
  ::DeleteObject(hBmpOld);
  ::DeleteObject(m_hBmp);
  m_hBmp = HBITMAP(m_imt);
}
示例#13
0
void RWinColorPalette::PreSubclassWindow( )
{
	CStatic::PreSubclassWindow();


	// Set the new bitmap into the control
	RBitmapImage&	biPalette	= GetPaletteBitmapImage();
	HBITMAP hOldBitmap = SetBitmap( (HBITMAP) biPalette.GetSystemHandle() );
	
	if (hOldBitmap) 
		::DeleteObject( hOldBitmap );

	m_ptSelected = RWinColorPalette::FindColor( m_crSelected, FALSE );
}
示例#14
0
DWORD CDialogSK::SetBitmap(int nBitmap)
{
    HBITMAP    hBitmap       = NULL;
    HINSTANCE  hInstResource = NULL;
    
    // Find correct resource handle
    hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nBitmap), RT_BITMAP);
    
    // Load bitmap In
    hBitmap = (HBITMAP)::LoadImage(hInstResource, MAKEINTRESOURCE(nBitmap),
                                   IMAGE_BITMAP, 0, 0, 0);
    
    return SetBitmap(hBitmap);
}
// CDlgAppConfig 消息处理程序
void CDlgAppConfig::InitWidowsBG()
{
	//设置任务栏显示窗体的Title信息
	CString str;
	this->GetDlgItemText(STATIC_TITLE,str);
	SetWindowText(str);
	EnableEasyMove(1);                       // 允许移动
	SetBitmap(_T("res/appconfigbg.bmp"));    // 设置背景位图
	SetStyle(LO_STRETCH);                   // 伸缩图片以适合对话框大小
	SetTransparentColor(RGB(0, 255, 0));     // 设置透明色为绿色
	CRect   temprect(0,0,470,450);			 // 设置窗体的初始化大小
	CWnd::SetWindowPos(NULL,0,0,temprect.Width(),temprect.Height(), SWP_NOZORDER|SWP_NOMOVE);
	GetDlgItem(BTN_MAX)->EnableWindow(FALSE);
}
示例#16
0
FX_BOOL CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap)
{
    SetBitmap(pBitmap);
    m_pContext = createContextWithBitmap(pBitmap);
    if (NULL == m_pContext) {
        return FALSE;
    }
    IFX_RenderDeviceDriver* pDriver = FX_NEW CFX_QuartzDeviceDriver(m_pContext, FXDC_DISPLAY);
    if (!pDriver) {
        return FALSE;
    }
    SetDeviceDriver(pDriver);
    return TRUE;
}
//
// Free resources
//
void CChartViewer::OnDestroy() 
{
	CStatic::OnDestroy();
	
	// Free HBITMAP
	HBITMAP b = SetBitmap(0);
	if (0 != b)
		DeleteObject(b);

	// Free hot spot tester
	if (0 != m_hotSpotTester)
		delete m_hotSpotTester;
	m_hotSpotTester = 0;
}
示例#18
0
void ValueCurveButton::UpdateBitmap() {
    if (GetValue()->IsActive())
    {
        RenderNewBitmap();
    }
    else
    {
        if (!disabledBitmap.IsOk()) {
            wxBitmap bmp(valuecurvenotselected_24);
            disabledBitmap = bmp;
        }
        SetBitmap(disabledBitmap);
    }
}
void WIZARD_FPLIB_TABLE::OnPageChanged( wxWizardEvent& aEvent )
{
    SetBitmap( KiBitmap( wizard_add_fplib_icon_xpm ) );
    enableNext( true );

#ifdef BUILD_GITHUB_PLUGIN
    if( GetCurrentPage() == m_githubListDlg )
        setupGithubList();
    else
#endif
        if( GetCurrentPage() == m_fileSelectDlg )
            setupFileSelect();
        else if( GetCurrentPage() == m_reviewDlg )
            setupReview();
}
示例#20
0
void MAS::FrameBorder::SetType(int type) {
   this->type = type;
   switch (type) {
      case 0:
         SetBitmap(Skin::WINLEFT);
         break;

      case 1:
         SetBitmap(Skin::WINRIGHT);
         break;

      case 2:
         SetBitmap(Skin::WINTOP);
         break;

      case 3:
         SetBitmap(Skin::WINBOTTOM);
         break;

      case 4:
         SetBitmap(Skin::WINGRIP);
         break;
   };
}
示例#21
0
wxBitmapDataObject::wxBitmapDataObject( const wxBitmap& rBitmap )
: wxBitmapDataObjectBase( rBitmap )
{
    Init();

    if (m_bitmap.Ok())
    {
#if wxMAC_USE_CORE_GRAPHICS
		SetBitmap( rBitmap );
#else
        m_pictHandle = m_bitmap.GetBitmapData()->GetPictHandle();
        m_pictCreated = false;
#endif
    }
}
示例#22
0
void Sprite_Battler::OnMonsterSpriteReady(FileRequestResult* result) {
	graphic = Cache::Monster(result->file);

	SetOx(graphic->GetWidth() / 2);
	SetOy(graphic->GetHeight() / 2);

	bool hue_change = hue != 0;
	if (hue_change) {
		BitmapRef new_graphic = Bitmap::Create(graphic->GetWidth(), graphic->GetHeight());
		new_graphic->HueChangeBlit(0, 0, *graphic, graphic->GetRect(), hue);
		graphic = new_graphic;
	}

	SetBitmap(graphic);
}
示例#23
0
void CDib::Create32BitFromPicture (CPictureHolder* pPicture, int iWidth, int iHeight)
{
	CRect r;
	CBitmap newBMP;
	CWindowDC dc(NULL);
	CDC tempDC;

	tempDC.CreateCompatibleDC(&dc);

	newBMP.CreateDiscardableBitmap(&dc,iWidth,iHeight);

	CBitmap* pOldBitmap = tempDC.SelectObject(&newBMP);

	r.SetRect(0,0,iWidth,iHeight);
	pPicture->Render(&tempDC,r,r);

	// Create a 32 bit bitmap
	stdex::vector<DWORD> pBits(iWidth * iHeight);

	BITMAPINFO bi;
    bi.bmiHeader.biSize          = sizeof(BITMAPINFOHEADER);
    bi.bmiHeader.biWidth         = iWidth; 
    bi.bmiHeader.biHeight        = iHeight; 
    bi.bmiHeader.biPlanes        = 1; 
    bi.bmiHeader.biBitCount      = 32; 
    bi.bmiHeader.biCompression   = BI_RGB; 
    bi.bmiHeader.biSizeImage     = 0; 
    bi.bmiHeader.biXPelsPerMeter = 0; 
    bi.bmiHeader.biYPelsPerMeter = 0; 
    bi.bmiHeader.biClrUsed       = 0; 
    bi.bmiHeader.biClrImportant  = 0; 
	
	
	SetBitmap(&bi, pBits);

	DWORD* pAr = (DWORD*)GetDIBits();

	// Copy data into the 32 bit dib..
	for(int i=0;i<iHeight;i++)
	{	
		for(int j=0;j<iWidth;j++)
		{
			pAr[(i*iWidth)+j] = FixColorRef(tempDC.GetPixel(j,i));
		}
	}

	tempDC.SelectObject(pOldBitmap);
}
示例#24
0
LTBOOL CBitmapCtrl::Create(ILTClient *pClientDE,  char *lpszNormalBmp,char *lpszSelectedBmp,char *lpszDisabledBmp,
                            CLTGUICommandHandler *pCommandHandler, uint32 dwCommandID, uint32 dwParam1, uint32 dwParam2)
{
	m_pClientDE=pClientDE;
	m_pCommandHandler=pCommandHandler;
	// The transparent color
	SetTransparentColor(SETRGB_T(255,0,255));

	if (SetBitmap(lpszNormalBmp,lpszSelectedBmp,lpszDisabledBmp))
	{
		CLTGUICtrl::Create(dwCommandID,dwParam1,dwParam2);
        return LTTRUE;
	}
	else
        return LTFALSE;
}
示例#25
0
void PicViewCtrl::SetPicYuvBuffer(TComPicYuv* pBuffer, const int w, const int h, const int bit)
{
    m_pBuffer = pBuffer;
    m_iYUVBit = bit;
    wxBitmap bmp(w, h, 24);
    wxBitmap bmpY(w, h, 24);
    wxBitmap bmpU(w, h, 24);
    wxBitmap bmpV(w, h, 24);
    g_tranformYUV2RGB(w, h, m_pBuffer, m_iYUVBit, bmp, bmpY, bmpU, bmpV, true);
    SetLCUSize(wxSize(64, 64));
    SetBitmap(bmp, bmpY, bmpU, bmpV);
    CalMinMaxScaleRate();
    wxCommandEvent event(wxEVT_YUVBUFFER_CHANGED, wxID_ANY);
    event.SetClientData(pBuffer);
    wxPostEvent(m_pPixelCtrl, event);
}
示例#26
0
void CTBMStatic::Init(const UINT nImageID)
{
  // Save resource IDs (Static and required image)
  m_nID = GetDlgCtrlID();

  // Load bitmap
  VERIFY(m_Bitmap.Attach(::LoadImage(
                  ::AfxFindResourceHandle(MAKEINTRESOURCE(nImageID), RT_BITMAP),
                  MAKEINTRESOURCE(nImageID), IMAGE_BITMAP, 0, 0,
                  (LR_DEFAULTSIZE | LR_CREATEDIBSECTION | LR_SHARED))));

  const COLORREF crCOLOR_3DFACE = GetSysColor(COLOR_3DFACE);
  SetBitmapBackground(m_Bitmap, crCOLOR_3DFACE);

  SetBitmap((HBITMAP)m_Bitmap);
}
示例#27
0
// -----------------------------------------------------------------------------
/// Creates a control bar descriptor from the controlbar resource specified in the
/// id parameter. Calls the function ExtractGroups to extract the group counts based
/// on the separator items in the control bar.
TBarDescr::TBarDescr(TResId barResId, TModule* module)
:
  Id(barResId),
  Module(module),
  BarRes(0),
  CelArray(0)
{
  GadgetFunctor = new TGadgetFunctor;
  SetBuilder(TGadget_FUNCTOR(CreateGadget));

  Gadgets = new TBarDescrGdArray(5);

  SetBitmap(barResId, module);

  ExtractGroups();
}
/************************************************************************* 
 * 
 * CopyWindowToDIB() 
 * 
 * Parameters: 
 * 
 * HWND hWnd        - specifies the window 
 * 
 * WORD fPrintArea  - specifies the window area to copy into the device- 
 *                    independent bitmap 
 * 
 * Return Value: 
 * 
 * HDIB             - identifies the device-independent bitmap 
 * 
 * Description: 
 * 
 * This function copies the specified part(s) of the window to a device- 
 * independent bitmap. 
 * 
 ************************************************************************/ 
void CDib::CopyFromWindow(CWnd* wnd, bool bFullWnd) 
{
    CDC *dc;
    if(bFullWnd)
    { /* full window */
		dc = new CWindowDC(wnd);
        //HDC hdc = ::GetWindowDC(wnd->m_hWnd);
        //dc -> Attach(hdc);
    } /* full window */
    else
    { /* client area only */
		dc = new CClientDC(wnd);
        //HDC hdc = ::GetDC(wnd->m_hWnd);
        //dc -> Attach(hdc);
    } /* client area only */

    CDC memDC;
    memDC.CreateCompatibleDC(dc);

    CBitmap bm;
    CRect r;
    if(bFullWnd)
		wnd->GetWindowRect(&r);
    else
        wnd->GetClientRect(&r);

    CString s;
    wnd->GetWindowText(s);
    CSize sz(r.Width(), r.Height());
    bm.CreateCompatibleBitmap(dc, sz.cx, sz.cy);
    CBitmap * oldbm = memDC.SelectObject(&bm);
    memDC.BitBlt(0, 0, sz.cx, sz.cy, dc, 0, 0, SRCCOPY);

	SetBitmap(memDC);
    // Enhancement - Bio/Ahmed. Call OpenClipboard() directly instead of getting parent to do it.
    // wnd->GetParent()->OpenClipboard();
//	wnd->OpenClipboard();

  //  ::EmptyClipboard();
    //::SetClipboardData(CF_BITMAP, bm.m_hObject);
    //CloseClipboard();

    memDC.SelectObject(oldbm);
    bm.Detach();  // make sure bitmap not deleted with CBitmap object

	delete dc;
}
示例#29
0
QuitButton::QuitButton(wxFrame *parent, int id) : wxButton(parent, id, wxString::FromUTF8("Konec"), wxDefaultPosition, wxSize(24,24), wxBORDER_NONE|wxBU_EXACTFIT|wxBU_NOTEXT)
{
 normal = wxBitmap(wxT("RC_closeicon"), wxBITMAP_TYPE_ICO_RESOURCE);//wxBITMAP_TYPE_PNG
 //normal = wxBitmap(wxT("RC_closeicon"), wxBITMAP_TYPE_PNG_RESOURCE);
 focus = wxBitmap(wxT("RC_closeiconF"), wxBITMAP_TYPE_ICO_RESOURCE);
 press = wxBitmap(wxT("RC_closeiconP"), wxBITMAP_TYPE_ICO_RESOURCE);

 SetCursor(wxCursor(wxCURSOR_HAND));
 SetHelpText(wxString::FromUTF8("Ukonèi aplikaci spektrograf."));
 SetToolTip(wxString::FromUTF8("Ukonèit program"));
 SetBitmap(normal);
 SetBitmapCurrent(focus);
 //SetBitmapFocus(focus);
 SetBitmapPressed(press);
 SetBackgroundColour(APP_STYLE_MAINBG/*wxTransparentColour*/);
 Align();
}
示例#30
0
bool wxButton::Create(wxWindow *parent,
                      wxWindowID id,
                      const wxBitmap& bitmap,
                      const wxString &lbl,
                      const wxPoint &pos,
                      const wxSize &size,
                      long style,
                      const wxValidator& validator,
                      const wxString &name)
{
    wxString label(lbl);
    if (label.empty() && wxIsStockID(id))
        label = wxGetStockLabel(id);

    long ctrl_style = style & ~wxBU_ALIGN_MASK;
    ctrl_style = ctrl_style & ~wxALIGN_MASK;

    if((style & wxBU_RIGHT) == wxBU_RIGHT)
        ctrl_style |= wxALIGN_RIGHT;
    else if((style & wxBU_LEFT) == wxBU_LEFT)
        ctrl_style |= wxALIGN_LEFT;
    else
        ctrl_style |= wxALIGN_CENTRE_HORIZONTAL;

    if((style & wxBU_TOP) == wxBU_TOP)
        ctrl_style |= wxALIGN_TOP;
    else if((style & wxBU_BOTTOM) == wxBU_BOTTOM)
        ctrl_style |= wxALIGN_BOTTOM;
    else
        ctrl_style |= wxALIGN_CENTRE_VERTICAL;

    if ( !wxControl::Create(parent, id, pos, size, ctrl_style, validator, name) )
        return false;

    SetLabel(label);

    if (bitmap.IsOk())
        SetBitmap(bitmap); // SetInitialSize called by SetBitmap()
    else
        SetInitialSize(size);

    CreateInputHandler(wxINP_HANDLER_BUTTON);

    return true;
}