MCPcopy
hub / github.com/processing/p5.js / _getTextureDataFromSource

Method _getTextureDataFromSource

src/webgl/p5.Texture.js:93–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91 }
92
93 _getTextureDataFromSource () {
94 let textureData;
95 if (this.isFramebufferTexture) {
96 textureData = this.src.rawTexture();
97 } else if (this.isSrcP5Image) {
98 // param is a p5.Image
99 textureData = this.src.canvas;
100 } else if (
101 this.isSrcMediaElement ||
102 this.isSrcHTMLElement
103 ) {
104 // createCapture elements that are flipped need
105 // to go through a canvas
106 if (this.isSrcMediaElement && this.src.flipped) {
107 this.src._ensureCanvas();
108 textureData = this.src.canvas;
109 } else {
110 // if param is a video HTML element
111 if (this.src._checkIfTextureNeedsUpdate) {
112 this.src._checkIfTextureNeedsUpdate();
113 }
114 textureData = this.src.elt;
115 }
116 } else if (this.isSrcP5Graphics || this.isSrcP5Renderer) {
117 textureData = this.src.canvas;
118 } else if (this.isImageData) {
119 textureData = this.src;
120 }
121 return textureData;
122 }
123
124 /**
125 * Initializes common texture parameters, creates a gl texture,

Callers 3

constructorMethod · 0.95
updateMethod · 0.95
setWebGLTextureParamsFunction · 0.45

Calls 3

rawTextureMethod · 0.80
_ensureCanvasMethod · 0.80

Tested by

no test coverage detected