sdfsdfs
This commit is contained in:
31
node_modules/pixi.js/lib/scene/text/utils/getPo2TextureFromSource.js
generated
vendored
Normal file
31
node_modules/pixi.js/lib/scene/text/utils/getPo2TextureFromSource.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
var TexturePool = require('../../../rendering/renderers/shared/texture/TexturePool.js');
|
||||
var Bounds = require('../../container/bounds/Bounds.js');
|
||||
|
||||
"use strict";
|
||||
const tempBounds = new Bounds.Bounds();
|
||||
function getPo2TextureFromSource(image, width, height, resolution) {
|
||||
const bounds = tempBounds;
|
||||
bounds.minX = 0;
|
||||
bounds.minY = 0;
|
||||
bounds.maxX = image.width / resolution | 0;
|
||||
bounds.maxY = image.height / resolution | 0;
|
||||
const texture = TexturePool.TexturePool.getOptimalTexture(
|
||||
bounds.width,
|
||||
bounds.height,
|
||||
resolution,
|
||||
false
|
||||
);
|
||||
texture.source.uploadMethodId = "image";
|
||||
texture.source.resource = image;
|
||||
texture.source.alphaMode = "premultiply-alpha-on-upload";
|
||||
texture.frame.width = width / resolution;
|
||||
texture.frame.height = height / resolution;
|
||||
texture.source.emit("update", texture.source);
|
||||
texture.updateUvs();
|
||||
return texture;
|
||||
}
|
||||
|
||||
exports.getPo2TextureFromSource = getPo2TextureFromSource;
|
||||
//# sourceMappingURL=getPo2TextureFromSource.js.map
|
Reference in New Issue
Block a user