Skip to content
Snippets Groups Projects
Commit 41d67259 authored by Jens Nolte's avatar Jens Nolte
Browse files

Split out image helper from picture file loading

parent a2576bfd
No related branches found
No related tags found
No related merge requests found
module Quasar.Wayland.Client.JuicyPixels (
loadImageBuffer,
toImageBuffer,
pixelRgba8ToWlARGB,
) where
......@@ -14,6 +15,10 @@ import Quasar.Wayland.Protocol.Generated
loadImageBuffer :: ShmBufferManager -> FilePath -> IO (Object 'Client Interface_wl_buffer)
loadImageBuffer shm path = do
image <- either fail (pure . convertRGBA8) =<< readImage path
toImageBuffer shm image
toImageBuffer :: ShmBufferManager -> Image PixelRGBA8 -> IO (Object 'Client Interface_wl_buffer)
toImageBuffer shm image = do
(buffer, ptr) <- newShmBuffer shm (fromIntegral (imageWidth image)) (fromIntegral (imageHeight image))
let
width = imageWidth image
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment