|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.android.ide.common.vectordrawable.VdPreview
public class VdPreview
Generate a Image based on the VectorDrawable's XML content.
This class also contains a main method, which can be used to preview a vector drawable file.
| Nested Class Summary | |
|---|---|
static class |
VdPreview.SourceSize
Since we allow overriding the vector drawable's size, we also need to keep the original size and aspect ratio. |
static class |
VdPreview.TargetSize
This encapsulates the information used to determine the preview image size. |
| Field Summary | |
|---|---|
static int |
MAX_PREVIEW_IMAGE_SIZE
|
static int |
MIN_PREVIEW_IMAGE_SIZE
|
| Constructor Summary | |
|---|---|
VdPreview()
|
|
| Method Summary | |
|---|---|
static java.awt.image.BufferedImage |
getPreviewFromVectorXml(VdPreview.TargetSize targetSize,
java.lang.String xmlFileContent,
java.lang.StringBuilder vdErrorLog)
This generates an image according to the VectorDrawable's content xmlFileContent. |
static VdPreview.SourceSize |
getVdOriginalSize(org.w3c.dom.Document document)
Get the vector drawable's original size. |
static java.lang.String |
overrideXmlContent(org.w3c.dom.Document document,
VdOverrideInfo info,
java.lang.StringBuilder errorLog)
The UI can override some properties of the Vector drawable. |
static org.w3c.dom.Document |
parseVdStringIntoDocument(java.lang.String xmlFileContent,
java.lang.StringBuilder errorLog)
Parse the VectorDrawable's XML file into a document object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MAX_PREVIEW_IMAGE_SIZE
public static final int MIN_PREVIEW_IMAGE_SIZE
| Constructor Detail |
|---|
public VdPreview()
| Method Detail |
|---|
@Nullable
public static org.w3c.dom.Document parseVdStringIntoDocument(@NonNull
java.lang.String xmlFileContent,
@Nullable
java.lang.StringBuilder errorLog)
xmlFileContent - the content of the VectorDrawable's XML file.errorLog - when errors were found, log them in this builder if it is not null.
public static VdPreview.SourceSize getVdOriginalSize(@NonNull
org.w3c.dom.Document document)
@Nullable
public static java.lang.String overrideXmlContent(@NonNull
org.w3c.dom.Document document,
@NonNull
VdOverrideInfo info,
@Nullable
java.lang.StringBuilder errorLog)
document - the parsed document of original VectorDrawable's XML file.info - incoming override information for VectorDrawable.errorLog - log for the parsing errors and warnings.
@Nullable
public static java.awt.image.BufferedImage getPreviewFromVectorXml(@NonNull
VdPreview.TargetSize targetSize,
@Nullable
java.lang.String xmlFileContent,
@Nullable
java.lang.StringBuilder vdErrorLog)
xmlFileContent.
At the same time, captures all the errors found during parsing.
The size of image is determined by the size.
targetSize - the size of result image.xmlFileContent - VectorDrawable's XML file's content.vdErrorLog - log for the parsing errors and warnings.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||