| 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/core/sampler_descriptor.h"
11 #include "impeller/display_list/canvas.h"
12 #include "impeller/display_list/paint.h"
13
14 namespace impeller {
15
16 // Converts a call to draw a nine patch image into a draw atlas call.
17 class NinePatchConverter {
18 public:
19 NinePatchConverter();
20
21 ~NinePatchConverter();
22
23 void DrawNinePatch(const std::shared_ptr<Texture>& image,
24 Rect center,
25 Rect dst,
26 const SamplerDescriptor& sampler,
27 Canvas* canvas,
28 Paint* paint);
29
30 private:
31 // Return a list of slice coordinates based on the size of the nine-slice
32 // parameters in one dimension. Each set of slice coordinates contains a
33 // begin/end pair for each of the source (image) and dest (screen) in the
34 // order (src0, dst0, src1, dst1). The area from src0 => src1 of the image is
35 // painted on the screen from dst0 => dst1 The slices for each dimension are
36 // generated independently.
37 std::vector<double> InitSlices(double img0,
38 double imgC0,
39 double imgC1,
40 double img1,
41 double dst0,
42 double dst1);
43 };
44
45 } // namespace impeller
46
47 #endif // FLUTTER_IMPELLER_DISPLAY_LIST_NINE_PATCH_CONVERTER_H_
canvas.h
impeller::Canvas
Definition: canvas.h:120
impeller::NinePatchConverter
Definition: nine_patch_converter.h:17
impeller::NinePatchConverter::DrawNinePatch
void DrawNinePatch(const std::shared_ptr< Texture > &image, Rect center, Rect dst, const SamplerDescriptor &sampler, Canvas *canvas, Paint *paint)
Definition: nine_patch_converter.cc:60
impeller::NinePatchConverter::NinePatchConverter
NinePatchConverter()
impeller::NinePatchConverter::~NinePatchConverter
~NinePatchConverter()
paint.h
impeller
Definition: allocation.cc:12
sampler_descriptor.h
impeller::Paint
Definition: paint.h:27
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:14
impeller::TRect< Scalar >