feat(framebuffer): Export framebuffer, to be consumed by external crates#105
Merged
j-g00da merged 1 commit intoratatui:mainfrom Jul 4, 2025
Merged
feat(framebuffer): Export framebuffer, to be consumed by external crates#105j-g00da merged 1 commit intoratatui:mainfrom
j-g00da merged 1 commit intoratatui:mainfrom
Conversation
j-g00da
reviewed
Jul 3, 2025
Member
j-g00da
left a comment
There was a problem hiding this comment.
Thanks, added some docs suggestions
mousefood/src/framebuffer.rs
Outdated
Comment on lines
+1
to
+8
| //! # Framebuffer | ||
| //! | ||
| //! | ||
| //! A framebuffer can be used to contain new pixels of a new frame before being displayed. | ||
| //! | ||
| //! Some display driver write pixels directly on the display, which can cause some screen tearing. | ||
| //! | ||
| //! Mousefood can provide a framebuffer ready to be used. |
Member
There was a problem hiding this comment.
Suggested change
| //! # Framebuffer | |
| //! | |
| //! | |
| //! A framebuffer can be used to contain new pixels of a new frame before being displayed. | |
| //! | |
| //! Some display driver write pixels directly on the display, which can cause some screen tearing. | |
| //! | |
| //! Mousefood can provide a framebuffer ready to be used. | |
| //! # Framebuffer | |
| //! | |
| //! A framebuffer implementation for storing pixels in memory before rendering to a display. | |
| //! | |
| //! This module provides [`HeapBuffer`], a heap-allocated framebuffer that can be used | |
| //! with display drivers that don't provide their own internal framebuffer. This helps | |
| //! prevent screen tearing by allowing you to compose a complete frame in memory before | |
| //! sending it to the display. |
mousefood/src/framebuffer.rs
Outdated
Comment on lines
+20
to
+22
| /// Framebuffer holding pixels, waiting to be drawn to the real display. | ||
| /// | ||
| /// Created to be used in mousefood with a display driver not providing an internal framebuffer. |
Member
There was a problem hiding this comment.
Suggested change
| /// Framebuffer holding pixels, waiting to be drawn to the real display. | |
| /// | |
| /// Created to be used in mousefood with a display driver not providing an internal framebuffer. | |
| /// A heap-allocated framebuffer for storing pixels before rendering to a display. | |
| /// | |
| /// `HeapBuffer` provides a memory-based framebuffer that can be used with display drivers | |
| /// that don't have their own internal framebuffer. This helps prevent screen tearing by | |
| /// allowing you to compose a complete frame in memory before sending it to the display. | |
| /// | |
| /// The framebuffer is generic over any pixel color type that implements [`PixelColor`] | |
| /// and [`Copy`]. It stores pixels in a contiguous `Vec<C>` arranged in row-major order. | |
| /// | |
| /// # Type Parameters | |
| /// | |
| /// * `C` - The pixel color type. Must implement [`PixelColor`] and [`Copy`]. |
mousefood/src/framebuffer.rs
Outdated
Comment on lines
+29
to
+33
| /// Create a new framebuffer with defined dimensions | ||
| /// | ||
| /// # Arguments | ||
| /// | ||
| /// * `bounding_box` - The dimensions of the framebuffer |
Member
There was a problem hiding this comment.
Suggested change
| /// Create a new framebuffer with defined dimensions | |
| /// | |
| /// # Arguments | |
| /// | |
| /// * `bounding_box` - The dimensions of the framebuffer | |
| /// Creates a new framebuffer with the specified dimensions. | |
| /// | |
| /// The framebuffer is initialized with a background color derived from [`Color::Reset`]. | |
| /// | |
| /// # Arguments | |
| /// | |
| /// * `bounding_box` - A [`Rectangle`] defining the position and size of the framebuffer. | |
| /// The framebuffer will have `width × height` pixels, where width and height | |
| /// are taken from the rectangle's size. | |
| /// | |
| /// # Returns | |
| /// | |
| /// A new [`HeapBuffer`] instance with the specified dimensions, initialized with | |
| /// the default background color. | |
| /// | |
| /// # Memory Usage | |
| /// | |
| /// This method allocates `width × height × sizeof(C)` bytes of memory on the heap, | |
| /// where `C` is the pixel color type. |
Member
|
(I know these are more detailed than most docs in the project. I want to rewrite all docs before v0.3 release.) |
ea3b932 to
86304f7
Compare
Contributor
Author
|
It's all good! Thanks for the better docs! |
j-g00da
approved these changes
Jul 4, 2025
Merged
This file contains hidden or 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
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.
No description provided.