(self, ctx: PipelineContext)
| 170 | |
| 171 | class 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" |
nothing calls this directly
no test coverage detected