当前位置: 首页>>代码示例>>C++>>正文


C++ KoColor::setOpacity方法代码示例

本文整理汇总了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);
    }
}
开发者ID:ChrisJong,项目名称:krita,代码行数:36,代码来源:curve_brush.cpp

示例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;
    }
开发者ID:IGLOU-EU,项目名称:krita,代码行数:17,代码来源:kis_tool_utils.cpp

示例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);
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:17,代码来源:hairy_brush.cpp


注:本文中的KoColor::setOpacity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。