本文整理汇总了C++中gdiplus::Color类的典型用法代码示例。如果您正苦于以下问题:C++ Color类的具体用法?C++ Color怎么用?C++ Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Color类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: f
static void DrawFrame2(Graphics &g, RectI r)
{
g.SetCompositingQuality(CompositingQualityHighQuality);
g.SetSmoothingMode(SmoothingModeAntiAlias);
g.SetPageUnit(UnitPixel);
Font f(L"Impact", 40, FontStyleRegular);
CalcLettersLayout(g, &f, r.dx);
Gdiplus::Color bgCol;
bgCol.SetFromCOLORREF(WIN_BG_COLOR);
SolidBrush bgBrush(bgCol);
Rect r2(r.ToGdipRect());
r2.Inflate(1, 1);
g.FillRectangle(&bgBrush, r2);
Font f2(L"Impact", 16, FontStyleRegular);
DrawSumatraLetters(g, &f, &f2, 18.f);
if (gShowOptions)
return;
REAL msgY = (REAL)(r.dy / 2);
if (gMsg)
msgY += DrawMessage(g, gMsg, msgY, (REAL)r.dx, gMsgColor) + 5;
if (gMsgError)
DrawMessage(g, gMsgError, msgY, (REAL)r.dx, COLOR_MSG_FAILED);
}
开发者ID:phishbulb,项目名称:sumatrapdf,代码行数:28,代码来源:Installer.cpp
示例2: TextOutline
void PngOutlineText::TextOutline(
Gdiplus::Color clrText,
Gdiplus::Color clrOutline,
int nThickness)
{
TextOutlineStrategy* pStrat = new TextOutlineStrategy();
pStrat->Init(clrText,clrOutline,nThickness);
if(m_pTextStrategy)
delete m_pTextStrategy;
m_pTextStrategy = pStrat;
TextOutlineStrategy* pStrat2 = new TextOutlineStrategy();
pStrat2->Init(
Gdiplus::Color(clrText.GetAlpha(),255,255,255),
Gdiplus::Color(clrOutline.GetAlpha(),255,255,255),
nThickness);
if(m_pTextStrategyMask)
delete m_pTextStrategyMask;
m_pTextStrategyMask = pStrat2;
}
开发者ID:Olivki,项目名称:foo-wsh-panel-mod,代码行数:25,代码来源:PngOutlineText.cpp
示例3:
DirectionalLight::DirectionalLight(Gdiplus::Color colour, Vector3D direction)
{
_redIntensity = colour.GetRed();
_greenIntensity = colour.GetGreen();
_blueIntensity = colour.GetBlue();
_lightDirection = direction;
}
开发者ID:ElmsPlusPlus,项目名称:Intro3DRenderer,代码行数:7,代码来源:DirectionalLight.cpp
示例4: OnEraseBkgnd
BOOL CImgStatic::OnEraseBkgnd(CDC *pDC)
{
if (m_bZooming)
return TRUE;
if (m_bImageLoaded) {
RECT rc;
GetClientRect(&rc);
// Get Gdiplus graphics object
Gdiplus::Graphics grp(pDC->GetSafeHdc());
// Clear rectangle
Gdiplus::Color gdipColor;
gdipColor.SetFromCOLORREF(GetSysColor(COLOR_3DFACE));
Gdiplus::SolidBrush brush(gdipColor);
grp.FillRectangle(&brush, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
grp.Flush();
return TRUE;
} else {
return CStatic::OnEraseBkgnd(pDC);
}
}
开发者ID:soundsrc,项目名称:pwsafe,代码行数:25,代码来源:ImgStatic.cpp
示例5: GetHRgnFromPNG
HRGN CBtnRoundImg::GetHRgnFromPNG(CString strImagePath)
{
Gdiplus::Bitmap imageBaseRgn(strImagePath);
if (imageBaseRgn.GetLastStatus() != Ok)
{
ASSERT(FALSE);
return NULL;
}
HRGN hRgnTotal = ::CreateRectRgn(0, 0, 0, 0);
ASSERT(NULL != hRgnTotal);
Gdiplus::Color clrPixel; //ÏñËصÄÑÕÉ«
Gdiplus::Status stcGetClr; //״̬
for (int w = imageBaseRgn.GetWidth() - 1; w >= 0; w--)
{
for(int h = imageBaseRgn.GetHeight() - 1; h >= 0; h--)
{
stcGetClr = imageBaseRgn.GetPixel(w, h, &clrPixel);
ASSERT(stcGetClr == Ok);
int iAlpha = clrPixel.GetAlpha();
if (iAlpha == 0){
continue; //͸Ã÷É«²»´¦Àí
}
HRGN hRgnTemp = ::CreateRectRgn(w, h, w + 1, h + 1);
::CombineRgn(hRgnTotal, hRgnTotal, hRgnTemp, RGN_OR);
::DeleteObject(hRgnTemp);
}
}
return hRgnTotal;
}
开发者ID:njustccy,项目名称:NjustTool,代码行数:34,代码来源:CBtnRoundImg.cpp
示例6: OpenBitmapFromFile
void OpenBitmapFromFile(
const WCHAR *pFilename,
void **pBuffer,
uint32_t *width,
uint32_t *height)
{
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr);
Bitmap *bitmap = new Bitmap(pFilename);
*width = bitmap->GetWidth();
*height = bitmap->GetHeight();
*pBuffer = new BYTE[*width * *height * 4]; // width * height * |RGBA|
// The folder 'stb_image' contains a PNG open/close module which
// is far less painful than this is, yo.
Gdiplus::Color clr;
for (uint32_t y = 0, idx = 0; y < *height; ++y)
{
for (uint32_t x = 0; x < *width; ++x, idx += 4)
{
bitmap->GetPixel(x, *height - y - 1, &clr);
((BYTE*)*pBuffer)[idx + 0] = clr.GetBlue();
((BYTE*)*pBuffer)[idx + 1] = clr.GetGreen();
((BYTE*)*pBuffer)[idx + 2] = clr.GetRed();
((BYTE*)*pBuffer)[idx + 3] = clr.GetAlpha();
}
}
delete bitmap;
bitmap = 0;
}
开发者ID:menpo,项目名称:mesa,代码行数:34,代码来源:utils.cpp
示例7: SetTextColor
void TextRenderHdc::SetTextColor(Gdiplus::Color col) {
CrashIf(!hdc);
if (textColor.GetValue() == col.GetValue()) {
return;
}
textColor = col;
::SetTextColor(hdc, col.ToCOLORREF());
}
开发者ID:qingzhengzhuma,项目名称:sumatrapdf,代码行数:8,代码来源:TextRender.cpp
示例8: PixelColour
Gwen::Color GDIPlus::PixelColour( Gwen::Texture* pTexture, unsigned int x, unsigned int y, const Gwen::Color& col_default )
{
Gdiplus::Bitmap* pImage = (Gdiplus::Bitmap*) pTexture->data;
if ( !pImage ) return col_default;
Gdiplus::Color c;
pImage->GetPixel( x, y, &c );
return Gwen::Color( c.GetR(), c.GetG(), c.GetB(), c.GetA() );
}
开发者ID:charliesome,项目名称:battlecars,代码行数:10,代码来源:GDIPlus.cpp
示例9:
void CSettingsRevisionGraphColors::ApplyColor
( CMFCColorButton& button
, CColors::GDIPlusColor color
, DWORD alpha)
{
COLORREF value = button.GetColor() == -1
? button.GetAutomaticColor()
: button.GetColor();
Gdiplus::Color temp;
temp.SetFromCOLORREF (value);
m_Colors.SetColor (color, (temp.GetValue() & 0xffffff) + (alpha << 24));
}
开发者ID:svn2github,项目名称:tortoisesvn,代码行数:13,代码来源:SettingsRevGraphColors.cpp
示例10: OnPenColor
LRESULT CMainFrame::OnPenColor(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
// allow users to choose an arbitrary pen color
Gdiplus::Color currentColor;
m_view.m_Pen.GetColor(¤tColor);
COLORREF color = currentColor.ToCOLORREF();
CColorDialog test(color);
test.DoModal();
color = test.GetColor();
Gdiplus::Color newColor(GetRValue(color), GetGValue(color), GetBValue(color));
m_view.m_Pen.SetColor(newColor);
return 0;
}
开发者ID:Rancho06,项目名称:ProCppProjects,代码行数:13,代码来源:MainFrm.cpp
示例11: LoadPixel
//===============================================
void LoadPixel(UINT ofs, BYTE* rgba)
//===============================================
{
// get pixel of current image by offset ofs
UINT x,y;
Gdiplus::Color col;
PixelToCoord(ofs, &x, &y);
img->GetPixel(x,y, &col);
rgba[0] = col.GetR();
rgba[1] = col.GetG();
rgba[2] = col.GetB();
rgba[3] = col.GetA();
}
开发者ID:pngcrypt,项目名称:png-crypt,代码行数:15,代码来源:main.cpp
示例12: ColorsEqual
bool ColorsEqual(Gdiplus::Color a, Gdiplus::Color b)
{
return a.GetR() == b.GetR() &&
a.GetG() == b.GetG() &&
a.GetB() == b.GetB() &&
a.GetA() == b.GetA();
}
开发者ID:maroneal1,项目名称:SnowflakeAnimation,代码行数:7,代码来源:CPolyDrawableTest.cpp
示例13: Extrude
void OutlineText::Extrude(
Gdiplus::Color color,
int nThickness,
Gdiplus::Point ptOffset)
{
ExtrudeStrategy* pStrat = new ExtrudeStrategy();
pStrat->Init(Gdiplus::Color(0,0,0,0),color,nThickness,ptOffset.X,ptOffset.Y);
m_clrShadow = color;
if(m_pFontBodyShadow)
delete m_pFontBodyShadow;
ExtrudeStrategy* pFontBodyShadow = new ExtrudeStrategy();
pFontBodyShadow->Init(Gdiplus::Color(color.GetA(),255,255),Gdiplus::Color(0,0,0,0),0,ptOffset.X,ptOffset.Y);
m_pFontBodyShadow = pFontBodyShadow;
if(m_pShadowStrategy)
delete m_pShadowStrategy;
m_ptShadowOffset = ptOffset;
m_pShadowStrategy = pStrat;
m_bExtrudeShadow = true;
m_bDiffuseShadow = false;
m_nShadowThickness = nThickness;
}
开发者ID:lorichen,项目名称:xgame,代码行数:26,代码来源:OutlineText.cpp
示例14: Gdip_RemoveAlpha
// hack for stupid GDIplus
void Gdip_RemoveAlpha(Gdiplus::Bitmap& source, Gdiplus::Color color )
{
using namespace Gdiplus;
Rect r( 0, 0, source.GetWidth(),source.GetHeight() );
BitmapData bdSrc;
source.LockBits( &r, ImageLockModeRead , PixelFormat32bppARGB,&bdSrc);
BYTE* bpSrc = (BYTE*)bdSrc.Scan0;
//bpSrc += (int)sourceChannel;
for ( int i = r.Height * r.Width; i > 0; i-- )
{
BGRA_COLOR * c = (BGRA_COLOR *)bpSrc;
if(c->a!=255)
{
//c = 255;
DWORD * d= (DWORD*)bpSrc;
*d= color.ToCOLORREF();
c ->a= 255;
}
bpSrc += 4;
}
source.UnlockBits( &bdSrc );
}
开发者ID:vladios13,项目名称:image-uploader,代码行数:30,代码来源:Utils.cpp
示例15: DiffusedShadow
void PngOutlineText::DiffusedShadow(
Gdiplus::Color color,
int nThickness,
Gdiplus::Point ptOffset)
{
DiffusedShadowStrategy* pStrat = new DiffusedShadowStrategy();
pStrat->Init(Gdiplus::Color(0,0,0,0),color,nThickness,false);
if(m_pShadowStrategy)
delete m_pShadowStrategy;
m_ptShadowOffset = ptOffset;
m_pShadowStrategy = pStrat;
DiffusedShadowStrategy* pStrat2 = new DiffusedShadowStrategy();
pStrat2->Init(
Gdiplus::Color(0,0,0,0),
Gdiplus::Color(color.GetAlpha(),255,255,255),
nThickness,
true);
if(m_pShadowStrategyMask)
delete m_pShadowStrategyMask;
m_pShadowStrategyMask = pStrat2;
m_clrShadow = color;
if(m_pFontBodyShadow)
delete m_pFontBodyShadow;
DiffusedShadowStrategy* pFontBodyShadow = new DiffusedShadowStrategy();
pFontBodyShadow->Init(Gdiplus::Color(255,255,255),Gdiplus::Color(0,0,0,0),nThickness,false);
m_pFontBodyShadow = pFontBodyShadow;
if(m_pFontBodyShadowMask)
delete m_pFontBodyShadowMask;
DiffusedShadowStrategy* pFontBodyShadowMask = new DiffusedShadowStrategy();
pFontBodyShadowMask->Init(Gdiplus::Color(color.GetAlpha(),255,255,255),Gdiplus::Color(0,0,0,0),
nThickness,false);
m_pFontBodyShadowMask = pFontBodyShadowMask;
m_bDiffuseShadow = true;
m_nShadowThickness = nThickness;
}
开发者ID:Olivki,项目名称:foo-wsh-panel-mod,代码行数:47,代码来源:PngOutlineText.cpp
示例16: ClearImage
void CImgStatic::ClearImage()
{
// Get rid of image and return it back to empty CStatic control
FreeStream();
RECT rc;
GetClientRect(&rc);
Gdiplus::Graphics grp(GetDC()->GetSafeHdc());
// Clear rectangle
Gdiplus::Color gdipColor;
gdipColor.SetFromCOLORREF(GetSysColor(COLOR_3DFACE));
Gdiplus::SolidBrush brush(gdipColor);
grp.FillRectangle(&brush, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
grp.Flush();
}
开发者ID:soundsrc,项目名称:pwsafe,代码行数:17,代码来源:ImgStatic.cpp
示例17: SetColor
void CColors::SetColor (GDIPlusColorTable id, int index, Gdiplus::Color color)
{
CRegDWORDList* setting = GetRegistrySetting (id);
if (setting == NULL)
return;
(*setting)[index] = color.GetValue();
}
开发者ID:TortoiseGit,项目名称:tortoisesvn,代码行数:8,代码来源:Colors.cpp
示例18: GetCharMaxX
int DxFont::GetCharMaxX(Gdiplus::Bitmap & charBitmap)
{
int width = charBitmap.GetWidth( );
int height = charBitmap.GetHeight( );
for(int x = width - 1; x >= 0; --x )
{
for(int y = 0; y < height; ++y)
{
Gdiplus::Color color;
charBitmap.GetPixel(x, y, &color);
if( color.GetAlpha() > 0)
return x;
}
}
return width - 1;
}
开发者ID:quaikohc,项目名称:dx11framework,代码行数:19,代码来源:font_renderer_gdi.cpp
示例19:
// if an identical pen is set up already, find and use it
// if no such pen is set up, create one and save it for future use
std::shared_ptr<Gdiplus::Pen> PenWeight::GetPen(Gdiplus::Color color, float width)
{
std::stringstream newStream;
newStream << "(" << color.GetRed() << ",";
newStream << color.GetGreen() << ",";
newStream << color.GetBlue() << ");";
newStream << std::setprecision(2) << width;
std::string newString = newStream.str();
// when an identical pen is found
if (this->pens.find(newString) != this->pens.end()) {
return pens.at(newString);
}
// no identical pens are found
else {
std::shared_ptr<Gdiplus::Pen> newPen = std::make_shared<Gdiplus::Pen>(color, width);
pens.insert(std::pair<std::string, std::shared_ptr<Gdiplus::Pen>>(newString, newPen));
return newPen;
}
}
开发者ID:Rancho06,项目名称:ProCppProjects,代码行数:21,代码来源:PenWeight.cpp
示例20: drawGridLine
void PointGridIndex::drawGridLine(Gdiplus::Color color, MapDrawer& md)
{
//////////////////////////////////////////////////////////////////////////
///在图片上画出网格线
//////////////////////////////////////////////////////////////////////////
Gdiplus::ARGB argb = Gdiplus::Color::MakeARGB(90, color.GetR(), color.GetG(), color.GetB());
color.SetValue(argb);
double delta = 0.0000001;
for (int i = 0; i < gridHeight; i++)
{
double lat = area->minLat + gridSizeDeg * i;
md.drawLine(color, lat, area->minLon + delta, lat, area->maxLon - delta);
}
for (int i = 0; i < gridWidth; i++)
{
double lon = area->minLon + gridSizeDeg * i;
md.drawLine(color, area->minLat + delta, lon, area->maxLat - delta, lon);
}
}
开发者ID:mapmatching,项目名称:Lab,代码行数:19,代码来源:PointGridIndex.cpp
注:本文中的gdiplus::Color类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论