本文整理汇总了C++中SkiaImageFilterBuilder::cropOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ SkiaImageFilterBuilder::cropOffset方法的具体用法?C++ SkiaImageFilterBuilder::cropOffset怎么用?C++ SkiaImageFilterBuilder::cropOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkiaImageFilterBuilder
的用法示例。
在下文中一共展示了SkiaImageFilterBuilder::cropOffset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adoptRef
PassRefPtr<SkImageFilter> FEMorphology::createImageFilter(SkiaImageFilterBuilder& builder)
{
RefPtr<SkImageFilter> input(builder.build(inputEffect(0), operatingColorSpace()));
SkScalar radiusX = SkFloatToScalar(filter()->applyHorizontalScale(m_radiusX));
SkScalar radiusY = SkFloatToScalar(filter()->applyVerticalScale(m_radiusY));
SkImageFilter::CropRect rect = getCropRect(builder.cropOffset());
if (m_type == FEMORPHOLOGY_OPERATOR_DILATE)
return adoptRef(SkDilateImageFilter::Create(radiusX, radiusY, input.get(), &rect));
return adoptRef(SkErodeImageFilter::Create(radiusX, radiusY, input.get(), &rect));
}
示例2: adoptRef
PassRefPtr<SkImageFilter> FEComponentTransfer::createImageFilter(SkiaImageFilterBuilder& builder)
{
RefPtr<SkImageFilter> input(builder.build(inputEffect(0), operatingColorSpace()));
unsigned char rValues[256], gValues[256], bValues[256], aValues[256];
getValues(rValues, gValues, bValues, aValues);
SkAutoTUnref<SkColorFilter> colorFilter(SkTableColorFilter::CreateARGB(aValues, rValues, gValues, bValues));
SkImageFilter::CropRect cropRect = getCropRect(builder.cropOffset());
return adoptRef(SkColorFilterImageFilter::Create(colorFilter, input.get(), &cropRect));
}
示例3: adoptRef
PassRefPtr<SkImageFilter> FEMerge::createImageFilter(SkiaImageFilterBuilder& builder)
{
unsigned size = numberOfEffectInputs();
OwnPtr<RefPtr<SkImageFilter>[]> inputRefs = adoptArrayPtr(new RefPtr<SkImageFilter>[size]);
OwnPtr<SkImageFilter*[]> inputs = adoptArrayPtr(new SkImageFilter*[size]);
for (unsigned i = 0; i < size; ++i) {
inputRefs[i] = builder.build(inputEffect(i), operatingColorSpace());
inputs[i] = inputRefs[i].get();
}
SkImageFilter::CropRect rect = getCropRect(builder.cropOffset());
return adoptRef(SkMergeImageFilter::Create(inputs.get(), size, 0, &rect));
}
示例4: createTransparentBlack
PassRefPtr<SkImageFilter> FELighting::createImageFilter(SkiaImageFilterBuilder& builder)
{
if (!m_lightSource)
return createTransparentBlack(builder);
SkImageFilter::CropRect rect = getCropRect(builder.cropOffset());
Color lightColor = adaptColorToOperatingColorSpace(m_lightingColor);
RefPtr<SkImageFilter> input(builder.build(inputEffect(0), operatingColorSpace()));
switch (m_lightSource->type()) {
case LS_DISTANT: {
DistantLightSource* distantLightSource = static_cast<DistantLightSource*>(m_lightSource.get());
float azimuthRad = deg2rad(distantLightSource->azimuth());
float elevationRad = deg2rad(distantLightSource->elevation());
const SkPoint3 direction = SkPoint3::Make(cosf(azimuthRad) * cosf(elevationRad), sinf(azimuthRad) * cosf(elevationRad), sinf(elevationRad));
if (m_specularConstant > 0)
return adoptRef(SkLightingImageFilter::CreateDistantLitSpecular(direction, lightColor.rgb(), m_surfaceScale, m_specularConstant, m_specularExponent, input.get(), &rect));
return adoptRef(SkLightingImageFilter::CreateDistantLitDiffuse(direction, lightColor.rgb(), m_surfaceScale, m_diffuseConstant, input.get(), &rect));
}
case LS_POINT: {
PointLightSource* pointLightSource = static_cast<PointLightSource*>(m_lightSource.get());
const FloatPoint3D position = pointLightSource->position();
const SkPoint3 skPosition = SkPoint3::Make(position.x(), position.y(), position.z());
if (m_specularConstant > 0)
return adoptRef(SkLightingImageFilter::CreatePointLitSpecular(skPosition, lightColor.rgb(), m_surfaceScale, m_specularConstant, m_specularExponent, input.get(), &rect));
return adoptRef(SkLightingImageFilter::CreatePointLitDiffuse(skPosition, lightColor.rgb(), m_surfaceScale, m_diffuseConstant, input.get(), &rect));
}
case LS_SPOT: {
SpotLightSource* spotLightSource = static_cast<SpotLightSource*>(m_lightSource.get());
const SkPoint3 location = SkPoint3::Make(spotLightSource->position().x(), spotLightSource->position().y(), spotLightSource->position().z());
const SkPoint3 target = SkPoint3::Make(spotLightSource->direction().x(), spotLightSource->direction().y(), spotLightSource->direction().z());
float specularExponent = spotLightSource->specularExponent();
float limitingConeAngle = spotLightSource->limitingConeAngle();
if (!limitingConeAngle || limitingConeAngle > 90 || limitingConeAngle < -90)
limitingConeAngle = 90;
if (m_specularConstant > 0)
return adoptRef(SkLightingImageFilter::CreateSpotLitSpecular(location, target, specularExponent, limitingConeAngle, lightColor.rgb(), m_surfaceScale, m_specularConstant, m_specularExponent, input.get(), &rect));
return adoptRef(SkLightingImageFilter::CreateSpotLitDiffuse(location, target, specularExponent, limitingConeAngle, lightColor.rgb(), m_surfaceScale, m_diffuseConstant, input.get(), &rect));
}
default:
ASSERT_NOT_REACHED();
return nullptr;
}
}
示例5: createTransparentBlack
PassRefPtr<SkImageFilter> FEConvolveMatrix::createImageFilter(SkiaImageFilterBuilder& builder)
{
if (!parametersValid())
return createTransparentBlack(builder);
RefPtr<SkImageFilter> input(builder.build(inputEffect(0), operatingColorSpace()));
SkISize kernelSize(SkISize::Make(m_kernelSize.width(), m_kernelSize.height()));
// parametersValid() above checks that the kernel area fits in int.
int numElements = safeCast<int>(m_kernelSize.area());
SkScalar gain = SkFloatToScalar(1.0f / m_divisor);
SkScalar bias = SkFloatToScalar(m_bias * 255);
SkIPoint target = SkIPoint::Make(m_targetOffset.x(), m_targetOffset.y());
SkMatrixConvolutionImageFilter::TileMode tileMode = toSkiaTileMode(m_edgeMode);
bool convolveAlpha = !m_preserveAlpha;
OwnPtr<SkScalar[]> kernel = adoptArrayPtr(new SkScalar[numElements]);
for (int i = 0; i < numElements; ++i)
kernel[i] = SkFloatToScalar(m_kernelMatrix[numElements - 1 - i]);
SkImageFilter::CropRect cropRect = getCropRect(builder.cropOffset());
return adoptRef(SkMatrixConvolutionImageFilter::Create(kernelSize, kernel.get(), gain, bias, target, tileMode, convolveAlpha, input.get(), &cropRect));
}
示例6: adoptRef
PassRefPtr<SkImageFilter> FilterEffect::createTransparentBlack(SkiaImageFilterBuilder& builder) const
{
SkAutoTUnref<SkColorFilter> filter(SkColorFilter::CreateModeFilter(0, SkXfermode::kClear_Mode));
SkImageFilter::CropRect rect = getCropRect(builder.cropOffset());
return adoptRef(SkColorFilterImageFilter::Create(filter, nullptr, &rect));
}