Flutter Engine
The Flutter Engine
Namespaces | Functions
SkPixmapUtils.cpp File Reference
#include "include/codec/SkPixmapUtils.h"
#include "include/codec/SkEncodedOrigin.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkImage.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPixmap.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkSamplingOptions.h"
#include "include/core/SkSurface.h"
#include <utility>

Go to the source code of this file.

Namespaces

namespace  SkPixmapUtils
 

Functions

static bool draw_orientation (const SkPixmap &dst, const SkPixmap &src, SkEncodedOrigin origin)
 
SK_API bool SkPixmapUtils::Orient (const SkPixmap &dst, const SkPixmap &src, SkEncodedOrigin origin)
 
SK_API SkImageInfo SkPixmapUtils::SwapWidthHeight (const SkImageInfo &info)
 

Function Documentation

◆ draw_orientation()

static bool draw_orientation ( const SkPixmap dst,
const SkPixmap src,
SkEncodedOrigin  origin 
)
static

Definition at line 24 of file SkPixmapUtils.cpp.

24 {
25 auto surf = SkSurfaces::WrapPixels(dst.info(), dst.writable_addr(), dst.rowBytes());
26 if (!surf) {
27 return false;
28 }
29
30 SkBitmap bm;
32
33 SkMatrix m = SkEncodedOriginToMatrix(origin, dst.width(), dst.height());
34
35 SkPaint p;
36 p.setBlendMode(SkBlendMode::kSrc);
37 surf->getCanvas()->concat(m);
38 surf->getCanvas()->drawImage(SkImages::RasterFromBitmap(bm), 0, 0, SkSamplingOptions(), &p);
39 return true;
40}
static SkMatrix SkEncodedOriginToMatrix(SkEncodedOrigin origin, int w, int h)
bool installPixels(const SkImageInfo &info, void *pixels, size_t rowBytes, void(*releaseProc)(void *addr, void *context), void *context)
Definition: SkBitmap.cpp:323
SK_API sk_sp< SkImage > RasterFromBitmap(const SkBitmap &bitmap)
SK_API sk_sp< SkSurface > WrapPixels(const SkImageInfo &imageInfo, void *pixels, size_t rowBytes, const SkSurfaceProps *surfaceProps=nullptr)
dst
Definition: cp.py:12
SkSamplingOptions(SkFilterMode::kLinear))