Skip to content

Feature request: method to extract raw bytes from Image #594

@euclio

Description

@euclio

I am working on an application that uses Piet for backend-agnostic graphics. Occasionally, I need to capture a region of the canvas and pass the raw bitmap to another part of the application. Unfortunately, as far as I can tell the only use of a piet::Image is to pass it back to the context for drawing.

Currently, I am relying on knowledge of the backend to (very unsafely) transmute the Image to the underlying backend's Image implementation, which exposes methods to get the raw bytes of the bitmap.

It would be useful for Image to expose a method like this itself, so that this can be obtained safely. This would effectively be the reverse of ImageBuf::to_image. I understand that Image is intended to be a backend-specific optimized bitmap representation, so this conversion would be documented as potentially being expensive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions