Skip to content

TileGrid: Relax the tile_{width,height} restriction #2722

@jepler

Description

@jepler

Say you want to create a memory efficient 1-value graph in a TileGrid. You need a grid of Wx1 tiles, and you need to be able to place a single "1" pixel among (H-1) "0" pixels.

Right now, to do this you need to have a HxH bitmap. In tile 0, the pixel at Y=0 is set. In tile 1, the pixel at Y=1 is set, and so on. Total bitmap usage increases according to H^2, so it can add up to a lot. To put the pixel at height Y, you just use tile #Y.

If you could specify tile_width=1, tile_height=1, then a much smaller bitmap of just (2*H-1) is needed. It has a single "1" pixel at (H-1) from the top. To put the pixel at height Y, you just use tile #(2*H-Y-1) or something like that; I may have an off-by-1 error in that calculation, but it's something like that.

(this has other uses; I actually wanted to show a rainbow pattern that could be shifted to a different height at each X coordinate, but I explained this in terms of graphs for simplicity's sake)

I think that it's possible to relax the tile_width and tile_height to be any values that aren't bigger than the underlying bitmap size. But just allowing the specification of =1 enables almost anything.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions