| Flutter Impeller |

Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
impeller::RectanglePacker Class Referenceabstract

Packs rectangles into a specified area without rotating them. More...

`#include <rectangle_packer.h>`

Inheritance diagram for impeller::RectanglePacker:

## Public Member Functions
virtual | ~RectanglePacker ()
virtual bool | addRect (int width, int height, IPoint16 *loc)=0
| Attempt to add a rect without moving already placed rectangles. More...
virtual float | percentFull () const =0
| Returns how much area has been filled with rectangles. More...
virtual void | reset ()=0
| Empty out all previously added rectangles. More...

## Static Public Member Functions
static RectanglePacker * | Factory (int width, int height)
| Return an empty packer with area specified by width and height. More...

## Protected Member Functions
| RectanglePacker (int width, int height)
int | width () const
int | height () const

## Detailed Description

Packs rectangles into a specified area without rotating them.

Definition at line 24 of file rectangle_packer.h.

## Constructor & Destructor Documentation

## ◆ ~RectanglePacker()

virtual impeller::RectanglePacker::~RectanglePacker | ( |  | ) |
| inline virtual

Definition at line 31 of file rectangle_packer.h.

31 {}

## ◆ RectanglePacker()

impeller::RectanglePacker::RectanglePacker | ( | int | width,
|  | int | height
| ) |  |
| inline protected

Definition at line 58 of file rectangle_packer.h.

58 : width_(width), height_(height) {
59 FML_DCHECK(width >= 0);
60 FML_DCHECK(height >= 0);
61 }

References height(), and width().

## Member Function Documentation

## ◆ addRect()

virtual bool impeller::RectanglePacker::addRect | ( | int | width,
|  | int | height,
|  | IPoint16 * | loc
| ) |  |
| pure virtual

Attempt to add a rect without moving already placed rectangles.

Parameters

  [in] | width | The width of the rectangle to add.
  [in] | height | The height of the rectangle to add.
  [out] | loc | If successful, will be set to the position of the upper-left corner of the rectangle.

Returns
  Return true on success; false on failure.

Implemented in impeller::SkylineRectanglePacker.

## ◆ Factory()

RectanglePacker * impeller::RectanglePacker::Factory | ( | int | width,
|  | int | height
| ) |  |
| static

Return an empty packer with area specified by width and height.

Definition at line 169 of file rectangle_packer.cc.

169 {
170 return new SkylineRectanglePacker(width, height);
171 }

References height(), and width().

Referenced by impeller::OptimumAtlasSizeForFontGlyphPairs(), and impeller::testing::TEST_P().

## ◆ height()

int impeller::RectanglePacker::height | ( |  | ) | const
| inline protected

Definition at line 64 of file rectangle_packer.h.

64 { return height_; }

Referenced by impeller::SkylineRectanglePacker::addRect(), Factory(), impeller::SkylineRectanglePacker::percentFull(), and RectanglePacker().

## ◆ percentFull()

virtual float impeller::RectanglePacker::percentFull | ( |  | ) | const
| pure virtual

Returns how much area has been filled with rectangles.

Returns
  Percentage as a decimal between 0.0 and 1.0

Implemented in impeller::SkylineRectanglePacker.

## ◆ reset()

virtual void impeller::RectanglePacker::reset | ( |  | ) |
| pure virtual

Empty out all previously added rectangles.

Implemented in impeller::SkylineRectanglePacker.

## ◆ width()

int impeller::RectanglePacker::width | ( |  | ) | const
| inline protected

Definition at line 63 of file rectangle_packer.h.

63 { return width_; }

Referenced by impeller::SkylineRectanglePacker::addRect(), Factory(), impeller::SkylineRectanglePacker::percentFull(), RectanglePacker(), and impeller::SkylineRectanglePacker::reset().

The documentation for this class was generated from the following files:

- impeller/typographer/rectangle_packer.h
- impeller/typographer/rectangle_packer.cc

impeller::RectanglePacker::width
int width() const
Definition: rectangle_packer.h:63
impeller::RectanglePacker::height
int height() const
Definition: rectangle_packer.h:64