本文整理汇总了C++中BitmapImage::currentFrameOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapImage::currentFrameOrientation方法的具体用法?C++ BitmapImage::currentFrameOrientation怎么用?C++ BitmapImage::currentFrameOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapImage
的用法示例。
在下文中一共展示了BitmapImage::currentFrameOrientation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: destRect
PassOwnPtr<DragImage> DragImage::create(Image* image, RespectImageOrientationEnum shouldRespectImageOrientation, float deviceScaleFactor)
{
if (!image)
return nullptr;
RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame();
if (!bitmap)
return nullptr;
if (image->isBitmapImage()) {
ImageOrientation orientation = DefaultImageOrientation;
BitmapImage* bitmapImage = toBitmapImage(image);
IntSize sizeRespectingOrientation = bitmapImage->sizeRespectingOrientation();
if (shouldRespectImageOrientation == RespectImageOrientation)
orientation = bitmapImage->currentFrameOrientation();
if (orientation != DefaultImageOrientation) {
FloatRect destRect(FloatPoint(), sizeRespectingOrientation);
if (orientation.usesWidthAsHeight())
destRect = destRect.transposedRect();
SkBitmap skBitmap;
skBitmap.setConfig(
SkBitmap::kARGB_8888_Config, sizeRespectingOrientation.width(), sizeRespectingOrientation.height());
if (!skBitmap.allocPixels())
return nullptr;
SkCanvas canvas(skBitmap);
canvas.concat(affineTransformToSkMatrix(orientation.transformFromDefault(sizeRespectingOrientation)));
canvas.drawBitmapRect(bitmap->bitmap(), 0, destRect);
return adoptPtr(new DragImage(skBitmap, deviceScaleFactor));
}
}
SkBitmap skBitmap;
#if defined(SBROWSER_GPU_RASTERIZATION_ENABLE)
if (!bitmap->bitmap().copyTo(&skBitmap, kPMColor_SkColorType))
#else
if (!bitmap->bitmap().copyTo(&skBitmap, SkBitmap::kARGB_8888_Config))
#endif
return nullptr;
return adoptPtr(new DragImage(skBitmap, deviceScaleFactor));
}
示例2: createDragImageFromImage
DragImageRef createDragImageFromImage(Image* image, RespectImageOrientationEnum shouldRespectImageOrientation)
{
if (!image)
return 0;
NativeImageSkia* bitmap = image->nativeImageForCurrentFrame();
if (!bitmap)
return 0;
DragImageChromium* dragImageChromium = new DragImageChromium;
dragImageChromium->bitmap = new SkBitmap();
dragImageChromium->resolutionScale = bitmap->resolutionScale();
if (image->isBitmapImage()) {
ImageOrientation orientation = DefaultImageOrientation;
BitmapImage* bitmapImage = static_cast<BitmapImage*>(image);
IntSize sizeRespectingOrientation = bitmapImage->sizeRespectingOrientation();
if (shouldRespectImageOrientation == RespectImageOrientation)
orientation = bitmapImage->currentFrameOrientation();
if (orientation != DefaultImageOrientation) {
// Construct a correctly-rotated copy of the image to use as the drag image.
dragImageChromium->bitmap->setConfig(
SkBitmap::kARGB_8888_Config, sizeRespectingOrientation.width(), sizeRespectingOrientation.height());
dragImageChromium->bitmap->allocPixels();
FloatRect destRect(FloatPoint(), sizeRespectingOrientation);
SkCanvas canvas(*dragImageChromium->bitmap);
canvas.concat(orientation.transformFromDefault(sizeRespectingOrientation));
if (orientation.usesWidthAsHeight())
destRect = FloatRect(destRect.x(), destRect.y(), destRect.height(), destRect.width());
canvas.drawBitmapRect(bitmap->bitmap(), 0, destRect);
return dragImageChromium;
}
}
bitmap->bitmap().copyTo(dragImageChromium->bitmap, SkBitmap::kARGB_8888_Config);
return dragImageChromium;
}
示例3: destRect
PassOwnPtr<DragImage> DragImage::create(Image* image, RespectImageOrientationEnum shouldRespectImageOrientation, float deviceScaleFactor)
{
if (!image)
return nullptr;
RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame();
if (!bitmap)
return nullptr;
if (image->isBitmapImage()) {
ImageOrientation orientation = DefaultImageOrientation;
BitmapImage* bitmapImage = toBitmapImage(image);
IntSize sizeRespectingOrientation = bitmapImage->sizeRespectingOrientation();
if (shouldRespectImageOrientation == RespectImageOrientation)
orientation = bitmapImage->currentFrameOrientation();
if (orientation != DefaultImageOrientation) {
FloatRect destRect(FloatPoint(), sizeRespectingOrientation);
if (orientation.usesWidthAsHeight())
destRect = destRect.transposedRect();
SkBitmap skBitmap;
if (!skBitmap.tryAllocN32Pixels(sizeRespectingOrientation.width(), sizeRespectingOrientation.height()))
return nullptr;
SkCanvas canvas(skBitmap);
canvas.concat(affineTransformToSkMatrix(orientation.transformFromDefault(sizeRespectingOrientation)));
canvas.drawBitmapRect(bitmap->bitmap(), 0, destRect);
return adoptPtr(new DragImage(skBitmap, deviceScaleFactor));
}
}
SkBitmap skBitmap;
if (!bitmap->bitmap().copyTo(&skBitmap, kN32_SkColorType))
return nullptr;
return adoptPtr(new DragImage(skBitmap, deviceScaleFactor));
}