MCPcopy Index your code
hub / github.com/simstudioai/sim / resolveBlipOpacity

Function resolveBlipOpacity

apps/sim/lib/pptx-renderer/renderer/image-renderer.ts:190–209  ·  view source on GitHub ↗

* Resolve overall image opacity from OOXML blip alpha modifiers. * * Supported today: * - alphaModFix amt="N" * - alphaMod val="N" * - alphaOff val="N"

(blip: SafeXmlNode)

Source from the content-addressed store, hash-verified

188 * - alphaOff val="N"
189 */
190function resolveBlipOpacity(blip: SafeXmlNode): number {
191 let alpha = 1
192
193 const alphaModFix = blip.child('alphaModFix')
194 if (alphaModFix.exists()) {
195 alpha *= (alphaModFix.numAttr('amt') ?? 100000) / 100000
196 }
197
198 const alphaMod = blip.child('alphaMod')
199 if (alphaMod.exists()) {
200 alpha *= (alphaMod.numAttr('val') ?? 100000) / 100000
201 }
202
203 const alphaOff = blip.child('alphaOff')
204 if (alphaOff.exists()) {
205 alpha += (alphaOff.numAttr('val') ?? 0) / 100000
206 }
207
208 return Math.max(0, Math.min(1, alpha))
209}
210
211/**
212 * Render a video element inside the wrapper.

Callers 1

renderImageFunction · 0.85

Calls 3

childMethod · 0.80
existsMethod · 0.80
numAttrMethod · 0.80

Tested by

no test coverage detected