198 Commits

Author SHA1 Message Date
abecd06b26 Add tests for Static behavior (#161) 2023-03-27 00:51:37 +00:00
c432f21197 Simplify static paint (#160)
Extract the mutable list to the caller.
2023-03-25 02:17:59 +00:00
6708134b54 Render nodes in debug output even if drawing fails (#156) 2023-03-16 04:12:28 +00:00
dc0759d558 Optimize TextSurface rendering (#154)
Do not assemble each surface into a string only to again split it into lines. Instead, inject the appendable and render one row at a time.
2023-03-14 01:06:36 +00:00
9a2e7ba967 Add a second layer if draw policy is non-null 2023-03-12 00:10:22 -05:00
080877df99 Prepare for multiple layers with base type 2023-03-12 00:10:22 -05:00
e40752e991 Break layout and components into packages, individual files 2023-03-12 00:10:22 -05:00
af0139a679 Switch Static to render using a list (#150) 2023-03-12 04:19:02 +00:00
94acb0e12b Introduce a node layer type (#140)
This owns measurement, placement, and drawing, and will be stackable in the future.
2023-03-07 23:34:05 -05:00
3e89e34872 Give node ownership over drawing children (#138)
For now, we still selectively draw children based on whether there's a draw policy.

Migrate Text to talk through a no-content Layout rather than be a Node.
2023-03-07 04:59:26 +00:00
6d76c57d38 Place children only after node is itself placed (#134) 2023-03-02 03:37:13 +00:00
63c1211c25 Expose custom Layout composable
Update Row and Column to use it.
2023-02-26 00:40:21 -05:00
8a687caa1e Make test node more resilient to future refactorings 2023-02-25 23:53:23 -05:00
efa11263da Merge MeasurePolicy and LayoutPolicy into a single thing
This set of interfaces and scopes more closely mirrors how Compose UI works, and should be suitable to expose publicly through a Layout composable.
2023-02-25 23:53:23 -05:00
453377ab02 Use a single node type in the tree
This moves behavior into policy lambdas. It should allow refactoring to Compose UI-style Layout lambdas which are exposed publicly. It also should allow the creation of a global modifier system like Compose UI.
2023-02-25 14:26:49 -05:00
6de6f035b7 Include node tree in debug output 2023-02-25 14:26:49 -05:00
ac258f9d6f Explicitly make the root node its own type
Will help with a future change on debug rendering.
2023-02-25 14:26:49 -05:00
ac8cdde1b5 Do not implement clear callback
This allows us to dispose of the composition before rendering which will be useful in a future change.
2023-02-25 14:26:49 -05:00
d94f7f5c2e Do not wrap static items in a Row
Each caller should specify necessary containers (or perhaps they don't need any).
2023-02-24 22:20:38 -05:00
0ccb0358fc Move static composable and node to appropriate files 2023-02-24 22:20:38 -05:00
2443dd55e8 Only clear lines which have been previously used for output 2023-02-22 00:30:35 -05:00
ee6b6e9c42 Test rendering longer and shorter subsequent outputs 2023-02-22 00:30:35 -05:00
66eca84c5d Share constants for ANSI control codes 2023-02-22 00:30:35 -05:00
3c18954fb0 Start testing renderings 2023-02-21 23:56:31 -05:00
d6f06cb881 Use a Box node for the root 2023-02-21 23:56:31 -05:00
940aac3834 Add render function to do a single frame rendering 2023-02-21 23:56:31 -05:00
471124da6c Make DebugRendering testable 2023-02-21 23:56:31 -05:00
58cec976d9 Rename Output to Rendering
Callers have to send the chars somewhere now.
2023-02-21 23:56:31 -05:00
5383798ea6 Rename render to draw
I want rendering to be a different step which aggregates canvases together into the final output.
2023-02-21 23:56:31 -05:00
f599129b61 Inject the whole compiler coordinate triple (#116)
This will make it easier to switch to JB Compose.

Also clean up some other version catalog stuff.
2023-02-19 05:02:40 +00:00
ca0dfec109 Switch pixels to be string-based instead of codepoint-based
The codepoint conversion is wasteful since it roundtrips back into chars anyway. A stronger motivation, however, is to support multicodepoint graphemes.
2023-01-29 22:00:25 -05:00
1ccf043908 Remove some indirection within Static 2023-01-26 22:21:23 -05:00
e199b74e8a Enable explicit API 2023-01-26 22:12:09 -05:00
cfc92c4b98 Fix programatic source set dependencies
This ensures that HMPP can correctly see our hierarchy and match it to our dependencies.
2023-01-26 15:46:00 -05:00
64a3a6ea62 Move static rendering to node side-channel
This is a bit cleaner than having the side-channel be within a TextCanvas. It also frees us up to experiment with different rendering backends more easily.
2023-01-26 00:32:27 -05:00
836e1df2c3 Rename Box to Linear
Box is z-order, this is x/y-order.
2023-01-26 00:11:08 -05:00
a1a42bf4ee Don't be a chump and expose runMosaicBlocking everywhere
Or, at least, everywhere possible given our constraints.
2023-01-25 23:23:42 -05:00
2ae0256004 Change entrypoint to a suspend function
...and add support for running in JS!
2023-01-25 23:01:14 -05:00
446033de93 Use appendCodePoint from library 2023-01-24 11:33:51 -05:00
20e36199c2 Port runtime to multiplatorm 2023-01-23 21:32:35 -05:00
5cea4425ce Use kotlin.time for debug output 2023-01-18 11:48:01 -05:00
76c4b75dd1 Reuse StringBuilder and avoid intermediate String
Reuse the StringBuilder because its backing character array is likely to be sized appropriately for the next frame. We incur a penalty of writing null chars into the whole array, but we would pay that anyway with a new allocation.

Additionally, use a CharBuffer/CharEncoder/ByteBuffer combination to avoid needing to render to an intermediate String before conversion to bytes. This should avoid quite a few copies since we can write a subset of the resulting ByteBuffer rather than needing to copy it first to a perfectly-sized byte array.
2023-01-18 11:18:56 -05:00
b8808acd8a Cache calls to AnsiOutput.out
Internally it does conditionals and synchronization that we don't need every time.
2023-01-18 10:55:12 -05:00
c512de1383 Add Static component for rendering permanent output 2022-09-06 15:12:38 -04:00
1b4669672f Protect against rendering empty nodes 2022-09-03 16:12:56 -04:00
e2bbf68f2b Migrate to version catalogs 2022-09-02 21:45:25 -04:00
bacaddd89d Fix fewer lines of output causing display to drift downwards 2022-09-02 20:45:56 -04:00
08538ec896 Restructure the project to put Mosaic at the root
Samples are now in a nested build.
2022-08-11 22:38:19 -04:00