本文整理汇总了C++中KoColor::setOpacity方法的典型用法代码示例。如果您正苦于以下问题:C++ KoColor::setOpacity方法的具体用法?C++ KoColor::setOpacity怎么用?C++ KoColor::setOpacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoColor
的用法示例。
在下文中一共展示了KoColor::setOpacity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: putPixel
void CurveBrush::putPixel(QPointF pos, KoColor &color)
{
int ipx = int (pos.x());
int ipy = int (pos.y());
qreal fx = pos.x() - ipx;
qreal fy = pos.y() - ipy;
qreal btl = (1 - fx) * (1 - fy);
qreal btr = (fx) * (1 - fy);
qreal bbl = (1 - fx) * (fy);
qreal bbr = (fx) * (fy);
color.setOpacity(btl);
m_writeAccessor->moveTo(ipx , ipy);
if (cs->opacityU8(m_writeAccessor->rawData()) < color.opacityU8()) {
memcpy(m_writeAccessor->rawData(), color.data(), m_pixelSize);
}
color.setOpacity(btr);
m_writeAccessor->moveTo(ipx + 1, ipy);
if (cs->opacityU8(m_writeAccessor->rawData()) < color.opacityU8()) {
memcpy(m_writeAccessor->rawData(), color.data(), m_pixelSize);
}
color.setOpacity(bbl);
m_writeAccessor->moveTo(ipx, ipy + 1);
if (cs->opacityU8(m_writeAccessor->rawData()) < color.opacityU8()) {
memcpy(m_writeAccessor->rawData(), color.data(), m_pixelSize);
}
color.setOpacity(bbr);
m_writeAccessor->moveTo(ipx + 1, ipy + 1);
if (cs->opacityU8(m_writeAccessor->rawData()) < color.opacityU8()) {
memcpy(m_writeAccessor->rawData(), color.data(), m_pixelSize);
}
}
示例2: pick
bool pick(KisPaintDeviceSP dev, const QPoint& pos, KoColor *color)
{
KIS_ASSERT(dev);
KoColor pickedColor;
dev->pixel(pos.x(), pos.y(), &pickedColor);
pickedColor.convertTo(dev->compositionSourceColorSpace());
bool validColorPicked =
pickedColor.opacityU8() != OPACITY_TRANSPARENT_U8;
if (validColorPicked) {
pickedColor.setOpacity(OPACITY_OPAQUE_U8);
*color = pickedColor;
}
return validColorPicked;
}
示例3: opacityDepletion
void HairyBrush::opacityDepletion(Bristle* bristle, KoColor& bristleColor, qreal pressure, qreal inkDeplation)
{
qreal opacity = OPACITY_OPAQUE_F;
if (m_properties->useWeights) {
opacity = qBound(0.0,
(pressure * m_properties->pressureWeight) +
(bristle->length() * m_properties->bristleLengthWeight) +
(bristle->inkAmount() * m_properties->bristleInkAmountWeight) +
((1.0 - inkDeplation) * m_properties->inkDepletionWeight),1.0);
} else {
opacity =
bristle->length() *
bristle->inkAmount();
}
bristleColor.setOpacity(opacity);
}