Esempio n. 1
0
 LRESULT SSkinImgFrame2::OnAttrSrc(const SStringW & strValue,BOOL bLoading)
 {
     int iPos = strValue.Find(L'{');
     if(iPos==-1) return E_FAIL;
     m_strImgKey = strValue.Left(iPos);
     SStringW strRgn = strValue.Right(strValue.GetLength()-iPos);
     if(swscanf(strRgn,L"{%d,%d,%d,%d}",&m_rcImg.left,&m_rcImg.top,&m_rcImg.right,&m_rcImg.bottom)!=4)
     {
         CPoint pt;
         CSize sz;
         if(swscanf(strRgn,L"{%d,%d,@%d,@%d}",&pt.x,&pt.y,&sz.cx,&sz.cy)!=4)
             return E_FAIL;
         m_rcImg = CRect(pt,sz);
     }
     
     IMGPOOL::CPair * p = s_imgPool.Lookup(m_strImgKey);
     if(p)
     {
         SSkinImgFrame::SetImage(p->m_value);
         p->m_value->AddRef();
     }else
     {
         IBitmap *pImg=LOADIMAGE2(m_strImgKey);
         if(!pImg) return E_FAIL;
         s_imgPool[m_strImgKey]=pImg;
         SSkinImgFrame::SetImage(pImg);
     }
     return S_OK;
 }
Esempio n. 2
0
	bool SDemoSkin::SetImage(SStringT imgfile)
	{
		m_bIsColor = false;
		m_FilePath = imgfile;
		IBitmap *image = LOADIMAGE2(L"file:" + imgfile);
		if (image)
		{
			SetImage(image);
			image->Release();
			return true;
		}
		return false;
	}