| Flutter Impeller |

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
10 #include "impeller/aiks/canvas.h"
11 #include "impeller/aiks/image.h"
12 #include "impeller/aiks/paint.h"
13 #include "impeller/core/sampler_descriptor.h"
14
15 namespace impeller {
16
17 // Converts a call to draw a nine patch image into a draw atlas call.
18 class NinePatchConverter {
19 public:
20 NinePatchConverter();
21
22 ~NinePatchConverter();
23
24 void DrawNinePatch(const std::shared_ptr<Image>& image,
25 Rect center,
26 Rect dst,
27 const SamplerDescriptor& sampler,
28 Canvas* 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_
impeller::Paint
Definition: paint.h:23
impeller::Canvas
Definition: canvas.h:60
impeller::NinePatchConverter::DrawNinePatch
void DrawNinePatch(const std::shared_ptr< Image > &image, Rect center, Rect dst, const SamplerDescriptor &sampler, Canvas *canvas, Paint *paint)
Definition: nine_patch_converter.cc:60
impeller::NinePatchConverter::~NinePatchConverter
~NinePatchConverter()
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:15
canvas.h
impeller::NinePatchConverter
Definition: nine_patch_converter.h:18
impeller::NinePatchConverter::NinePatchConverter
NinePatchConverter()
sampler_descriptor.h
image.h
paint
const Paint & paint
Definition: color_source.cc:38
paint.h
impeller
Definition: aiks_blend_unittests.cc:18
impeller::TRect< Scalar >