本文整理汇总了C++中webcore::Color::alpha方法的典型用法代码示例。如果您正苦于以下问题:C++ Color::alpha方法的具体用法?C++ Color::alpha怎么用?C++ Color::alpha使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webcore::Color
的用法示例。
在下文中一共展示了Color::alpha方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawArc
// TODO: draw points instead of lines for nicer circles
inline void drawArc(EA::Raster::ISurface* pSurface, const WebCore::Color color, int zone, int xc, int yc, float& x0, float& y0, float x1, float y1, bool doSwap = true)
{
EA::Raster::IEARaster* pRaster =EA::WebKit::GetEARasterInstance();
// Mean First draw => will not draw just a point.
if (x0 != x1)
{
switch(zone)
{
case 0:
pRaster->LineRGBA(pSurface,
static_cast<int>(xc + ceilf(x0)), static_cast<int>(yc - ceilf(y0)),
static_cast<int>(xc + ceilf(x1)), static_cast<int>(yc - ceilf(y1)),
color.red(),
color.green(),
color.blue(),
color.alpha());
break;
case 1:
pRaster->LineRGBA(pSurface,
static_cast<int>(xc - ceilf(y0)), static_cast<int>(yc - ceilf(x0)),
static_cast<int>(xc - ceilf(y1)), static_cast<int>(yc - ceilf(x1)),
color.red(),
color.green(),
color.blue(),
color.alpha());
break;
case 2:
pRaster->LineRGBA(pSurface,
static_cast<int>(xc - ceilf(x0)), static_cast<int>(yc + ceilf(y0)),
static_cast<int>(xc - ceilf(x1)), static_cast<int>(yc + ceilf(y1)),
color.red(),
color.green(),
color.blue(),
color.alpha());
break;
case 3:
pRaster->LineRGBA(pSurface,
static_cast<int>(xc + ceilf(y0)), static_cast<int>(yc + ceilf(x0)),
static_cast<int>(xc + ceilf(y1)), static_cast<int>(yc + ceilf(x1)),
color.red(),
color.green(),
color.blue(),
color.alpha());
break;
}
if (doSwap)
{
x0 = x1;
y0 = y1;
}
}
}
示例2: incorporateUpdate
void BackingStore::incorporateUpdate(ShareableBitmap* bitmap, const UpdateInfo& updateInfo)
{
if (!m_backend)
m_backend = createBackend();
scroll(updateInfo.scrollRect, updateInfo.scrollOffset);
// Paint all update rects.
IntPoint updateRectLocation = updateInfo.updateRectBounds.location();
RefPtr<cairo_t> context = adoptRef(cairo_create(m_backend->surface()));
GraphicsContext graphicsContext(context.get());
for (const auto& updateRect : updateInfo.updateRects) {
IntRect srcRect = updateRect;
srcRect.move(-updateRectLocation.x(), -updateRectLocation.y());
#if PLATFORM(GTK)
if (!m_webPageProxy.drawsBackground()) {
const WebCore::Color color = m_webPageProxy.backgroundColor();
if (color.hasAlpha())
graphicsContext.clearRect(srcRect);
if (color.alpha() > 0)
graphicsContext.fillRect(srcRect, color, ColorSpaceDeviceRGB);
}
#endif
bitmap->paint(graphicsContext, deviceScaleFactor(), updateRect.location(), srcRect);
}
}
示例3: setToValue
void PlatformCAAnimation::setToValue(const WebCore::Color& value)
{
if (animationType() != Basic)
return;
float a[4] = { value.red(), value.green(), value.blue(), value.alpha() };
RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(4, a));
CACFAnimationSetToValue(m_animation.get(), v.get());
}
示例4: showColorPicker
static void showColorPicker(WKPageRef, WKStringRef initialColor, WKColorPickerResultListenerRef listener, const void* clientInfo)
{
WebCore::Color color = WebCore::Color(WebKit::toWTFString(initialColor));
ewk_view_color_picker_request(toEwkView(clientInfo), color.red(), color.green(), color.blue(), color.alpha(), listener);
}
示例5: drawSimpleText
/* SDL ttf implementation may be lighter ??? */
void Font::drawSimpleText(BIGraphicsContext* context, const TextRun& run, const TextStyle& style, const FloatPoint& point) const
{
WebCore::Color color = context->strokeColor();
BCNativeImage* text_surface = static_cast<BCNativeImage*>(context->getNativeImage())->getSurface();
// FIXME: Process normal, bold, italic styles
// if (m_fontDescription.italic())
// {
// if (m_fontDescription.bold())
// { // Bold && italic
// TTF_SetFontStyle(d->m_ttfFont, TTF_STYLE_BOLD | TTF_STYLE_ITALIC);
// }
// else
// { // Only italic
// TTF_SetFontStyle(d->m_ttfFont, TTF_STYLE_ITALIC);
// }
// }
// else if (m_fontDescription.bold())
// { // Only bold
// TTF_SetFontStyle(d->m_ttfFont, TTF_STYLE_BOLD);
// }
// else
// {
// TTF_SetFontStyle(d->m_ttfFont, TTF_STYLE_NORMAL);
// }
DFBCHECK(text_surface->SetFont(text_surface, d->m_ttfFont));
// Set font color
DFBCHECK(text_surface->SetColor(text_surface, color.red(), color.green(), color.blue(), color.alpha()));
// Draw font
int wordSize = run.length() - run.from();
UChar word[wordSize];
copyTextRunTo(run, word);
DFBCHECK(text_surface->DrawString(text_surface, word, -1, point.x(), point.y(), DSTF_TOP | DSTF_LEFT));
}