MCPcopy
hub / github.com/leslievan/semi-utils / process

Method process

processor/generators.py:172–188  ·  view source on GitHub ↗
(self, ctx: PipelineContext)

Source from the content-addressed store, hash-verified

170
171class GradientColorGenerator(Generator):
172 def process(self, ctx: PipelineContext):
173 width, height = ctx.get("width"), ctx.get("height")
174 start_color = ctx.get("start_color")
175 end_color = ctx.get("end_color")
176 direction = ctx.getenum("direction", Direction.HORIZONTAL, Direction) # horizontal, vertical, diagonal
177 method = ctx.getenum("interpolate_method", InterpolateMethod.LINEAR, InterpolateMethod)
178
179 start_rgba = _parse_color(start_color)
180 end_rgba = _parse_color(end_color)
181
182 image = _draw_gradient_numpy(
183 width, height,
184 start_rgba, end_rgba,
185 direction, method
186 )
187
188 ctx.update_buffer([image]).save_buffer(self.name()).success()
189
190 def name(self) -> str:
191 return "gradient_color"

Callers

nothing calls this directly

Calls 8

nameMethod · 0.95
_parse_colorFunction · 0.90
_draw_gradient_numpyFunction · 0.85
getenumMethod · 0.80
successMethod · 0.80
save_bufferMethod · 0.80
update_bufferMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected