Exemplo n.º 1
0
IntSize dragImageSize(DragImageRef image)
{
    if (!image)
        return IntSize();

    return IntSize(image->width(), image->height());
}
Exemplo n.º 2
0
DragImageRef scaleDragImage(DragImageRef image, FloatSize scale)
{
    if (!image)
        return 0;

    int scaledWidth = image->width() * scale.width();
    int scaledHeight = image->height() * scale.height();

    *image = image->scaled(scaledWidth, scaledHeight);
    return image;
}
Exemplo n.º 3
0
DragImageRef scaleDragImage(DragImageRef image, FloatSize scale)
{
    if (!image)
        return 0;

    int imageWidth = scale.width() * image->width();
    int imageHeight = scale.height() * image->height();
    DragImageRef scaledImage = new SkBitmap(
        skia::ImageOperations::Resize(*image, skia::ImageOperations::RESIZE_LANCZOS3,
                                      imageWidth, imageHeight));
    delete image;
    return scaledImage;
}
Exemplo n.º 4
0
IntSize dragImageSize(DragImageRef image)
{
    if (!image)
        return IntSize();

    return image->size();
}
Exemplo n.º 5
0
DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction)
{
    if (!image)
        return 0;

    image->setIsOpaque(false);
    image->lockPixels();

    for (int row = 0; row < image->height(); ++row) {
        for (int column = 0; column < image->width(); ++column) {
            uint32_t* pixel = image->getAddr32(column, row);
            *pixel = SkPreMultiplyARGB(SkColorGetA(*pixel) * fraction,
                                       SkColorGetR(*pixel),
                                       SkColorGetG(*pixel),
                                       SkColorGetB(*pixel));
        }
    }

    image->unlockPixels();

    return image;
}