Flutter Engine
The Flutter Engine
Classes | Functions
arithmode.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFont.h"
#include "include/core/SkFontTypes.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkShader.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTileMode.h"
#include "include/core/SkTypeface.h"
#include "include/core/SkTypes.h"
#include "include/effects/SkGradientShader.h"
#include "include/effects/SkImageFilters.h"
#include "include/effects/SkRuntimeEffect.h"
#include "tools/ToolUtils.h"
#include "tools/fonts/FontToolUtils.h"
#include <utility>
#include "include/effects/SkBlenders.h"

Go to the source code of this file.

Classes

class  ArithmodeGM
 
class  ArithmodeBlenderGM
 

Functions

static sk_sp< SkImagemake_src (int w, int h)
 
static sk_sp< SkImagemake_dst (int w, int h)
 
static void show_k_text (SkCanvas *canvas, SkScalar x, SkScalar y, const SkScalar k[])
 

Function Documentation

◆ make_dst()

static sk_sp< SkImage > make_dst ( int  w,
int  h 
)
static

Definition at line 51 of file arithmode.cpp.

51 {
53 SkCanvas* canvas = surface->getCanvas();
54
56 SkPoint pts[] = { {0, SkIntToScalar(h)}, {SkIntToScalar(w), 0} };
57 SkColor colors[] = {
60 };
63 canvas->drawPaint(paint);
64 return surface->makeImageSnapshot();
65}
constexpr SkColor SK_ColorYELLOW
Definition: SkColor.h:139
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorGRAY
Definition: SkColor.h:113
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
#define SkIntToScalar(x)
Definition: SkScalar.h:57
void drawPaint(const SkPaint &paint)
Definition: SkCanvas.cpp:1668
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
const Paint & paint
Definition: color_source.cc:38
VkSurfaceKHR surface
Definition: main.cc:49
PODArray< SkColor > colors
Definition: SkRecords.h:276
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
SkScalar w
SkScalar h
static SkImageInfo MakeN32Premul(int width, int height)

◆ make_src()

static sk_sp< SkImage > make_src ( int  w,
int  h 
)
static

Definition at line 35 of file arithmode.cpp.

35 {
37 SkCanvas* canvas = surface->getCanvas();
38
40 SkPoint pts[] = { {0, 0}, {SkIntToScalar(w), SkIntToScalar(h)} };
41 SkColor colors[] = {
44 };
47 canvas->drawPaint(paint);
48 return surface->makeImageSnapshot();
49}
constexpr SkColor SK_ColorMAGENTA
Definition: SkColor.h:147
constexpr SkColor SK_ColorCYAN
Definition: SkColor.h:143
constexpr SkColor SK_ColorTRANSPARENT
Definition: SkColor.h:99
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122

◆ show_k_text()

static void show_k_text ( SkCanvas canvas,
SkScalar  x,
SkScalar  y,
const SkScalar  k[] 
)
static

Definition at line 67 of file arithmode.cpp.

67 {
71 paint.setAntiAlias(true);
72 for (int i = 0; i < 4; ++i) {
73 SkString str;
74 str.appendScalar(k[i]);
75 SkScalar width = font.measureText(str.c_str(), str.size(), SkTextEncoding::kUTF8);
76 canvas->drawString(str, x, y + font.getSize(), font, paint);
77 x += width + SkIntToScalar(10);
78 }
79}
@ kUTF8
uses bytes to represent UTF-8 or ASCII
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition: SkCanvas.h:1803
Definition: SkFont.h:35
@ kAntiAlias
may have transparent pixels on glyph edges
size_t size() const
Definition: SkString.h:131
void appendScalar(SkScalar value)
Definition: SkString.h:213
const char * c_str() const
Definition: SkString.h:133
float SkScalar
Definition: extension.cpp:12
double y
double x
sk_sp< SkTypeface > DefaultPortableTypeface()
font
Font Metadata and Metrics.
int32_t width