Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
nine_patch_converter.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_DISPLAY_LIST_NINE_PATCH_CONVERTER_H_
6#define FLUTTER_IMPELLER_DISPLAY_LIST_NINE_PATCH_CONVERTER_H_
7
8#include <memory>
9
11#include "impeller/aiks/image.h"
12#include "impeller/aiks/paint.h"
14
15namespace impeller {
16
17// Converts a call to draw a nine patch image into a draw atlas call.
19 public:
21
23
24 void DrawNinePatch(const std::shared_ptr<Image>& image,
26 Rect dst,
27 const SamplerDescriptor& sampler,
28 CanvasType* canvas,
29 Paint* paint);
30
31 private:
32 // Return a list of slice coordinates based on the size of the nine-slice
33 // parameters in one dimension. Each set of slice coordinates contains a
34 // begin/end pair for each of the source (image) and dest (screen) in the
35 // order (src0, dst0, src1, dst1). The area from src0 => src1 of the image is
36 // painted on the screen from dst0 => dst1 The slices for each dimension are
37 // generated independently.
38 std::vector<double> InitSlices(double img0,
39 double imgC0,
40 double imgC1,
41 double img1,
42 double dst0,
43 double dst1);
44};
45
46} // namespace impeller
47
48#endif // FLUTTER_IMPELLER_DISPLAY_LIST_NINE_PATCH_CONVERTER_H_
static SkScalar center(float pos0, float pos1)
void DrawNinePatch(const std::shared_ptr< Image > &image, Rect center, Rect dst, const SamplerDescriptor &sampler, CanvasType *canvas, Paint *paint)
const Paint & paint
sk_sp< SkImage > image
Definition examples.cpp:29