You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/WebGL/Texture.elm
+102-2Lines changed: 102 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,9 @@ module WebGL.Texture
21
21
, nonPowerOfTwoOptions
22
22
, repeat
23
23
, size
24
+
,Format
25
+
, loadBytesWith
26
+
, rgb , rgba, luminanceAlpha, luminance, alpha
24
27
)
25
28
26
29
{-|
@@ -51,10 +54,11 @@ module WebGL.Texture
51
54
52
55
# Things You Shouldn’t Do
53
56
54
-
@docs nonPowerOfTwoOptions
57
+
@docs nonPowerOfTwoOptions, loadBytesWith, Format, rgb , rgba, luminanceAlpha, luminance, alpha
55
58
56
59
-}
57
-
60
+
importBitwise
61
+
importBytesexposing (Bytes)
58
62
importElm.Kernel.Texture
59
63
importTaskexposing (Task)
60
64
@@ -304,3 +308,99 @@ or other times you may want to use only a potion of a texture image.
304
308
size:Texture-> ( Int, Int )
305
309
size =
306
310
Elm.Kernel.Texture.size
311
+
312
+
313
+
314
+
{-| Building [`Texture`](#Texture) from bytes
315
+
316
+
- [`Options`](#Options) - same as for [`loadWith`](#loadWith)
317
+
318
+
- `(width, height)` - dimensions of new created texture
319
+
320
+
- [`Format`](#Format) - pixel format in bytes
321
+
322
+
- Bytes - encoded pixels, where `Bytes.width` > `width` \* `height` \* `Bytes per pixe`or you get `SizeError`
323
+
324
+
Do not generate texture in `view`, [read more about this here](https://package.elm-lang.org/packages/elm-explorations/webgl/latest#making-the-most-of-the-gpu).
325
+
326
+
-}
327
+
loadBytesWith:
328
+
Options
329
+
->(Int,Int)
330
+
->Format
331
+
->Bytes
332
+
->ResultErrorTexture
333
+
loadBytesWith { magnify, minify, horizontalWrap, verticalWrap, flipY }( w, h )(Format format bytesPerPixel) b =
0 commit comments