Search in sources :

Example 1 with AssetStudioGraphicGeneratorContext

use of com.android.tools.idea.npw.assetstudio.AssetStudioGraphicGeneratorContext in project android by JetBrains.

the class AndroidIconGenerator method generateIntoMemory.

/**
   * Generate icons into a map in memory. This is useful for generating previews.
   *
   * {@link #sourceAsset()} must both be set prior to calling this method or an exception will be
   * thrown.
   */
@NotNull
public final CategoryIconMap generateIntoMemory() {
    if (!mySourceAsset.get().isPresent()) {
        throw new IllegalStateException("Can't generate icons without a source asset set first");
    }
    final Map<String, Map<String, BufferedImage>> categoryMap = newAssetMap();
    AssetStudioGraphicGeneratorContext context = new AssetStudioGraphicGeneratorContext();
    GraphicGenerator graphicGenerator = createGenerator();
    GraphicGenerator.Options options = createOptions(mySourceAsset.getValue());
    graphicGenerator.generate(null, categoryMap, context, options, myName.get());
    return new CategoryIconMap(categoryMap);
}
Also used : AssetStudioGraphicGeneratorContext(com.android.tools.idea.npw.assetstudio.AssetStudioGraphicGeneratorContext) GraphicGenerator(com.android.assetstudiolib.GraphicGenerator) Map(java.util.Map) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

GraphicGenerator (com.android.assetstudiolib.GraphicGenerator)1 AssetStudioGraphicGeneratorContext (com.android.tools.idea.npw.assetstudio.AssetStudioGraphicGeneratorContext)1 Map (java.util.Map)1 NotNull (org.jetbrains.annotations.NotNull)1