Class Svg2ComposeConverter

  • All Implemented Interfaces:

    
    public final class Svg2ComposeConverter
    
                        

    SVG to Compose converter using the DevSrSouza/svg-to-compose library

    This converter properly parses SVG files and generates Compose ImageVector code It supports both SVG and Android Vector Drawable formats

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Unit convertDirectory(File inputDirectory, File outputDirectory, String packageName, Boolean generatePreview, String accessorName, String allAssetsPropertyName, String librarySubdir, IconNameTransformer nameTransformer) Convert SVG files from a directory to Compose code
      final Unit convertSingleFile(File svgFile, File outputFile, String packageName, String iconName) Convert a single SVG file to Compose code
      final Boolean canProcess(File file) Check if the converter can process the given file
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Svg2ComposeConverter

        Svg2ComposeConverter()
    • Method Detail

      • convertDirectory

         final Unit convertDirectory(File inputDirectory, File outputDirectory, String packageName, Boolean generatePreview, String accessorName, String allAssetsPropertyName, String librarySubdir, IconNameTransformer nameTransformer)

        Convert SVG files from a directory to Compose code

        Parameters:
        inputDirectory - Directory containing SVG files
        outputDirectory - Directory where generated Kotlin files will be saved
        packageName - Package name for generated files
        generatePreview - Whether to generate Compose preview functions
        accessorName - Name of the object that will contain all icons
        allAssetsPropertyName - Name of the property that contains all icons
        librarySubdir - Optional subdirectory name for organizing icons by library (e.g.
        nameTransformer - Custom naming transformer for icon class names.
      • convertSingleFile

         final Unit convertSingleFile(File svgFile, File outputFile, String packageName, String iconName)

        Convert a single SVG file to Compose code

        Parameters:
        svgFile - The SVG file to convert
        outputFile - The output Kotlin file
        packageName - Package name for the generated file
        iconName - Name of the generated icon