Flutter Engine
The Flutter Engine
Functions
skbug_12212.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkFont.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRect.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTextBlob.h"
#include "include/gpu/GpuTypes.h"
#include "include/gpu/ganesh/SkSurfaceGanesh.h"
#include "tools/fonts/FontToolUtils.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM_BG (skbug_12212, canvas, 400, 400, SK_ColorCYAN)
 

Function Documentation

◆ DEF_SIMPLE_GM_BG()

DEF_SIMPLE_GM_BG ( skbug_12212  ,
canvas  ,
400  ,
400  ,
SK_ColorCYAN   
)

Definition at line 19 of file skbug_12212.cpp.

19 {
20 // Create an Alpha_8 surface to draw into (strangely, with RGB pixel geometry).
21 auto imageInfo = SkImageInfo::Make(/*width=*/400, /*height=*/400, kAlpha_8_SkColorType,
23 SkSurfaceProps props(/*flags=*/0, kRGB_H_SkPixelGeometry);
25 canvas->recordingContext(), skgpu::Budgeted::kNo, imageInfo, /*sampleCount=*/0, &props);
26 if (!surface) {
27 surface = SkSurfaces::Raster(imageInfo, &props);
28 }
29
30 // Draw text into the surface using LCD antialiasing.
31 SkPaint p;
32 p.setAntiAlias(true);
33 p.setBlendMode(SkBlendMode::kSrc);
34 p.setAlpha(0x80);
36 font.setSize(170);
38 auto textBlob = SkTextBlob::MakeFromText("text", /*byteLength=*/4, font);
39 surface->getCanvas()->drawTextBlob(textBlob, /*x=*/50, /*y=*/350, p);
40
41 // Draw the surface on our main canvas.
42 surface->draw(canvas, /*x=*/0, /*y=*/0);
43}
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
Definition: SkColorType.h:21
@ kRGB_H_SkPixelGeometry
Definition: SkFont.h:35
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
static sk_sp< SkTextBlob > MakeFromText(const void *text, size_t byteLength, const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8)
Definition: SkTextBlob.cpp:788
VkSurfaceKHR surface
Definition: main.cc:49
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
SkFont DefaultPortableFont()
font
Font Metadata and Metrics.
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)