slint-ui/slint · error

converting from a signed distance field to an image

Error message

converting from a signed distance field to an image

What it means

Error "converting from a signed distance field to an image" thrown in slint-ui/slint.

Source

Thrown at internal/core/graphics/image.rs:517

                                    }
                                });
                                slice.fill_with(|| iter.next().unwrap());
                            }
                            TexturePixelFormat::AlphaMap => {
                                let col = t.color.to_argb_u8();
                                let mut iter = source.iter().map(|p| {
                                    let a = *p as u32 * col.alpha as u32;
                                    Rgba8Pixel {
                                        r: (col.red as u32 * a / (255 * 255)) as u8,
                                        g: (col.green as u32 * a / (255 * 255)) as u8,
                                        b: (col.blue as u32 * a / (255 * 255)) as u8,
                                        a: (a / 255) as u8,
                                    }
                                });
                                slice.fill_with(|| iter.next().unwrap());
                            }
                            TexturePixelFormat::SignedDistanceField => {
                                todo!("converting from a signed distance field to an image")
                            }
                        };
                    }
                }
                Some(SharedImageBuffer::RGBA8Premultiplied(buffer))
            }
            ImageInner::NineSlice(nine) => nine.0.render_to_buffer(None),
            _ => None,
        }
    }

    /// Returns true if the image is an SVG (either backed by resvg or HTML image wrapper).
    pub fn is_svg(&self) -> bool {
        match self {
            #[cfg(feature = "svg")]
            Self::Svg(_) => true,
            #[cfg(target_arch = "wasm32")]
            Self::HTMLImage(html_image) => html_image.is_svg(),

View on GitHub (pinned to 3fd8f2ec03)

Solutions

  1. Convert the signed distance field to a regular image before this operation.
  2. Avoid using SDF images where a bitmap image is required.

When it happens

Trigger: Thrown at internal/core/graphics/image.rs:517 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of slint-ui/slint@3fd8f2ec03 (2026-08-19). Data as JSON: /api/errors/40a8cf7751f77042. Report an issue: GitHub.