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
Update documentation for offscreen rendering and update ref handling #152
Update documentation for offscreen rendering and update ref handling #152
Conversation
// Draw callback | ||
const onDraw = useDrawCallback( | ||
(canvas, info) => { | ||
if (typeof ref === "function") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here ref callback aren't supported anyways.
@chrfalch no strong opinon on the ref thingy. We could revert it. |
Here's a suggestion for the doc: #152 and to have ref instead of innerRef Except for the docs, it's a green light for me 👍🏻 |
export const Demo = () => { | ||
const ref = useCanvasRef(); | ||
const onPress = useEffect(() => { | ||
setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we just add a simple button taking a snapshot? Looks a bit strange with the setTimeout call :)
|
||
## Getting a Canvas Snapshot | ||
|
||
You can save your drawings as an image, using `makeImageSnapshot`. This method will return an [Image instance](/docs/images#instance-methods). This instance can be used to do anything: drawing it via the `<Image>` component, or being saved or shared using binary or base64 encoding. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The image instance can be rendered using the Image
component, saved to disk or passed along for further processing using binary or base64 encoding."
| encodeToBytes | Encodes Image pixels, returning result as UInt8Array | | ||
| encodeToBase64 | Encodes Image pixels, returning result as a base64 encoded string | | ||
|
||
## Offscreen Drawing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be documented somewhere? Not sure where, but I think this info should be available somewhere - especially since it adds a few things on top of the available CanvasKit API.
No description provided.