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


C++ TBitmap::GetHeight方法代码示例

本文整理汇总了C++中TBitmap::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ TBitmap::GetHeight方法的具体用法?C++ TBitmap::GetHeight怎么用?C++ TBitmap::GetHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TBitmap的用法示例。


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

示例1: _UpdateProfilePhoto

/**
 * 从profile中读取大头像, 如果本地没有则进行下载
 *
 * \param pApp
 * \param ResponseInfoPhoto
 *
 * \return 
 */
Boolean TPhotosGetAlbumsForm::_UpdateProfilePhoto(TApplication* pApp, tResponseUsersGetInfo* ResponseInfoPhoto)
{

	if(ResponseInfoPhoto == NULL)
		return FALSE;
	
	if(ResponseInfoPhoto->nArraySize > 0)
	{
		TBitmap* pDownLoadBitmap = NULL;
		pDownLoadBitmap = LoadImgByUrl(ResponseInfoPhoto->Array[0].headurl);						
		if(pDownLoadBitmap == NULL)
		{
			RenRenAPICommon_DownloadPhoto(ResponseInfoPhoto->Array[0].headurl, this->GetWindowHwndId(), FEED_PROFILE_IMAGE_INDEX);	
		}
		else
		{
			TMaskButton* pLogo = NULL;
			pLogo = static_cast<TMaskButton*>(GetControlPtr(m_ProfileImageID));
			if(pLogo)
			{
				TRectangle rc;
				TBitmap * pProfileImageTmp = NULL;	//Profile的头像

				pLogo->GetBounds(&rc);
				
				pProfileImageTmp = TBitmap::Create(RR_HEAD_W, RR_HEAD_W, pDownLoadBitmap->GetDepth());
				pProfileImageTmp->QuickZoom(pDownLoadBitmap, TRUE, TRUE,RGBA(0,0,0,255));
				pLogo->SetCaption(TUSTR_Re_NULL,0,0);
				pLogo->SetImage(pProfileImageTmp, (rc.Width()-pProfileImageTmp->GetWidth())/2, (rc.Height()-pProfileImageTmp->GetHeight())/2);
				pLogo->Draw();

				//如果先Desroy,则会崩溃,很奇怪,原因不明,暂时这么处理
				if( pProfileImage != NULL)
				{
					pProfileImage->Destroy();
					pProfileImage = NULL; 							
				}
				pProfileImage = pProfileImageTmp;
				
			}

			//释放图片
			pDownLoadBitmap->Destroy();
			pDownLoadBitmap = NULL; 	
		}
	}

	return TRUE;
}
开发者ID:pengjohn,项目名称:RenRen,代码行数:57,代码来源:RenRenForm_PhotosGetAlbums.cpp

示例2: initWithString

bool CCImage::initWithString(
                               const char *    pText, 
                               int             nWidth/* = 0*/, 
                               int             nHeight/* = 0*/,
                               ETextAlign      eAlignMask/* = kAlignCenter*/,
                               const char *    pFontName/* = nil*/,
                               int             nSize/* = 0*/)
{
    bool bRet = false;
    TUChar* pWText = NULL;
    do 
    {
        CC_BREAK_IF(! pText);
        int nLen = strlen(pText) + 1;
        CC_BREAK_IF(! (pWText = new TUChar[nLen]));
        TUString::StrGBToUnicode(pWText, (Char*)pText);

        BitmapDC& dc = sharedBitmapDC();

        dc.setFont(pFontName, nSize);

        TSize size(nWidth, nHeight);
        dc.getTextExtentPoint(pWText, nLen, size);
        CC_BREAK_IF(! size.Width() || ! size.Height());

        // set style
        UInt32 styles = GUI_API_STYLE_SPECIFY_FORE_COLOR |  GUI_API_STYLE_ROP_MODE_TRANSPARENT |
            GUI_API_STYLE_CLIP_WORDWRAP | GUI_API_STYLE_SPECIFY_BACK_COLOR | GUI_API_STYLE_SPECIFY_FONT;

        switch (eAlignMask)
        {
        case kAlignCenter:
            styles |= GUI_API_STYLE_ALIGNMENT_CENTER | GUI_API_STYLE_ALIGNMENT_MIDDLE;
            break;
        case kAlignTop:
            styles |= GUI_API_STYLE_ALIGNMENT_CENTER | GUI_API_STYLE_ALIGNMENT_TOP;
            break;
        case kAlignTopRight:
            styles |= GUI_API_STYLE_ALIGNMENT_RIGHT | GUI_API_STYLE_ALIGNMENT_TOP;
            break;
        case kAlignRight:
            styles |= GUI_API_STYLE_ALIGNMENT_RIGHT | GUI_API_STYLE_ALIGNMENT_MIDDLE;
            break;
        case kAlignBottomRight:
            styles |= GUI_API_STYLE_ALIGNMENT_RIGHT | GUI_API_STYLE_ALIGNMENT_BOTTOM;
            break;
        case kAlignBottom:
            styles |= GUI_API_STYLE_ALIGNMENT_CENTER | GUI_API_STYLE_ALIGNMENT_BOTTOM;
            break;
        case kAlignBottomLeft:
            styles |= GUI_API_STYLE_ALIGNMENT_LEFT | GUI_API_STYLE_ALIGNMENT_BOTTOM;
            break;
        case kAlignLeft:
            styles |= GUI_API_STYLE_ALIGNMENT_LEFT | GUI_API_STYLE_ALIGNMENT_MIDDLE;
            break;
        case kAlignTopLeft:
            styles |= GUI_API_STYLE_ALIGNMENT_LEFT | GUI_API_STYLE_ALIGNMENT_TOP;
        }

        CC_BREAK_IF(! dc.drawText(pWText, nLen, size, styles));

        // init image information
        TBitmap * pBitmap = dc.getBitmap();
        CC_BREAK_IF(! pBitmap);

        INT32 nWidth	= pBitmap->GetWidth();
        INT32 nHeight	= pBitmap->GetHeight();
        CC_BREAK_IF(nWidth <= 0 || nHeight <= 0);

        INT32 nDataLen = pBitmap->GetRowBytes() * nHeight;
        m_pData.reset(new ccxByte[nDataLen]);
        CC_BREAK_IF(! m_pData.get());
        memcpy((void*) m_pData.get(), pBitmap->GetDataPtr(), nDataLen);

        m_nWidth    = (ccxInt16)nWidth;
        m_nHeight   = (ccxInt16)nHeight;
        m_bHasAlpha = true;
        m_bPreMulti = true;
        m_nBitsPerComponent = pBitmap->GetDepth() / 4;

        bRet = true;
    } while (0);

    if (pWText)
    {
        delete [] pWText;
        pWText = NULL;
    }

    return bRet;
}
开发者ID:,项目名称:,代码行数:91,代码来源:


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