Jazz2::Editor::TileStamp struct

Tiles the brush paints with.

A rectangle of tiles, each of which can be left out so the stamp only paints some of them. Painted along a stroke, it repeats from where the stroke started, so a stamp of a pattern makes a seamless pattern.

Public types

struct OffGridEvent
An event of the stamp off the grid, see OffGridEvents.

Public static functions

static auto FromTile(const TileRef& tile) -> TileStamp
Makes a stamp of a single tile.
static auto FromLayer(const DocumentLayer& layer, const Recti& area) -> TileStamp
Makes a stamp of a rectangle of a layer.
static auto FromTileSet(std::uint8_t source, std::int32_t columns, const Recti& area) -> TileStamp
Makes a stamp of a rectangle of tiles of a tile set, given its width in tiles.

Public functions

auto IsEmpty() const -> bool
Returns true if there's nothing to paint.
auto HasEvents() const -> bool
Returns true if the stamp has events on its tiles, see Events.
auto GetTile(std::int32_t x, std::int32_t y) const -> const TileRef&
Returns the tile at a position of the stamp.
auto IsPresent(std::int32_t x, std::int32_t y) const -> bool
Returns true if the tile at a position of the stamp is painted.
auto GetPatternTile(std::int32_t x, std::int32_t y, Vector2i origin, TileRef& tile) const -> bool
Returns the tile of a pattern of the stamp repeated from an origin, for a position of a layer.
auto GetPatternIndex(std::int32_t x, std::int32_t y, Vector2i origin, std::size_t& index) const -> bool
Returns the index in Tiles of the tile of a pattern of the stamp repeated from an origin, for a position of a layer, false if none is painted there.
void FlipX()
Flips the stamp horizontally, the tiles themselves too.
void FlipY()
Flips the stamp vertically, the tiles themselves too.
void Rotate(bool clockwise)
Turns the stamp by a quarter, clockwise or counter-clockwise.

Public variables

std::int32_t Width
Width in tiles.
std::int32_t Height
Height in tiles.
SmallVector<TileRef, 0> Tiles
Tiles row by row.
SmallVector<bool, 0> Present
Whether each tile is painted at all.
bool Random
Whether each cell gets one of the tiles at random instead of the pattern.
std::uint32_t Seed
Seed of the random choice, another one chooses other tiles.
SmallVector<float, 0> Weights
How often each tile is chosen when painting at random, the same for all if empty.
SmallVector<Formats::EventRecord, 0> Events
Events on the tiles, one for each of Tiles, or empty if the stamp has none.
SmallVector<OffGridEvent, 0> OffGridEvents
Events off the grid on the tiles of the stamp, each placed with the tile it's on.
bool EmptyIsTransparent
Whether the empty tiles of the stamp leave the tiles under them as they are.

Function documentation

void Jazz2::Editor::TileStamp::Rotate(bool clockwise)

Turns the stamp by a quarter, clockwise or counter-clockwise.

A tile can only be flipped, not turned, so the tiles go where they would be turned, each keeps how it looks. Two quarters are the same as flipping both ways, which turns the tiles too.

Variable documentation

bool Jazz2::Editor::TileStamp::Random

Whether each cell gets one of the tiles at random instead of the pattern.

A tile that's there more times comes more often, a tile left out leaves cells as they are. The choice is the same for the same position and Seed, so painting over a cell again doesn't change it.

SmallVector<float, 0> Jazz2::Editor::TileStamp::Weights

How often each tile is chosen when painting at random, the same for all if empty.

One for each of Tiles, a tile with twice the weight comes twice as often, zero never.

SmallVector<Formats::EventRecord, 0> Jazz2::Editor::TileStamp::Events

Events on the tiles, one for each of Tiles, or empty if the stamp has none.

A block grabbed from the sprite layer has them, see BlockGrab. They're placed only on the sprite layer, each with its tile — where a tile is painted, its event replaces the one there, even an empty one.

SmallVector<OffGridEvent, 0> Jazz2::Editor::TileStamp::OffGridEvents

Events off the grid on the tiles of the stamp, each placed with the tile it's on.

As Events, of a block grabbed from the sprite layer and placed only on the sprite layer. They're added to the events off the grid there, one the same as an event already at its position isn't placed again. A stamp painting its tiles at random places none of them.

bool Jazz2::Editor::TileStamp::EmptyIsTransparent

Whether the empty tiles of the stamp leave the tiles under them as they are.

As a block grabbed from a layer is painted in Jazz Creation Station, the empty tiles and their events are painted too only with Shift, see ToolSettings::ResolveTile().