File tree Expand file tree Collapse file tree 1 file changed +41
-1
lines changed Expand file tree Collapse file tree 1 file changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -311,11 +311,51 @@ defmodule Scenic.Driver do
311
311
driver :: Driver . t ( )
312
312
) :: { :ok , Driver . t ( ) }
313
313
314
+ @ typedoc """
315
+ An encoding for the bytes in a screenshot.
316
+
317
+ * `:rgba` is 32-bit `:rgba`
318
+ * `:rgb` is 24-bit `:rgb`
319
+ """
320
+ @ type screenshot_encoding_t :: :rgba | :rgb
321
+
322
+ @ typedoc """
323
+ A screenshot, a tuple consisting of
324
+
325
+ `{width, height, encoding, <bytes>}`
326
+
327
+ where
328
+
329
+ * `width` is a positive (>0) integer
330
+ * `height` is a positive (>0) integer
331
+ * `encoding` is a `screenshot_encoding_t`
332
+ * `bytes` is a bitstring frame buffer of size `width * height * <size of encoding>`
333
+
334
+ `size_of_encoding` can be 3 (for `rgb`) or 4 (for `rgba`).
335
+ """
336
+ @ type screenshot_t :: {
337
+ pos_integer ( ) ,
338
+ pos_integer ( ) ,
339
+ screenshot_encoding_t ,
340
+ bitstring ( )
341
+ }
342
+
343
+ @ doc """
344
+ Called to get a screenshot of the current backbuffer.
345
+
346
+ This is a synchronous call in order to support remote/web drivers.
347
+
348
+ This callback is optional.
349
+ """
350
+ @ callback take_screenshot ( driver :: Driver . t ( ) ) ::
351
+ { :ok , :not_supported } | { :ok , screenshot_t , Driver . t ( ) }
352
+
314
353
@ optional_callbacks reset_scene: 1 ,
315
354
request_input: 2 ,
316
355
update_scene: 2 ,
317
356
del_scripts: 2 ,
318
- clear_color: 2
357
+ clear_color: 2 ,
358
+ take_screenshot: 1
319
359
320
360
# ===========================================================================
321
361
defmodule Error do
You can’t perform that action at this time.
0 commit comments