Quantcast
Channel: Pixi.js Latest Topics
Viewing all articles
Browse latest Browse all 3978

Sprite from buffer

$
0
0

I am trying to display an image that I get in the form of Uint8Array.

/*
width: 640,
height: 360,
data: Uint8Array(921600) [
     89,  72, 34, 255,  97,  80, 42, 255, 105,  93, 43, 255,
    117, 105, 55, 255, 117, 106, 49, 255, 110,  99, 42, 255,
    111,  98, 31, 255, 111,  98, 31, 255, 115, 107, 22, 255,
    117, 109, 24, 255, 119, 115, 16, 255, 117, 113, 14, 255,
    127, 121, 13, 255, 131, 125, 17, 255, 144, 126, 30, 255,
    146, 128, 32, 255, 143, 131, 35, 255, 135, 123, 27, 255,
    130, 112, 26, 255, 127, 109, 23, 255, 129, 103, 32, 255,
    126, 100, 29, 255, 125,  94, 28, 255, 123,  92, 26, 255,
    121,  80, 20, 255,
    ... 921500 more items
*/

const imageTexture = PIXI.Texture.fromBuffer(data, width, height);
const sprite = PIXI.Sprite(imageTexture);

Is there something else I have to do so that the Sprite displays the Texture?

If I create imageTexture using PIXI.Loader, then it works.


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>