本文整理汇总了C++中gdiplus::Graphics::SetSmoothingMode方法的典型用法代码示例。如果您正苦于以下问题:C++ Graphics::SetSmoothingMode方法的具体用法?C++ Graphics::SetSmoothingMode怎么用?C++ Graphics::SetSmoothingMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gdiplus::Graphics
的用法示例。
在下文中一共展示了Graphics::SetSmoothingMode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetHighQuality
void Graphics::SetHighQuality(bool t) {
Gdiplus::Graphics* g = reinterpret_cast<Gdiplus::Graphics*>(_private);
if(t) {
g->SetSmoothingMode(Gdiplus::SmoothingModeHighQuality);
g->SetCompositingQuality(Gdiplus::CompositingQualityHighQuality);
}
else {
g->SetSmoothingMode(Gdiplus::SmoothingModeHighSpeed);
g->SetCompositingQuality(Gdiplus::CompositingQualityHighSpeed);
}
}
示例2: init
st init(HDC hdc)
{
Gdiplus::GdiplusStartupInput gdiplus_input;
if(Gdiplus::GdiplusStartup(&gdiplus_token, &gdiplus_input, NULL) != Gdiplus::Status::Ok) return FALSE;
hdc = hdc;
graphics = new Gdiplus::Graphics(hdc);
if(graphics == NULL) return FALSE;
graphics->SetSmoothingMode(Gdiplus::SmoothingModeHighQuality);
color = new Gdiplus::Color();
if(color == NULL)return FALSE;
font = new Gdiplus::Font(L"ÐÂËÎÌå", 15, Gdiplus::FontStyle::FontStyleRegular);
if(font == NULL) return FALSE;
return TRUE;
}
示例3: SetResolution
void GuiEngine::SetResolution(Vec2u& size)
{
DeleteObject(memBitmap);
DeleteDC(hdc);
DeleteDC(memHDC);
Gdiplus::Graphics* graphics = Gdiplus::Graphics::FromHWND((HWND)targetWindow->GetNativeHandle());
graphics->SetSmoothingMode(Gdiplus::SmoothingModeDefault);
hdc = graphics->GetHDC();
memHDC = CreateCompatibleDC(hdc);
memBitmap = CreateCompatibleBitmap(hdc, size.x, size.y);
SelectObject(memHDC, memBitmap);
gdiGraphics = Gdiplus::Graphics::FromHDC(memHDC);
}
示例4: DrawString
bool PngOutlineText::DrawString(
Gdiplus::Graphics* pGraphics,
Gdiplus::FontFamily* pFontFamily,
Gdiplus::FontStyle fontStyle,
int nfontSize,
const wchar_t*pszText,
Gdiplus::Rect rtDraw,
Gdiplus::StringFormat* pStrFormat)
{
if(!pGraphics) return false;
if(m_bEnableShadow&&m_pBkgdBitmap&&m_pFontBodyShadow&&m_pShadowStrategy&&m_pShadowStrategyMask)
{
Gdiplus::Graphics* pGraphicsMask=NULL;
Gdiplus::Bitmap* pBmpMask=NULL;
Gdiplus::Graphics* pGraphicsDrawn=NULL;
Gdiplus::Bitmap* pBmpDrawn=NULL;
bool b = RenderTransShadowA( pGraphics, &pGraphicsMask, &pBmpMask, &pGraphicsDrawn, &pBmpDrawn);
if(!b) return false;
b = RenderFontShadow(
pGraphicsDrawn,
pGraphicsMask,
pBmpDrawn,
pBmpMask,
pFontFamily,
fontStyle,
nfontSize,
pszText,
Gdiplus::Rect(rtDraw.X+m_ptShadowOffset.X, rtDraw.Y+m_ptShadowOffset.Y,rtDraw.Width,rtDraw.Height),
pStrFormat);
if(!b)
{
delete pGraphicsMask;
delete pGraphicsDrawn;
delete pBmpDrawn;
return false;
}
b = RenderTransShadowB( pGraphics, pGraphicsMask, pBmpMask, pGraphicsDrawn, pBmpDrawn);
delete pGraphicsMask;
delete pGraphicsDrawn;
delete pBmpDrawn;
if(!b) return false;
}
if(m_pTextStrategy&&m_pTextStrategyMask)
{
Gdiplus::Graphics* pGraphicsPng = new Gdiplus::Graphics((Gdiplus::Image*)(m_pPngBitmap));
pGraphicsPng->SetCompositingMode(pGraphics->GetCompositingMode());
pGraphicsPng->SetCompositingQuality(pGraphics->GetCompositingQuality());
pGraphicsPng->SetInterpolationMode(pGraphics->GetInterpolationMode());
pGraphicsPng->SetSmoothingMode(pGraphics->GetSmoothingMode());
pGraphicsPng->SetTextRenderingHint(pGraphics->GetTextRenderingHint());
pGraphicsPng->SetPageUnit(pGraphics->GetPageUnit());
pGraphicsPng->SetPageScale(pGraphics->GetPageScale());
bool b = m_pTextStrategy->DrawString(
pGraphicsPng,
pFontFamily,
fontStyle,
nfontSize,
pszText,
rtDraw,
pStrFormat);
delete pGraphicsPng;
if(!b)
return false;
}
//pGraphics->DrawImage(m_pPngBitmap,0,0,m_pPngBitmap->GetWidth(),m_pPngBitmap->GetHeight());
return true;
}
示例5: RenderFontShadow
bool PngOutlineText::RenderFontShadow(
Gdiplus::Graphics* pGraphicsDrawn,
Gdiplus::Graphics* pGraphicsMask,
Gdiplus::Bitmap* pBitmapDrawn,
Gdiplus::Bitmap* pBitmapMask,
Gdiplus::FontFamily* pFontFamily,
Gdiplus::FontStyle fontStyle,
int nfontSize,
const wchar_t*pszText,
Gdiplus::Rect rtDraw,
Gdiplus::StringFormat* pStrFormat)
{
if(!pGraphicsDrawn||!pGraphicsMask||!pBitmapDrawn||!pBitmapMask) return false;
Gdiplus::Bitmap* pBitmapShadowMask =
m_pPngBitmap->Clone(0, 0, m_pPngBitmap->GetWidth(), m_pPngBitmap->GetHeight(), PixelFormat32bppARGB);
Gdiplus::Graphics* pGraphicsShadowMask = new Gdiplus::Graphics((Gdiplus::Image*)(pBitmapShadowMask));
Gdiplus::SolidBrush brushBlack(Gdiplus::Color(0,0,0));
pGraphicsShadowMask->FillRectangle(&brushBlack, 0, 0, m_pPngBitmap->GetWidth(), m_pPngBitmap->GetHeight() );
pGraphicsShadowMask->SetCompositingMode(pGraphicsDrawn->GetCompositingMode());
pGraphicsShadowMask->SetCompositingQuality(pGraphicsDrawn->GetCompositingQuality());
pGraphicsShadowMask->SetInterpolationMode(pGraphicsDrawn->GetInterpolationMode());
pGraphicsShadowMask->SetSmoothingMode(pGraphicsDrawn->GetSmoothingMode());
pGraphicsShadowMask->SetTextRenderingHint(pGraphicsDrawn->GetTextRenderingHint());
pGraphicsShadowMask->SetPageUnit(pGraphicsDrawn->GetPageUnit());
pGraphicsShadowMask->SetPageScale(pGraphicsDrawn->GetPageScale());
bool b = false;
b = m_pFontBodyShadowMask->DrawString(
pGraphicsMask,
pFontFamily,
fontStyle,
nfontSize,
pszText,
rtDraw,
pStrFormat);
if(!b) return false;
b = m_pShadowStrategyMask->DrawString(
pGraphicsShadowMask,
pFontFamily,
fontStyle,
nfontSize,
pszText,
rtDraw,
pStrFormat);
if(!b) return false;
b = m_pFontBodyShadow->DrawString(
pGraphicsDrawn,
pFontFamily,
fontStyle,
nfontSize,
pszText,
rtDraw,
pStrFormat);
if(!b) return false;
b = m_pShadowStrategy->DrawString(
pGraphicsDrawn,
pFontFamily,
fontStyle,
nfontSize,
pszText,
rtDraw,
pStrFormat);
if(!b) return false;
UINT* pixelsDest = NULL;
UINT* pixelsMask = NULL;
UINT* pixelsShadowMask = NULL;
using namespace Gdiplus;
BitmapData bitmapDataDest;
BitmapData bitmapDataMask;
BitmapData bitmapDataShadowMask;
Rect rect(0, 0, m_pBkgdBitmap->GetWidth(), m_pBkgdBitmap->GetHeight() );
pBitmapDrawn->LockBits(
&rect,
ImageLockModeWrite,
PixelFormat32bppARGB,
&bitmapDataDest );
pBitmapMask->LockBits(
&rect,
ImageLockModeWrite,
PixelFormat32bppARGB,
&bitmapDataMask );
pBitmapShadowMask->LockBits(
&rect,
//.........这里部分代码省略.........
示例6: assert
static Image *ReadEMFImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Gdiplus::Bitmap
*bitmap;
Gdiplus::BitmapData
bitmap_data;
Gdiplus::GdiplusStartupInput
startup_input;
Gdiplus::Graphics
*graphics;
Gdiplus::Image
*source;
Gdiplus::Rect
rect;
GeometryInfo
geometry_info;
Image
*image;
MagickStatusType
flags;
register Quantum
*q;
register ssize_t
x;
ssize_t
y;
ULONG_PTR
token;
unsigned char
*p;
wchar_t
fileName[MagickPathExtent];
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
image=AcquireImage(image_info,exception);
if (Gdiplus::GdiplusStartup(&token,&startup_input,NULL) !=
Gdiplus::Status::Ok)
ThrowReaderException(CoderError, "GdiplusStartupFailed");
MultiByteToWideChar(CP_UTF8,0,image->filename,-1,fileName,MagickPathExtent);
source=Gdiplus::Image::FromFile(fileName);
if (source == (Gdiplus::Image *) NULL)
{
Gdiplus::GdiplusShutdown(token);
ThrowReaderException(FileOpenError,"UnableToOpenFile");
}
image->resolution.x=source->GetHorizontalResolution();
image->resolution.y=source->GetVerticalResolution();
image->columns=(size_t) source->GetWidth();
image->rows=(size_t) source->GetHeight();
if (image_info->density != (char *) NULL)
{
flags=ParseGeometry(image_info->density,&geometry_info);
image->resolution.x=geometry_info.rho;
image->resolution.y=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
image->resolution.y=image->resolution.x;
if ((image->resolution.x > 0.0) && (image->resolution.y > 0.0))
{
image->columns=(size_t) floor((Gdiplus::REAL) source->GetWidth() /
source->GetHorizontalResolution() * image->resolution.x + 0.5);
image->rows=(size_t)floor((Gdiplus::REAL) source->GetHeight() /
source->GetVerticalResolution() * image->resolution.y + 0.5);
}
}
bitmap=new Gdiplus::Bitmap((INT) image->columns,(INT) image->rows,
PixelFormat32bppARGB);
graphics=Gdiplus::Graphics::FromImage(bitmap);
graphics->SetInterpolationMode(Gdiplus::InterpolationModeHighQualityBicubic);
graphics->SetSmoothingMode(Gdiplus::SmoothingModeHighQuality);
graphics->SetTextRenderingHint(Gdiplus::TextRenderingHintClearTypeGridFit);
graphics->Clear(Gdiplus::Color((BYTE) ScaleQuantumToChar(
image->background_color.alpha),(BYTE) ScaleQuantumToChar(
image->background_color.red),(BYTE) ScaleQuantumToChar(
image->background_color.green),(BYTE) ScaleQuantumToChar(
image->background_color.blue)));
graphics->DrawImage(source,0,0,(INT) image->columns,(INT) image->rows);
delete graphics;
//.........这里部分代码省略.........
示例7:
Graphics::Graphics(HDC dc) {
Gdiplus::Graphics* g = new Gdiplus::Graphics(dc);
g->SetSmoothingMode(Gdiplus::SmoothingModeHighQuality);
g->SetCompositingQuality(Gdiplus::CompositingQualityHighQuality);
_private = reinterpret_cast<void*>(g);
}