Class Svg2ComposeConverter
-
- All Implemented Interfaces:
public final class Svg2ComposeConverterSVG 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
-
-
Constructor Summary
Constructors Constructor Description Svg2ComposeConverter()
-
Method Summary
Modifier and Type Method Description final UnitconvertDirectory(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 UnitconvertSingleFile(File svgFile, File outputFile, String packageName, String iconName)Convert a single SVG file to Compose code final BooleancanProcess(File file)Check if the converter can process the given file -
-
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 filesoutputDirectory- Directory where generated Kotlin files will be savedpackageName- Package name for generated filesgeneratePreview- Whether to generate Compose preview functionsaccessorName- Name of the object that will contain all iconsallAssetsPropertyName- Name of the property that contains all iconslibrarySubdir- 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 convertoutputFile- The output Kotlin filepackageName- Package name for the generated fileiconName- Name of the generated icon
-
canProcess
final Boolean canProcess(File file)
Check if the converter can process the given file
-
-
-
-