skia-canvas icon indicating copy to clipboard operation
skia-canvas copied to clipboard

Load raw pixels buffer into Image?

Open GEEKiDoS opened this issue 2 years ago • 2 comments

I'm working with games and need to load the dds or textures in assetbundle(unity) into Image. But seems there's no method that I can just feed decoded pixels into it.

GEEKiDoS avatar Aug 27 '22 07:08 GEEKiDoS

Would be great to have a way to create image from raw decoded pixel buffer.

ggolda avatar Aug 09 '23 20:08 ggolda

@samizdatco currently rust based Image creates SKImage only using from_encoded_data function. Maybe there is a way to add an options object to loadImage function that accepts something like js sharp when it receives raw images:

sharp(frame, {
    raw: {
      width: 1920,
      height: 1080,
      channels: 4,
      premultiplied: true
    }
  })

As I know Skia itself supports creating SkImages from pixel buffers if you provide SkImageInfo. Would be a great addition to this library, because currently there is no way to draw frames from ffmpeg for example without double decoding :(

ggolda avatar Aug 09 '23 23:08 ggolda