資源簡(jiǎn)介
模擬實(shí)現(xiàn)Windows的氣泡屏保,利用win32 API實(shí)現(xiàn)透明氣泡效果,氣泡效果沒(méi)有Windows的美觀,但是也足夠好看。
代碼片段和文件信息
#include?“CBubble.h“
#include?
#include?
int?GetEncoderClsid(const?WCHAR*?format?CLSID*?pClsid);
CBubble::CBubble(const?Point&pt?Color&?color?int?radius)?:m_x(pt.X)?m_y(pt.Y)
m_vx((rand()?%?10?-?5)/2)
m_vy((rand()?%?10?-?5)/2)
m_radius(radius)?m_color(color)
{
}
CBubble::~CBubble()
{
}
void?CBubble::paint(HDC?hdc)
{
Bitmap?bmp(2*m_radius?2*m_radius?PixelFormat32bppARGB);
Graphics?g(&bmp);
g.Clear(Color(0?0?0?0));
g.SetSmoothingMode(SmoothingModeAntiAlias);
GraphicsPath?path;
path.AddEllipse(0?0?2*m_radius?2*m_radius);
PathGradientBrush?PGBrush(&path);
PGBrush.SetCenterColor(Color(200?255?255?255));
Color?colors[]?=?{m_color};
int?count?=?1;
PGBrush.SetSurroundColors(colors?&count);
PGBrush.SetCenterPoint(Point(m_radius?m_radius));
g.FillEllipse(&PGBrush?0?0?2*m_radius?2*m_radius);
g.DrawEllipse(&Pen(m_color)?0?0?2*m_radius?2*m_radius);
//g.FillRectangle(&PGBrush?0?0?200?200);
Graphics?graph(hdc);
graph.TranslateTransform(m_x?m_y);
graph.SetSmoothingMode(SmoothingModeAntiAlias);
graph.DrawImage(&bmp?0?0);
//CLSID?pngClsid;
//GetEncoderClsid(L“image/png“?&pngClsid);
//bmp.Save(L“Mosaic2.png“?&pngClsid?NULL);
//Graphics?graph(hdc);
//graph.SetSmoothingMode(SmoothingModeAntiAlias);
//for?(int?i?=?0;?i?200;?i++)
//{
// float?x?=?100;
// float?y?=?100;
// float?R?=?i;
// RectF?rect(x-R?y-R?2*R?2*R);
// graph.DrawEllipse(&Pen(Color(255?200?200?100))?rect);
//}
//graph.DrawImage(&bmp?0?0);
//Graphics?graph(hdc);
//graph.SetSmoothingMode(SmoothingModeHighQuality);
//Bitmap?bmp(L“Mosaic2.png“);
//graph.DrawImage(&bmp?0?0);
//Graphics?graph(hdc);
//graph.Clear(Color(0?0?0?0));
//graph.SetSmoothingMode(SmoothingModeAntiAlias);
//LinearGradientBrush?lBrush(Point(100?100)?Point(200?200)?Color(200?200?100100)?Color(0?200?100100));
////graph.FillEllipse(&lBrush?Rect(100?100?200?200));
//Graphics?graphics(hdc);
//graphics.Clear(Color(0?255?255?255));
//GraphicsPath?path;
//path.AddEllipse(0?0?200?200);
//PathGradientBrush?PGBrush(&path);
//PGBrush.SetCenterColor(Color(255?255?2?255));
//Color?colors[]?=?{?Color(255?255?2?255)?};
//int?count?=?1;
//PGBrush.SetSurroundColors(colors?&count);
//PGBrush.SetCenterPoint(Point(100?100));
//graphics.FillRectangle(&PGBrush?0?0?200?200);
//SolidBrush?brush(Color(10?200?200?250));
//graphics.TranslateTransform(100?100);
//graphics.FillRectangle(&brush?10?200?200?200);
}
int?GetEncoderClsid(const?WCHAR*?format?CLSID*?pClsid)
{
UINT??num?=?0;??????????//?number?of?image?encoders
UINT??size?=?0;?????????//?size?of?the?image?encoder?array?in?bytes
ImageCodecInfo*?pImageCodecInfo?=?NULL;
GetImageEncodersSize(&num?&size);
if?(size?==?0)
return?-1;??//?Failure
pImageCodecInfo?=?(ImageCodecInfo*)(mal
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件?????????47??2018-09-10?09:31??炫彩氣泡\.git\COMMITMESSAGE
?????文件?????????46??2018-09-10?09:31??炫彩氣泡\.git\COMMIT_EDITMSG
?????文件????????130??2018-09-10?09:30??炫彩氣泡\.git\config
?????文件?????????73??2018-09-10?09:30??炫彩氣泡\.git\desc
?????文件?????????23??2018-09-10?09:30??炫彩氣泡\.git\HEAD
?????文件????????478??2018-09-10?09:30??炫彩氣泡\.git\hooks\applypatch-msg.sample
?????文件????????896??2018-09-10?09:30??炫彩氣泡\.git\hooks\commit-msg.sample
?????文件???????3327??2018-09-10?09:30??炫彩氣泡\.git\hooks\fsmonitor-watchman.sample
?????文件????????189??2018-09-10?09:30??炫彩氣泡\.git\hooks\post-update.sample
?????文件????????424??2018-09-10?09:30??炫彩氣泡\.git\hooks\pre-applypatch.sample
?????文件???????1642??2018-09-10?09:30??炫彩氣泡\.git\hooks\pre-commit.sample
?????文件???????1348??2018-09-10?09:30??炫彩氣泡\.git\hooks\pre-push.sample
?????文件???????4898??2018-09-10?09:30??炫彩氣泡\.git\hooks\pre-reba
?????文件????????544??2018-09-10?09:30??炫彩氣泡\.git\hooks\pre-receive.sample
?????文件???????1492??2018-09-10?09:30??炫彩氣泡\.git\hooks\prepare-commit-msg.sample
?????文件???????3610??2018-09-10?09:30??炫彩氣泡\.git\hooks\update.sample
?????文件???????4832??2018-09-10?09:31??炫彩氣泡\.git\index
?????文件????????240??2018-09-10?09:30??炫彩氣泡\.git\info\exclude
?????文件????????175??2018-09-10?09:31??炫彩氣泡\.git\logs\HEAD
?????文件????????175??2018-09-10?09:31??炫彩氣泡\.git\logs\refs\heads\master
?????文件????????186??2018-09-10?09:31??炫彩氣泡\.git\ob
?????文件????????668??2018-09-10?09:31??炫彩氣泡\.git\ob
?????文件????????683??2018-09-10?09:31??炫彩氣泡\.git\ob
?????文件?????240661??2018-09-10?09:31??炫彩氣泡\.git\ob
?????文件????????386??2018-09-10?09:31??炫彩氣泡\.git\ob
?????文件????????102??2018-09-10?09:31??炫彩氣泡\.git\ob
?????文件???????1422??2018-09-10?09:31??炫彩氣泡\.git\ob
?????文件????????366??2018-09-10?09:31??炫彩氣泡\.git\ob
?????文件???????7329??2018-09-10?09:30??炫彩氣泡\.git\ob
?????文件????????413??2018-09-10?09:30??炫彩氣泡\.git\ob
............此處省略158個(gè)文件信息
評(píng)論
共有 條評(píng)論