MCPcopy
hub / github.com/THU-MAIC/OpenMAIC / getGradientFill

Function getGradientFill

packages/@openmaic/importer/src1/fill.js:181–206  ·  view source on GitHub ↗
(node, warpObj)

Source from the content-addressed store, hash-verified

179}
180
181export function getGradientFill(node, warpObj) {
182 const gsLst = node['a:gsLst']['a:gs']
183 const colors = []
184 for (let i = 0; i < gsLst.length; i++) {
185 const lo_color = getSolidFill(gsLst[i], undefined, undefined, warpObj)
186 const pos = getTextByPathList(gsLst[i], ['attrs', 'pos'])
187
188 colors[i] = {
189 pos: pos ? (pos / 1000 + '%') : '',
190 color: lo_color,
191 }
192 }
193 const lin = node['a:lin']
194 let rot = 0
195 let pathType = 'line'
196 if (lin) rot = angleToDegrees(lin['attrs']['ang'])
197 else {
198 const path = node['a:path']
199 if (path && path['attrs'] && path['attrs']['path']) pathType = path['attrs']['path']
200 }
201 return {
202 rot,
203 path: pathType,
204 colors: colors.sort((a, b) => parseInt(a.pos) - parseInt(b.pos)),
205 }
206}
207
208export function getPatternFill(node, warpObj) {
209 if (!node) return null

Callers 3

getFontColorFunction · 0.90
getShapeFillFunction · 0.85
findFillInGroupHierarchyFunction · 0.85

Calls 3

getTextByPathListFunction · 0.90
angleToDegreesFunction · 0.90
getSolidFillFunction · 0.85

Tested by

no test coverage detected