-
-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(canvas): implement half block marker #550
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
joshka
requested review from
orhun,
mindoodoo,
sayanarijit,
sophacles and
kdheepak
as code owners
September 30, 2023 04:04
Codecov Report
@@ Coverage Diff @@
## main #550 +/- ##
==========================================
+ Coverage 89.51% 89.53% +0.02%
==========================================
Files 41 41
Lines 11451 11557 +106
==========================================
+ Hits 10250 10348 +98
- Misses 1201 1209 +8
|
A useful technique for the terminal is to use half blocks to draw a grid of "pixels" on the screen. Because we can set two colors per cell, and because terminal cells are about twice as tall as they are wide, we can draw a grid of half blocks that looks like a grid of square pixels. This commit adds a new `HalfBlock` marker that can be used in the Canvas widget and the associated HalfBlockGrid. Also updated demo2 to use the new marker as it looks much nicer.
joshka
force-pushed
the
canvas-half-block
branch
from
September 30, 2023 04:18
be56df3
to
92e024b
Compare
kdheepak
reviewed
Sep 30, 2023
kdheepak
reviewed
Sep 30, 2023
correct the error in my understanding of the coordinate systems, change halfblock cells to pixels, update demo2, document the half block algorithm
kdheepak
reviewed
Sep 30, 2023
kdheepak
reviewed
Sep 30, 2023
kdheepak
reviewed
Sep 30, 2023
kdheepak
reviewed
Sep 30, 2023
kdheepak
reviewed
Sep 30, 2023
Comments addressed in c831448 |
kdheepak
approved these changes
Sep 30, 2023
Awesome! Excited to see what people make with this! |
tonogdlp
pushed a commit
to tonogdlp/ratatui
that referenced
this pull request
Oct 6, 2023
* feat(canvas): implement half block marker A useful technique for the terminal is to use half blocks to draw a grid of "pixels" on the screen. Because we can set two colors per cell, and because terminal cells are about twice as tall as they are wide, we can draw a grid of half blocks that looks like a grid of square pixels. This commit adds a new `HalfBlock` marker that can be used in the Canvas widget and the associated HalfBlockGrid. Also updated demo2 to use the new marker as it looks much nicer. Adds docs for many of the methods and structs on canvas. Changes the grid resolution method to return the pixel count rather than the index of the last pixel. This is an internal detail with no user impact.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A useful technique for the terminal is to use half blocks to draw a grid
of "pixels" on the screen. Because we can set two colors per cell, and
because terminal cells are about twice as tall as they are wide, we can
draw a grid of half blocks that looks like a grid of square pixels.
This commit adds a new
HalfBlock
marker that can be used in the Canvaswidget and the associated HalfBlockGrid.