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
13
14namespace impeller {
15
16// Converts a call to draw a nine patch image into a draw atlas call.
18 public:
20
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_
void DrawNinePatch(const std::shared_ptr< Texture > &image, Rect center, Rect dst, const SamplerDescriptor &sampler, Canvas *canvas, Paint *paint)
FlutterVulkanImage * image