You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
936 B
45 lines
936 B
#include "stdafx.h"
|
|
#include "SRoundImage.h"
|
|
|
|
namespace SOUI
|
|
{
|
|
SRoundImage::SRoundImage()
|
|
{
|
|
}
|
|
|
|
|
|
SRoundImage::~SRoundImage()
|
|
{
|
|
}
|
|
|
|
SAutoRefPtr<IBitmap> SRoundImage::GetRoundImage() const
|
|
{
|
|
if (!m_pSkin) return NULL;
|
|
SAutoRefPtr<IRenderTarget> pRT;
|
|
CRect rc = GetClientRect();
|
|
GETRENDERFACTORY->CreateRenderTarget(&pRT, rc.Width(), rc.Height());
|
|
rc.MoveToXY(0, 0);
|
|
pRT->ClearRect(&rc, 0);
|
|
SAutoRefPtr<IBrush> br;
|
|
pRT->CreateSolidColorBrush(RGBA(0xBA, 0xB3, 0x99, 0xFF), &br);
|
|
pRT->SelectObject(br);
|
|
pRT->FillEllipse(&rc);
|
|
pRT->SetXfermode(kSrcIn_Mode);
|
|
m_pSkin->DrawByIndex(pRT, rc, 0);
|
|
return (IBitmap*)pRT->GetCurrentObject(OT_BITMAP);
|
|
}
|
|
|
|
void SRoundImage::OnPaint(IRenderTarget * pRT)
|
|
{
|
|
if (!m_img) return;
|
|
CRect rc = GetClientRect();
|
|
pRT->DrawBitmap(&rc, m_img, 0, 0);
|
|
}
|
|
|
|
void SRoundImage::OnSize(UINT nType, CSize size)
|
|
{
|
|
__super::OnSize(nType, size);
|
|
m_img = GetRoundImage();
|
|
}
|
|
|
|
}
|
|
|