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