├── .classpath
├── .gitignore
├── .project
├── .settings
├── org.eclipse.core.resources.prefs
├── org.eclipse.jdt.core.prefs
├── org.eclipse.jdt.ui.prefs
└── org.eclipse.m2e.core.prefs
├── LICENSE
├── NOTICE
├── README.md
├── docs
├── allclasses-frame.html
├── allclasses-noframe.html
├── com
│ └── larvalabs
│ │ └── svgandroid
│ │ ├── ParserHelper.html
│ │ ├── SVG.html
│ │ ├── SVGParseException.html
│ │ ├── SVGParser.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
├── constant-values.html
├── deprecated-list.html
├── help-doc.html
├── index-all.html
├── index.html
├── overview-tree.html
├── package-list
├── resources
│ └── inherit.gif
├── serialized-form.html
└── stylesheet.css
├── pom.xml
└── src
└── main
└── java
└── com
└── larvalabs
└── svgandroid
├── ParserHelper.java
├── SVG.java
├── SVGBuilder.java
├── SVGColors.java
├── SVGDrawable.java
├── SVGParseException.java
├── SVGParser.java
└── package-info.java
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | ~*.sw[p-z]
3 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | svg-android
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.m2e.core.maven2Nature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding//src/main/java=UTF-8
3 | encoding/=UTF-8
4 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
3 | org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
4 | org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
5 | org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
6 | org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
7 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
8 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
9 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
10 | org.eclipse.jdt.core.compiler.compliance=1.6
11 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
12 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
13 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
14 | org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
15 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
16 | org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
17 | org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
18 | org.eclipse.jdt.core.compiler.problem.deadCode=warning
19 | org.eclipse.jdt.core.compiler.problem.deprecation=warning
20 | org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
21 | org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
22 | org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
23 | org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
24 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
25 | org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
26 | org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
27 | org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
28 | org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
29 | org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
30 | org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
31 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
32 | org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
33 | org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
34 | org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
35 | org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
36 | org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
37 | org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
38 | org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
39 | org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
40 | org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
41 | org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
42 | org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
43 | org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
44 | org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
45 | org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
46 | org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
47 | org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
48 | org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
49 | org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
50 | org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
51 | org.eclipse.jdt.core.compiler.problem.nullReference=warning
52 | org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
53 | org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
54 | org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
55 | org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
56 | org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
57 | org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
58 | org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
59 | org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
60 | org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
61 | org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
62 | org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
63 | org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
64 | org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
65 | org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
66 | org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
67 | org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
68 | org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
69 | org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
70 | org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
71 | org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
72 | org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
73 | org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
74 | org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
75 | org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
76 | org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
77 | org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
78 | org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
79 | org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
80 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
81 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
82 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
83 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
84 | org.eclipse.jdt.core.compiler.problem.unusedImport=warning
85 | org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
86 | org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
87 | org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
88 | org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
89 | org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
90 | org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
91 | org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
92 | org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
93 | org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
94 | org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
95 | org.eclipse.jdt.core.compiler.processAnnotations=disabled
96 | org.eclipse.jdt.core.compiler.source=1.6
97 | org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
98 | org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,LOW
99 | org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,DELME,TODOC
100 | org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
101 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=32
102 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16
103 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
104 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
105 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
106 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
107 | org.eclipse.jdt.core.formatter.alignment_for_assignment=16
108 | org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
109 | org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
110 | org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
111 | org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
112 | org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
113 | org.eclipse.jdt.core.formatter.alignment_for_method_declaration=16
114 | org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
115 | org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
116 | org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
117 | org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=84
118 | org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
119 | org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=32
120 | org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=32
121 | org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=32
122 | org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=32
123 | org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=32
124 | org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
125 | org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
126 | org.eclipse.jdt.core.formatter.blank_lines_after_package=1
127 | org.eclipse.jdt.core.formatter.blank_lines_before_field=0
128 | org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
129 | org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
130 | org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
131 | org.eclipse.jdt.core.formatter.blank_lines_before_method=1
132 | org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
133 | org.eclipse.jdt.core.formatter.blank_lines_before_package=0
134 | org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
135 | org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
136 | org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
137 | org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
138 | org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
139 | org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
140 | org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
141 | org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
142 | org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
143 | org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
144 | org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
145 | org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
146 | org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
147 | org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
148 | org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
149 | org.eclipse.jdt.core.formatter.comment.format_block_comments=true
150 | org.eclipse.jdt.core.formatter.comment.format_header=true
151 | org.eclipse.jdt.core.formatter.comment.format_html=true
152 | org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
153 | org.eclipse.jdt.core.formatter.comment.format_line_comments=true
154 | org.eclipse.jdt.core.formatter.comment.format_source_code=true
155 | org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
156 | org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
157 | org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
158 | org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
159 | org.eclipse.jdt.core.formatter.comment.line_length=120
160 | org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
161 | org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
162 | org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
163 | org.eclipse.jdt.core.formatter.compact_else_if=true
164 | org.eclipse.jdt.core.formatter.continuation_indentation=2
165 | org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
166 | org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
167 | org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
168 | org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
169 | org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
170 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
171 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
172 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
173 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
174 | org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
175 | org.eclipse.jdt.core.formatter.indent_empty_lines=false
176 | org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
177 | org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
178 | org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
179 | org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
180 | org.eclipse.jdt.core.formatter.indentation.size=4
181 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=do not insert
182 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=do not insert
183 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
184 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
185 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
186 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
187 | org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
188 | org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
189 | org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
190 | org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
191 | org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
192 | org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
193 | org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
194 | org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
195 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
196 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
197 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
198 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
199 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
200 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
201 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
202 | org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
203 | org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
204 | org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
205 | org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
206 | org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
207 | org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
208 | org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
209 | org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
210 | org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
211 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
212 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
213 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
214 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
215 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
216 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
217 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
218 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
219 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
220 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
221 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
222 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
223 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
224 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
225 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
226 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
227 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
228 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
229 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
230 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
231 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
232 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
233 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
234 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
235 | org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
236 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
237 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
238 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
239 | org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
240 | org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
241 | org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
242 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
243 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
244 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
245 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
246 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
247 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
248 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
249 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
250 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
251 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
252 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
253 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
254 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
255 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
256 | org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
257 | org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
258 | org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
259 | org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
260 | org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
261 | org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
262 | org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
263 | org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
264 | org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
265 | org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
266 | org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
267 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
268 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
269 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
270 | org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
271 | org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
272 | org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
273 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
274 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
275 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
276 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
277 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
278 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
279 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
280 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
281 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
282 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
283 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
284 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
285 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
286 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
287 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
288 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
289 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
290 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
291 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
292 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
293 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
294 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
295 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
296 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
297 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
298 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
299 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
300 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
301 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
302 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
303 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
304 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
305 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
306 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
307 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
308 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
309 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
310 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
311 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
312 | org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
313 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
314 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
315 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
316 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
317 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
318 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
319 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
320 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
321 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
322 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
323 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
324 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
325 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
326 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
327 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
328 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
329 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
330 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
331 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
332 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
333 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
334 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
335 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
336 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
337 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
338 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
339 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
340 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
341 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
342 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
343 | org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
344 | org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
345 | org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
346 | org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
347 | org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
348 | org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
349 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
350 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
351 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
352 | org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
353 | org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
354 | org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
355 | org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
356 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
357 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
358 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
359 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
360 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
361 | org.eclipse.jdt.core.formatter.join_lines_in_comments=true
362 | org.eclipse.jdt.core.formatter.join_wrapped_lines=true
363 | org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
364 | org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
365 | org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
366 | org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
367 | org.eclipse.jdt.core.formatter.lineSplit=120
368 | org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
369 | org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
370 | org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
371 | org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
372 | org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
373 | org.eclipse.jdt.core.formatter.tabulation.char=tab
374 | org.eclipse.jdt.core.formatter.tabulation.size=4
375 | org.eclipse.jdt.core.formatter.use_on_off_tags=true
376 | org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
377 | org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
378 | org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
379 | org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
380 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.ui.prefs:
--------------------------------------------------------------------------------
1 | cleanup.add_default_serial_version_id=true
2 | cleanup.add_generated_serial_version_id=false
3 | cleanup.add_missing_annotations=true
4 | cleanup.add_missing_deprecated_annotations=true
5 | cleanup.add_missing_methods=false
6 | cleanup.add_missing_nls_tags=false
7 | cleanup.add_missing_override_annotations=true
8 | cleanup.add_missing_override_annotations_interface_methods=true
9 | cleanup.add_serial_version_id=false
10 | cleanup.always_use_blocks=true
11 | cleanup.always_use_parentheses_in_expressions=false
12 | cleanup.always_use_this_for_non_static_field_access=false
13 | cleanup.always_use_this_for_non_static_method_access=false
14 | cleanup.convert_to_enhanced_for_loop=false
15 | cleanup.correct_indentation=true
16 | cleanup.format_source_code=true
17 | cleanup.format_source_code_changes_only=false
18 | cleanup.make_local_variable_final=true
19 | cleanup.make_parameters_final=false
20 | cleanup.make_private_fields_final=true
21 | cleanup.make_type_abstract_if_missing_method=false
22 | cleanup.make_variable_declarations_final=false
23 | cleanup.never_use_blocks=false
24 | cleanup.never_use_parentheses_in_expressions=true
25 | cleanup.organize_imports=true
26 | cleanup.qualify_static_field_accesses_with_declaring_class=false
27 | cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
28 | cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
29 | cleanup.qualify_static_member_accesses_with_declaring_class=true
30 | cleanup.qualify_static_method_accesses_with_declaring_class=false
31 | cleanup.remove_private_constructors=true
32 | cleanup.remove_trailing_whitespaces=true
33 | cleanup.remove_trailing_whitespaces_all=true
34 | cleanup.remove_trailing_whitespaces_ignore_empty=false
35 | cleanup.remove_unnecessary_casts=true
36 | cleanup.remove_unnecessary_nls_tags=true
37 | cleanup.remove_unused_imports=true
38 | cleanup.remove_unused_local_variables=false
39 | cleanup.remove_unused_private_fields=true
40 | cleanup.remove_unused_private_members=false
41 | cleanup.remove_unused_private_methods=true
42 | cleanup.remove_unused_private_types=true
43 | cleanup.sort_members=false
44 | cleanup.sort_members_all=false
45 | cleanup.use_blocks=true
46 | cleanup.use_blocks_only_for_return_and_throw=false
47 | cleanup.use_parentheses_in_expressions=false
48 | cleanup.use_this_for_non_static_field_access=false
49 | cleanup.use_this_for_non_static_field_access_only_if_necessary=true
50 | cleanup.use_this_for_non_static_method_access=false
51 | cleanup.use_this_for_non_static_method_access_only_if_necessary=true
52 | cleanup_profile=_SvgAndroid
53 | cleanup_settings_version=2
54 | eclipse.preferences.version=1
55 | editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
56 | formatter_profile=_SvgAndroid
57 | formatter_settings_version=12
58 | org.eclipse.jdt.ui.ignorelowercasenames=true
59 | org.eclipse.jdt.ui.importorder=android;java;javax;com;org;com.larvalabs.svgandroid;
60 | org.eclipse.jdt.ui.javadoc=true
61 | org.eclipse.jdt.ui.ondemandthreshold=99
62 | org.eclipse.jdt.ui.staticondemandthreshold=99
63 | org.eclipse.jdt.ui.text.custom_code_templates=/**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * ${tags}\n *//**\n * \n *//**\n * TODOC\: ${package_name}.${type_name}\n *\n * @since ${date}\n * ${tags}\n *//**\n * \n *//**\n * ${tags}\n *//**\n * ${tags}\n * ${see_to_target}\n */${package_declaration}\n\n${typecomment}\n${type_declaration}\n\n\n\n// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();// ${todo} Auto-generated method stub\n${body_statement}${body_statement}\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};
64 | sp_cleanup.add_default_serial_version_id=true
65 | sp_cleanup.add_generated_serial_version_id=false
66 | sp_cleanup.add_missing_annotations=true
67 | sp_cleanup.add_missing_deprecated_annotations=true
68 | sp_cleanup.add_missing_methods=false
69 | sp_cleanup.add_missing_nls_tags=false
70 | sp_cleanup.add_missing_override_annotations=true
71 | sp_cleanup.add_missing_override_annotations_interface_methods=true
72 | sp_cleanup.add_serial_version_id=false
73 | sp_cleanup.always_use_blocks=true
74 | sp_cleanup.always_use_parentheses_in_expressions=false
75 | sp_cleanup.always_use_this_for_non_static_field_access=false
76 | sp_cleanup.always_use_this_for_non_static_method_access=false
77 | sp_cleanup.convert_to_enhanced_for_loop=false
78 | sp_cleanup.correct_indentation=false
79 | sp_cleanup.format_source_code=true
80 | sp_cleanup.format_source_code_changes_only=false
81 | sp_cleanup.make_local_variable_final=false
82 | sp_cleanup.make_parameters_final=false
83 | sp_cleanup.make_private_fields_final=false
84 | sp_cleanup.make_type_abstract_if_missing_method=false
85 | sp_cleanup.make_variable_declarations_final=false
86 | sp_cleanup.never_use_blocks=false
87 | sp_cleanup.never_use_parentheses_in_expressions=true
88 | sp_cleanup.on_save_use_additional_actions=true
89 | sp_cleanup.organize_imports=true
90 | sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
91 | sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
92 | sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
93 | sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
94 | sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
95 | sp_cleanup.remove_private_constructors=true
96 | sp_cleanup.remove_trailing_whitespaces=false
97 | sp_cleanup.remove_trailing_whitespaces_all=true
98 | sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
99 | sp_cleanup.remove_unnecessary_casts=true
100 | sp_cleanup.remove_unnecessary_nls_tags=false
101 | sp_cleanup.remove_unused_imports=false
102 | sp_cleanup.remove_unused_local_variables=false
103 | sp_cleanup.remove_unused_private_fields=true
104 | sp_cleanup.remove_unused_private_members=false
105 | sp_cleanup.remove_unused_private_methods=true
106 | sp_cleanup.remove_unused_private_types=true
107 | sp_cleanup.sort_members=false
108 | sp_cleanup.sort_members_all=false
109 | sp_cleanup.use_blocks=true
110 | sp_cleanup.use_blocks_only_for_return_and_throw=false
111 | sp_cleanup.use_parentheses_in_expressions=false
112 | sp_cleanup.use_this_for_non_static_field_access=false
113 | sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
114 | sp_cleanup.use_this_for_non_static_method_access=false
115 | sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
116 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | SVG Android
2 | Copyright 2011 Larva Labs LLC and Google, Inc.
3 |
4 | This product includes software developed at
5 | The Apache Software Foundation (http://www.apache.org/).
6 |
7 | ---
8 |
9 | Apache Batik
10 | Copyright 1999-2007 The Apache Software Foundation
11 |
12 | This product includes software developed at
13 | The Apache Software Foundation (http://www.apache.org/).
14 |
15 | This software contains code from the World Wide Web Consortium (W3C) for the
16 | Document Object Model API (DOM API) and SVG Document Type Definition (DTD).
17 |
18 | This software contains code from the International Organisation for
19 | Standardization for the definition of character entities used in the software's
20 | documentation.
21 |
22 | This product includes images from the Tango Desktop Project
23 | (http://tango.freedesktop.org/).
24 |
25 | This product includes images from the Pasodoble Icon Theme
26 | (http://www.jesusda.com/projects/pasodoble).
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Status: Unmaintained. Discontinued.
2 | This project is no longer being developed or maintained.
3 |
4 | ### _
5 |
6 | This is forked from the awesome but unmaintained:
7 | http://code.google.com/p/svg-android/
8 |
9 | Changes
10 | =======
11 | * Mavenised.
12 | * Added SVGBuilder to allow easy specification of SVG parsing & rendering options.
13 | * ColorFilters can now be applied.
14 | * Layer opacity and hiding is now supported.
15 | * This library now works with Robolectric.
16 | * SVG viewBox attribute is now handled.
17 | * Numbers with exponents are handled.
18 | * SVGZ (gzipped svg) auto-detected and supported. (Thank @josefpavlik & @mstevens83)
19 | * Performance enhancements.
20 | * Has most community patches applied. Great work to
21 | [josefpavlik](https://github.com/josefpavlik/svg-android) and
22 | [mrn](https://github.com/mrn/svg-android)
23 |
24 | Maven
25 | =====
26 | Add this to your Android project's pom.xml:
27 | ```xml
28 |
29 | com.github.japgolly.android
30 | svg-android
31 | 2.0.6
32 |
33 | ```
34 |
35 | Usage
36 | =====
37 |
38 | Firstly, store your SVGs in `res/raw` or `assets`.
39 |
40 | ```java
41 | // Load and parse a SVG
42 | SVG svg = new SVGBuilder()
43 | .readFromResource(getResources(), R.raw.someSvgResource) // if svg in res/raw
44 | .readFromAsset(getAssets(), "somePicture.svg") // if svg in assets
45 | // .setWhiteMode(true) // draw fills in white, doesn't draw strokes
46 | // .setColorSwap(0xFF008800, 0xFF33AAFF) // swap a single colour
47 | // .setColorFilter(filter) // run through a colour filter
48 | // .set[Stroke|Fill]ColorFilter(filter) // apply a colour filter to only the stroke or fill
49 | .build();
50 |
51 | // Draw onto a canvas
52 | canvas.drawPicture(svg.getPicture());
53 |
54 | // Turn into a drawable
55 | Drawable drawable = svg.createDrawable();
56 | // drawable.draw(canvas);
57 | // imageView.setImageDrawable(drawable);
58 | ```
59 |
--------------------------------------------------------------------------------
/docs/allclasses-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | All Classes
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | All Classes
20 |
21 |
22 |
180 | public android.graphics.drawable.PictureDrawable createPictureDrawable()
181 |
182 |
Create a picture drawable from the SVG.
183 |
184 |
185 |
186 |
Returns:
the PictureDrawable.
187 |
188 |
189 |
190 |
191 |
192 | getPicture
193 |
194 | public android.graphics.Picture getPicture()
195 |
196 |
Get the parsed SVG picture data.
197 |
198 |
199 |
200 |
Returns:
the picture.
201 |
202 |
203 |
204 |
205 |
206 | getBounds
207 |
208 | public android.graphics.RectF getBounds()
209 |
210 |
Gets the bounding rectangle for the SVG, if one was specified.
211 |
212 |
213 |
214 |
Returns:
rectangle representing the bounds.
215 |
216 |
217 |
218 |
219 |
220 | getLimits
221 |
222 | public android.graphics.RectF getLimits()
223 |
224 |
Gets the bounding rectangle for the SVG that was computed upon parsing. It may not be entirely accurate for certain curves or transformations, but is often better than nothing.
225 |
102 | Entry point for parsing SVG files for Android.
103 | Use one of the various static methods for parsing SVGs by resource, asset or input stream.
104 | Optionally, a single color can be searched and replaced in the SVG while parsing.
105 | You can also parse an svg path directly.
106 |
getSVGFromInputStream(java.io.InputStream svgData,
177 | int searchColor,
178 | int replaceColor)
179 |
180 |
181 | Parse SVG data from an input stream, replacing a single color with another color.
getSVGFromResource(android.content.res.Resources resources,
196 | int resId,
197 | int searchColor,
198 | int replaceColor)
199 |
200 |
201 | Parse SVG data from an Android application resource.
java.io.IOException - if there was a problem reading the file.
417 |
418 |
419 |
420 |
421 |
422 | parsePath
423 |
424 | public static android.graphics.Path parsePath(java.lang.String pathString)
425 |
426 |
Parses a single SVG path and returns it as a android.graphics.Path object.
427 | An example path is M250,150L150,350L350,350Z, which draws a triangle.
428 |
429 |
430 |
Parameters:
pathString - the SVG path, see the specification here.
131 | Provides a mechanism to parse a limited version of SVG Basic 1.1 files in to android.graphics.Picture
132 | objects.
133 |
134 | This allows vector graphics files to be saved out of illustration software (such as Adobe Illustrator) as SVG Basic
135 | and then used directly in an Android app. The android.graphics.Picture is a very optimized and
136 | convenient vector graphics class. Performance is very good on a wide array of Android devices.
137 |
138 | Note that only SVG features that can be directly converted in to Android graphics calls are supported.
139 | The following SVG Basic 1.1 features are not supported and will be ignored by the parser:
140 |
141 |
All text and font features.
142 |
Styles.
143 |
Symbols, conditional processing.
144 |
Patterns.
145 |
Masks, filters and views.
146 |
Interactivity, linking, scripting and animation.
147 |
148 | Even with the above features missing, users will find that most Illustrator drawings will render perfectly well on
149 | Android with this library.
150 |
151 | See the SVGParser class for instructions on how to use the parser.
152 |
84 | This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
85 | Package
86 |
87 |
88 |
89 | Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:
90 |
Interfaces (italic)
Classes
Enums
Exceptions
Errors
Annotation Types
91 |
92 |
93 | Class/Interface
94 |
95 |
96 |
97 | Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
98 |
Class inheritance diagram
Direct Subclasses
All Known Subinterfaces
All Known Implementing Classes
Class/interface declaration
Class/interface description
99 |
100 |
Nested Class Summary
Field Summary
Constructor Summary
Method Summary
101 |
102 |
Field Detail
Constructor Detail
Method Detail
103 | Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
104 |
105 |
106 | Annotation Type
107 |
108 |
109 |
110 | Each annotation type has its own separate page with the following sections:
111 |
Annotation Type declaration
Annotation Type description
Required Element Summary
Optional Element Summary
Element Detail
112 |
113 |
114 |
115 | Enum
116 |
117 |
118 |
119 | Each enum has its own separate page with the following sections:
120 |
Enum declaration
Enum description
Enum Constant Summary
Enum Constant Detail
121 |
122 |
123 | Tree (Class Hierarchy)
124 |
125 | There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
126 |
When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
127 |
128 |
129 | Deprecated API
130 |
131 | The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
132 |
133 | Index
134 |
135 | The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
136 |
137 | Prev/Next
138 | These links take you to the next or previous class, interface, package, or related page.
139 | Frames/No Frames
140 | These links show and hide the HTML frames. All pages are available with or without frames.
141 |
142 |
143 | Serialized Form
144 | Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
145 |
146 |
147 | Constant Field Values
148 | The Constant Field Values page lists the static final fields and their values.
149 |
150 |
151 |
152 | This help file applies to API documentation generated using the standard doclet.
153 |
154 |
155 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
--------------------------------------------------------------------------------
/docs/stylesheet.css:
--------------------------------------------------------------------------------
1 | /* Javadoc style sheet */
2 |
3 | /* Define colors, fonts and other style attributes here to override the defaults */
4 |
5 | /* Page background color */
6 | body { background-color: #FFFFFF; color:#000000 }
7 |
8 | /* Headings */
9 | h1 { font-size: 145% }
10 |
11 | /* Table colors */
12 | .TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */
13 | .TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */
14 | .TableRowColor { background: #FFFFFF; color:#000000 } /* White */
15 |
16 | /* Font used in left-hand frame lists */
17 | .FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
18 | .FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
19 | .FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
20 |
21 | /* Navigation bar fonts and colors */
22 | .NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */
23 | .NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */
24 | .NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;}
25 | .NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;}
26 |
27 | .NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000}
28 | .NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000}
29 |
30 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | com.github.japgolly.android
5 | svg-android
6 | 2.0.7-SNAPSHOT
7 |
8 | svg-android
9 | Brings SVG parsing and drawing functionality to Android devices. Forked from the original project at http://code.google.com/p/svg-android/.
10 |
11 | org.sonatype.oss
12 | oss-parent
13 | 7
14 |
15 | jar
16 |
17 | https://github.com/japgolly/svg-android
18 |
19 | https://github.com/japgolly/svg-android
20 | scm:git:git://github.com/japgolly/svg-android.git
21 | scm:git:ssh://git@github.com/japgolly/svg-android.git
22 |
23 |
24 |
25 |
26 | The Apache Software License, Version 2.0
27 | http://www.apache.org/licenses/LICENSE-2.0.txt
28 | repo
29 |
30 |
31 |
32 |
33 | UTF-8
34 | 1.6
35 | 1.6
36 |
37 |
38 |
39 |
40 | com.google.android
41 | android
42 | 2.1_r1
43 | provided
44 |
45 |
46 |
47 |
48 |
49 |
50 | org.apache.maven.plugins
51 | maven-source-plugin
52 |
53 |
54 | attach-sources
55 |
56 | jar
57 |
58 |
59 |
60 |
61 |
62 | org.apache.maven.plugins
63 | maven-javadoc-plugin
64 |
65 |
66 | attach-javadocs
67 |
68 | jar
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/main/java/com/larvalabs/svgandroid/ParserHelper.java:
--------------------------------------------------------------------------------
1 | package com.larvalabs.svgandroid;
2 |
3 | import java.lang.reflect.Field;
4 |
5 | /*
6 | * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
7 | * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
8 | * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
9 | * License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
10 | * applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
12 | * governing permissions and limitations under the License.
13 | */
14 | /**
15 | * Parses numbers from SVG text. Based on the Batik Number Parser (Apache 2 License).
16 | *
17 | * @author Apache Software Foundation, Larva Labs LLC
18 | */
19 | public class ParserHelper {
20 |
21 | private static final Field STRING_CHARS;
22 | static {
23 | try {
24 | STRING_CHARS = String.class.getDeclaredField("value");
25 | STRING_CHARS.setAccessible(true);
26 | } catch (Exception e) {
27 | throw new RuntimeException(e);
28 | }
29 | }
30 |
31 | private final char[] s;
32 | private final int n;
33 | private char current;
34 | public int pos;
35 |
36 | public ParserHelper(String str, int pos) {
37 | try {
38 | this.s = (char[]) STRING_CHARS.get(str);
39 | } catch (Exception e) {
40 | throw new RuntimeException(e);
41 | }
42 | this.pos = pos;
43 | n = s.length;
44 | current = s[pos];
45 | }
46 |
47 | private char read() {
48 | if (pos < n) {
49 | pos++;
50 | }
51 | if (pos == n) {
52 | return '\0';
53 | } else {
54 | return s[pos];
55 | }
56 | }
57 |
58 | public void skipWhitespace() {
59 | while (pos < n) {
60 | if (Character.isWhitespace(s[pos])) {
61 | advance();
62 | } else {
63 | break;
64 | }
65 | }
66 | }
67 |
68 | public void skipNumberSeparator() {
69 | while (pos < n) {
70 | char c = s[pos];
71 | switch (c) {
72 | case ' ':
73 | case ',':
74 | case '\n':
75 | case '\t':
76 | advance();
77 | break;
78 | default:
79 | return;
80 | }
81 | }
82 | }
83 |
84 | public void advance() {
85 | current = read();
86 | }
87 |
88 | /**
89 | * Parses the content of the buffer and converts it to a float.
90 | */
91 | public float parseFloat() {
92 | int mant = 0;
93 | int mantDig = 0;
94 | boolean mantPos = true;
95 | boolean mantRead = false;
96 |
97 | int exp = 0;
98 | int expDig = 0;
99 | int expAdj = 0;
100 | boolean expPos = true;
101 |
102 | switch (current) {
103 | case '-':
104 | mantPos = false;
105 | // fallthrough
106 | case '+':
107 | current = read();
108 | }
109 |
110 | m1: switch (current) {
111 | default:
112 | return Float.NaN;
113 |
114 | case '.':
115 | break;
116 |
117 | case '0':
118 | mantRead = true;
119 | l: for (;;) {
120 | current = read();
121 | switch (current) {
122 | case '1':
123 | case '2':
124 | case '3':
125 | case '4':
126 | case '5':
127 | case '6':
128 | case '7':
129 | case '8':
130 | case '9':
131 | break l;
132 | case '.':
133 | case 'e':
134 | case 'E':
135 | break m1;
136 | default:
137 | return 0.0f;
138 | case '0':
139 | }
140 | }
141 |
142 | case '1':
143 | case '2':
144 | case '3':
145 | case '4':
146 | case '5':
147 | case '6':
148 | case '7':
149 | case '8':
150 | case '9':
151 | mantRead = true;
152 | l: for (;;) {
153 | if (mantDig < 9) {
154 | mantDig++;
155 | mant = mant * 10 + (current - '0');
156 | } else {
157 | expAdj++;
158 | }
159 | current = read();
160 | switch (current) {
161 | default:
162 | break l;
163 | case '0':
164 | case '1':
165 | case '2':
166 | case '3':
167 | case '4':
168 | case '5':
169 | case '6':
170 | case '7':
171 | case '8':
172 | case '9':
173 | }
174 | }
175 | }
176 |
177 | if (current == '.') {
178 | current = read();
179 | m2: switch (current) {
180 | default:
181 | case 'e':
182 | case 'E':
183 | if (!mantRead) {
184 | reportUnexpectedCharacterError(current);
185 | return 0.0f;
186 | }
187 | break;
188 |
189 | case '0':
190 | if (mantDig == 0) {
191 | l: for (;;) {
192 | current = read();
193 | expAdj--;
194 | switch (current) {
195 | case '1':
196 | case '2':
197 | case '3':
198 | case '4':
199 | case '5':
200 | case '6':
201 | case '7':
202 | case '8':
203 | case '9':
204 | break l;
205 | default:
206 | if (!mantRead) {
207 | return 0.0f;
208 | }
209 | break m2;
210 | case '0':
211 | }
212 | }
213 | }
214 | case '1':
215 | case '2':
216 | case '3':
217 | case '4':
218 | case '5':
219 | case '6':
220 | case '7':
221 | case '8':
222 | case '9':
223 | l: for (;;) {
224 | if (mantDig < 9) {
225 | mantDig++;
226 | mant = mant * 10 + (current - '0');
227 | expAdj--;
228 | }
229 | current = read();
230 | switch (current) {
231 | default:
232 | break l;
233 | case '0':
234 | case '1':
235 | case '2':
236 | case '3':
237 | case '4':
238 | case '5':
239 | case '6':
240 | case '7':
241 | case '8':
242 | case '9':
243 | }
244 | }
245 | }
246 | }
247 |
248 | switch (current) {
249 | case 'e':
250 | case 'E':
251 | current = read();
252 | switch (current) {
253 | default:
254 | reportUnexpectedCharacterError(current);
255 | return 0f;
256 | case '-':
257 | expPos = false;
258 | case '+':
259 | current = read();
260 | switch (current) {
261 | default:
262 | reportUnexpectedCharacterError(current);
263 | return 0f;
264 | case '0':
265 | case '1':
266 | case '2':
267 | case '3':
268 | case '4':
269 | case '5':
270 | case '6':
271 | case '7':
272 | case '8':
273 | case '9':
274 | }
275 | case '0':
276 | case '1':
277 | case '2':
278 | case '3':
279 | case '4':
280 | case '5':
281 | case '6':
282 | case '7':
283 | case '8':
284 | case '9':
285 | }
286 |
287 | en: switch (current) {
288 | case '0':
289 | l: for (;;) {
290 | current = read();
291 | switch (current) {
292 | case '1':
293 | case '2':
294 | case '3':
295 | case '4':
296 | case '5':
297 | case '6':
298 | case '7':
299 | case '8':
300 | case '9':
301 | break l;
302 | default:
303 | break en;
304 | case '0':
305 | }
306 | }
307 |
308 | case '1':
309 | case '2':
310 | case '3':
311 | case '4':
312 | case '5':
313 | case '6':
314 | case '7':
315 | case '8':
316 | case '9':
317 | l: for (;;) {
318 | if (expDig < 3) {
319 | expDig++;
320 | exp = exp * 10 + (current - '0');
321 | }
322 | current = read();
323 | switch (current) {
324 | default:
325 | break l;
326 | case '0':
327 | case '1':
328 | case '2':
329 | case '3':
330 | case '4':
331 | case '5':
332 | case '6':
333 | case '7':
334 | case '8':
335 | case '9':
336 | }
337 | }
338 | }
339 | default:
340 | }
341 |
342 | if (!expPos) {
343 | exp = -exp;
344 | }
345 | exp += expAdj;
346 | if (!mantPos) {
347 | mant = -mant;
348 | }
349 |
350 | return buildFloat(mant, exp);
351 | }
352 |
353 | private void reportUnexpectedCharacterError(char c) {
354 | throw new RuntimeException("Unexpected char '" + c + "'.");
355 | }
356 |
357 | /**
358 | * Computes a float from mantissa and exponent.
359 | */
360 | public static float buildFloat(int mant, int exp) {
361 | if (exp < -125 || mant == 0) {
362 | return 0.0f;
363 | }
364 |
365 | if (exp >= 128) {
366 | return (mant > 0) ? Float.POSITIVE_INFINITY : Float.NEGATIVE_INFINITY;
367 | }
368 |
369 | if (exp == 0) {
370 | return mant;
371 | }
372 |
373 | if (mant >= (1 << 26)) {
374 | mant++; // round up trailing bits if they will be dropped.
375 | }
376 |
377 | return (float) ((exp > 0) ? mant * pow10[exp] : mant / pow10[-exp]);
378 | }
379 |
380 | /**
381 | * Array of powers of ten. Using double instead of float gives a tiny bit more precision.
382 | */
383 | private static final double[] pow10 = new double[128];
384 |
385 | static {
386 | for (int i = 0; i < pow10.length; i++) {
387 | pow10[i] = Math.pow(10, i);
388 | }
389 | }
390 |
391 | public float nextFloat() {
392 | skipWhitespace();
393 | float f = parseFloat();
394 | skipNumberSeparator();
395 | return f;
396 | }
397 |
398 | public int nextFlag() {
399 | skipWhitespace();
400 | int flag = current - '0';
401 | current = read();
402 | skipNumberSeparator();
403 | return flag;
404 | }
405 |
406 | }
407 |
--------------------------------------------------------------------------------
/src/main/java/com/larvalabs/svgandroid/SVG.java:
--------------------------------------------------------------------------------
1 | package com.larvalabs.svgandroid;
2 |
3 | import android.graphics.Picture;
4 | import android.graphics.RectF;
5 | import android.graphics.drawable.Drawable;
6 | import android.graphics.drawable.PictureDrawable;
7 |
8 | /*
9 | * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
10 | * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
11 | * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
12 | * License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
13 | * applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
15 | * governing permissions and limitations under the License.
16 | */
17 | /**
18 | * Describes a vector Picture object, and optionally its bounds.
19 | *
20 | * @author Larva Labs, LLC
21 | */
22 | public class SVG {
23 |
24 | /**
25 | * The parsed Picture object.
26 | */
27 | private final Picture picture;
28 |
29 | /**
30 | * These are the bounds for the SVG specified as a hidden "bounds" layer in the SVG.
31 | */
32 | private final RectF bounds;
33 |
34 | /**
35 | * These are the estimated bounds of the SVG computed from the SVG elements while parsing. Note that this could be
36 | * null if there was a failure to compute limits (ie. an empty SVG).
37 | */
38 | private RectF limits = null;
39 |
40 | private PictureDrawable drawable = null;
41 |
42 | /**
43 | * Construct a new SVG.
44 | *
45 | * @param picture the parsed picture object.
46 | * @param bounds the bounds computed from the "bounds" layer in the SVG.
47 | */
48 | SVG(Picture picture, RectF bounds) {
49 | this.picture = picture;
50 | this.bounds = bounds;
51 | }
52 |
53 | /**
54 | * Set the limits of the SVG, which are the estimated bounds computed by the parser.
55 | *
56 | * @param limits the bounds computed while parsing the SVG, may not be entirely accurate.
57 | */
58 | void setLimits(RectF limits) {
59 | this.limits = limits;
60 | }
61 |
62 | /**
63 | * Get a {@link Drawable} of the SVG.
64 | *
65 | * @return the PictureDrawable.
66 | */
67 | public PictureDrawable getDrawable() {
68 | if (drawable == null) {
69 | drawable = new PictureDrawable(picture);
70 | }
71 | return drawable;
72 | // return new PictureDrawable(picture) {
73 | // @Override
74 | // public int getIntrinsicWidth() {
75 | // if (bounds != null) {
76 | // return (int) bounds.width();
77 | // } else if (limits != null) {
78 | // return (int) limits.width();
79 | // } else {
80 | // return -1;
81 | // }
82 | // }
83 | //
84 | // @Override
85 | // public int getIntrinsicHeight() {
86 | // if (bounds != null) {
87 | // return (int) bounds.height();
88 | // } else if (limits != null) {
89 | // return (int) limits.height();
90 | // } else {
91 | // return -1;
92 | // }
93 | // }
94 | // };
95 | }
96 |
97 | /**
98 | * Get the parsed SVG picture data.
99 | *
100 | * @return the picture.
101 | */
102 | public Picture getPicture() {
103 | return picture;
104 | }
105 |
106 | /**
107 | * Gets the bounding rectangle for the SVG, if one was specified.
108 | *
109 | * @return rectangle representing the bounds.
110 | */
111 | public RectF getBounds() {
112 | return bounds;
113 | }
114 |
115 | /**
116 | * Gets the bounding rectangle for the SVG that was computed upon parsing. It may not be entirely accurate for
117 | * certain curves or transformations, but is often better than nothing.
118 | *
119 | * @return rectangle representing the computed bounds.
120 | */
121 | public RectF getLimits() {
122 | return limits;
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/src/main/java/com/larvalabs/svgandroid/SVGBuilder.java:
--------------------------------------------------------------------------------
1 | package com.larvalabs.svgandroid;
2 |
3 | import android.content.res.AssetManager;
4 | import android.content.res.Resources;
5 | import android.graphics.ColorFilter;
6 | import android.util.Log;
7 |
8 | import java.io.BufferedInputStream;
9 | import java.io.ByteArrayInputStream;
10 | import java.io.IOException;
11 | import java.io.InputStream;
12 | import java.util.zip.GZIPInputStream;
13 |
14 | import org.xml.sax.InputSource;
15 |
16 | import com.larvalabs.svgandroid.SVGParser.SVGHandler;
17 |
18 | /**
19 | * Builder for reading SVGs. Specify input, specify any parsing options (optional), then call {@link #build()} to parse
20 | * and return a {@link SVG}.
21 | *
22 | * @since 24/12/2012
23 | */
24 | public class SVGBuilder {
25 | private InputStream data;
26 | private Integer searchColor = null;
27 | private Integer replaceColor = null;
28 | private ColorFilter strokeColorFilter = null, fillColorFilter = null;
29 | private boolean whiteMode = false;
30 | private boolean overideOpacity = false;
31 | private boolean closeInputStream = true;
32 |
33 | /**
34 | * Parse SVG data from an input stream.
35 | *
36 | * @param svgData the input stream, with SVG XML data in UTF-8 character encoding.
37 | * @return the parsed SVG.
38 | */
39 | public SVGBuilder readFromInputStream(InputStream svgData) {
40 | this.data = svgData;
41 | return this;
42 | }
43 |
44 | /**
45 | * Parse SVG data from a string.
46 | *
47 | * @param svgData the string containing SVG XML data.
48 | */
49 | public SVGBuilder readFromString(String svgData) {
50 | this.data = new ByteArrayInputStream(svgData.getBytes());
51 | return this;
52 | }
53 |
54 | /**
55 | * Parse SVG data from an Android application resource.
56 | *
57 | * @param resources the Android context resources.
58 | * @param resId the ID of the raw resource SVG.
59 | */
60 | public SVGBuilder readFromResource(Resources resources, int resId) {
61 | this.data = resources.openRawResource(resId);
62 | return this;
63 | }
64 |
65 | /**
66 | * Parse SVG data from an Android application asset.
67 | *
68 | * @param assetMngr the Android asset manager.
69 | * @param svgPath the path to the SVG file in the application's assets.
70 | * @throws IOException if there was a problem reading the file.
71 | */
72 | public SVGBuilder readFromAsset(AssetManager assetMngr, String svgPath) throws IOException {
73 | this.data = assetMngr.open(svgPath);
74 | return this;
75 | }
76 |
77 | public SVGBuilder clearColorSwap() {
78 | searchColor = replaceColor = null;
79 | return this;
80 | }
81 |
82 | /**
83 | * Replaces a single colour with another.
84 | *
85 | * @param searchColor The colour in the SVG.
86 | * @param replaceColor The desired colour.
87 | */
88 | public SVGBuilder setColorSwap(int searchColor, int replaceColor) {
89 | return setColorSwap(searchColor, replaceColor, false);
90 | }
91 |
92 | /**
93 | * Replaces a single colour with another, affecting the opacity.
94 | *
95 | * @param searchColor The colour in the SVG.
96 | * @param replaceColor The desired colour.
97 | * @param overideOpacity If true, combines the opacity defined in the SVG resource with the alpha of replaceColor.
98 | */
99 | public SVGBuilder setColorSwap(int searchColor, int replaceColor, boolean overideOpacity) {
100 | this.searchColor = searchColor;
101 | this.replaceColor = replaceColor;
102 | this.overideOpacity = overideOpacity;
103 | return this;
104 | }
105 |
106 | /**
107 | * In white-mode, fills are drawn in white and strokes are not drawn at all.
108 | */
109 | public SVGBuilder setWhiteMode(boolean whiteMode) {
110 | this.whiteMode = whiteMode;
111 | return this;
112 | }
113 |
114 | /**
115 | * Applies a {@link ColorFilter} to the paint objects used to render the SVG.
116 | */
117 | public SVGBuilder setColorFilter(ColorFilter colorFilter) {
118 | this.strokeColorFilter = this.fillColorFilter = colorFilter;
119 | return this;
120 | }
121 |
122 | /**
123 | * Applies a {@link ColorFilter} to strokes in the SVG.
124 | */
125 | public SVGBuilder setStrokeColorFilter(ColorFilter colorFilter) {
126 | this.strokeColorFilter = colorFilter;
127 | return this;
128 | }
129 |
130 | /**
131 | * Applies a {@link ColorFilter} to fills in the SVG.
132 | */
133 | public SVGBuilder setFillColorFilter(ColorFilter colorFilter) {
134 | this.fillColorFilter = colorFilter;
135 | return this;
136 | }
137 |
138 | /**
139 | * Whether or not to close the input stream after reading (ie. after calling {@link #build()}.
140 | * (default is true)
141 | */
142 | public SVGBuilder setCloseInputStreamWhenDone(boolean closeInputStream) {
143 | this.closeInputStream = closeInputStream;
144 | return this;
145 | }
146 |
147 | /**
148 | * Loads, reads, parses the SVG (or SVGZ).
149 | *
150 | * @return the parsed SVG.
151 | * @throws SVGParseException if there is an error while parsing.
152 | */
153 | public SVG build() throws SVGParseException {
154 | if (data == null) {
155 | throw new IllegalStateException("SVG input not specified. Call one of the readFrom...() methods first.");
156 | }
157 |
158 | try {
159 | final SVGHandler handler = new SVGHandler();
160 | handler.setColorSwap(searchColor, replaceColor, overideOpacity);
161 | handler.setWhiteMode(whiteMode);
162 | if (strokeColorFilter != null) {
163 | handler.strokePaint.setColorFilter(strokeColorFilter);
164 | }
165 | if (fillColorFilter != null) {
166 | handler.fillPaint.setColorFilter(fillColorFilter);
167 | }
168 |
169 | // SVGZ support (based on https://github.com/josefpavlik/svg-android/commit/fc0522b2e1):
170 | if(!data.markSupported())
171 | data = new BufferedInputStream(data); // decorate stream so we can use mark/reset
172 | try {
173 | data.mark(4);
174 | byte[] magic = new byte[2];
175 | int r = data.read(magic, 0, 2);
176 | int magicInt = (magic[0] + ((magic[1]) << 8)) & 0xffff;
177 | data.reset();
178 | if (r == 2 && magicInt == GZIPInputStream.GZIP_MAGIC) {
179 | // Log.d(SVGParser.TAG, "SVG is gzipped");
180 | GZIPInputStream gin = new GZIPInputStream(data);
181 | data = gin;
182 | }
183 | } catch (IOException ioe) {
184 | throw new SVGParseException(ioe);
185 | }
186 |
187 | final SVG svg = SVGParser.parse(new InputSource(data), handler);
188 | return svg;
189 |
190 | } finally {
191 | if (closeInputStream) {
192 | try {
193 | data.close();
194 | } catch (IOException e) {
195 | Log.e(SVGParser.TAG, "Error closing SVG input stream.", e);
196 | }
197 | }
198 | }
199 | }
200 | }
201 |
--------------------------------------------------------------------------------
/src/main/java/com/larvalabs/svgandroid/SVGColors.java:
--------------------------------------------------------------------------------
1 | package com.larvalabs.svgandroid;
2 |
3 | import java.util.Collections;
4 | import java.util.HashMap;
5 | import java.util.Map;
6 |
7 | public class SVGColors {
8 | private static final Map COLOURS;
9 |
10 | public static Integer mapColour(String colour) {
11 | return COLOURS.get(colour);
12 | }
13 |
14 | static {
15 | Map colors = new HashMap();
16 | colors.put("aliceblue", 0xf0f8ff);
17 | colors.put("antiquewhite", 0xfaebd7);
18 | colors.put("aqua", 0x00ffff);
19 | colors.put("aquamarine", 0x7fffd4);
20 | colors.put("azure", 0xf0ffff);
21 | colors.put("beige", 0xf5f5dc);
22 | colors.put("bisque", 0xffe4c4);
23 | colors.put("black", 0x000000);
24 | colors.put("blanchedalmond", 0xffebcd);
25 | colors.put("blue", 0x0000ff);
26 | colors.put("blueviolet", 0x8a2be2);
27 | colors.put("brown", 0xa52a2a);
28 | colors.put("burlywood", 0xdeb887);
29 | colors.put("cadetblue", 0x5f9ea0);
30 | colors.put("chartreuse", 0x7fff00);
31 | colors.put("chocolate", 0xd2691e);
32 | colors.put("coral", 0xff7f50);
33 | colors.put("cornflowerblue", 0x6495ed);
34 | colors.put("cornsilk", 0xfff8dc);
35 | colors.put("crimson", 0xdc143c);
36 | colors.put("cyan", 0x00ffff);
37 | colors.put("darkblue", 0x00008b);
38 | colors.put("darkcyan", 0x008b8b);
39 | colors.put("darkgoldenrod", 0xb8860b);
40 | colors.put("darkgray", 0xa9a9a9);
41 | colors.put("darkgreen", 0x006400);
42 | colors.put("darkgrey", 0xa9a9a9);
43 | colors.put("darkkhaki", 0xbdb76b);
44 | colors.put("darkmagenta", 0x8b008b);
45 | colors.put("darkolivegreen", 0x556b2f);
46 | colors.put("darkorange", 0xff8c00);
47 | colors.put("darkorchid", 0x9932cc);
48 | colors.put("darkred", 0x8b0000);
49 | colors.put("darksalmon", 0xe9967a);
50 | colors.put("darkseagreen", 0x8fbc8f);
51 | colors.put("darkslateblue", 0x483d8b);
52 | colors.put("darkslategray", 0x2f4f4f);
53 | colors.put("darkslategrey", 0x2f4f4f);
54 | colors.put("darkturquoise", 0x00ced1);
55 | colors.put("darkviolet", 0x9400d3);
56 | colors.put("deeppink", 0xff1493);
57 | colors.put("deepskyblue", 0x00bfff);
58 | colors.put("dimgray", 0x696969);
59 | colors.put("dimgrey", 0x696969);
60 | colors.put("dodgerblue", 0x1e90ff);
61 | colors.put("firebrick", 0xb22222);
62 | colors.put("floralwhite", 0xfffaf0);
63 | colors.put("forestgreen", 0x228b22);
64 | colors.put("fuchsia", 0xff00ff);
65 | colors.put("gainsboro", 0xdcdcdc);
66 | colors.put("ghostwhite", 0xf8f8ff);
67 | colors.put("gold", 0xffd700);
68 | colors.put("goldenrod", 0xdaa520);
69 | colors.put("gray", 0x808080);
70 | colors.put("green", 0x008000);
71 | colors.put("greenyellow", 0xadff2f);
72 | colors.put("grey", 0x808080);
73 | colors.put("honeydew", 0xf0fff0);
74 | colors.put("hotpink", 0xff69b4);
75 | colors.put("indianred", 0xcd5c5c);
76 | colors.put("indigo", 0x4b0082);
77 | colors.put("ivory", 0xfffff0);
78 | colors.put("khaki", 0xf0e68c);
79 | colors.put("lavender", 0xe6e6fa);
80 | colors.put("lavenderblush", 0xfff0f5);
81 | colors.put("lawngreen", 0x7cfc00);
82 | colors.put("lemonchiffon", 0xfffacd);
83 | colors.put("lightblue", 0xadd8e6);
84 | colors.put("lightcoral", 0xf08080);
85 | colors.put("lightcyan", 0xe0ffff);
86 | colors.put("lightgoldenrodyellow", 0xfafad2);
87 | colors.put("lightgray", 0xd3d3d3);
88 | colors.put("lightgreen", 0x90ee90);
89 | colors.put("lightgrey", 0xd3d3d3);
90 | colors.put("lightpink", 0xffb6c1);
91 | colors.put("lightsalmon", 0xffa07a);
92 | colors.put("lightseagreen", 0x20b2aa);
93 | colors.put("lightskyblue", 0x87cefa);
94 | colors.put("lightslategray", 0x778899);
95 | colors.put("lightslategrey", 0x778899);
96 | colors.put("lightsteelblue", 0xb0c4de);
97 | colors.put("lightyellow", 0xffffe0);
98 | colors.put("lime", 0x00ff00);
99 | colors.put("limegreen", 0x32cd32);
100 | colors.put("linen", 0xfaf0e6);
101 | colors.put("magenta", 0xff00ff);
102 | colors.put("maroon", 0x800000);
103 | colors.put("mediumaquamarine", 0x66cdaa);
104 | colors.put("mediumblue", 0x0000cd);
105 | colors.put("mediumorchid", 0xba55d3);
106 | colors.put("mediumpurple", 0x9370db);
107 | colors.put("mediumseagreen", 0x3cb371);
108 | colors.put("mediumslateblue", 0x7b68ee);
109 | colors.put("mediumspringgreen", 0x00fa9a);
110 | colors.put("mediumturquoise", 0x48d1cc);
111 | colors.put("mediumvioletred", 0xc71585);
112 | colors.put("midnightblue", 0x191970);
113 | colors.put("mintcream", 0xf5fffa);
114 | colors.put("mistyrose", 0xffe4e1);
115 | colors.put("moccasin", 0xffe4b5);
116 | colors.put("navajowhite", 0xffdead);
117 | colors.put("navy", 0x000080);
118 | colors.put("oldlace", 0xfdf5e6);
119 | colors.put("olive", 0x808000);
120 | colors.put("olivedrab", 0x6b8e23);
121 | colors.put("orange", 0xffa500);
122 | colors.put("orangered", 0xff4500);
123 | colors.put("orchid", 0xda70d6);
124 | colors.put("palegoldenrod", 0xeee8aa);
125 | colors.put("palegreen", 0x98fb98);
126 | colors.put("paleturquoise", 0xafeeee);
127 | colors.put("palevioletred", 0xdb7093);
128 | colors.put("papayawhip", 0xffefd5);
129 | colors.put("peachpuff", 0xffdab9);
130 | colors.put("peru", 0xcd853f);
131 | colors.put("pink", 0xffc0cb);
132 | colors.put("plum", 0xdda0dd);
133 | colors.put("powderblue", 0xb0e0e6);
134 | colors.put("purple", 0x800080);
135 | colors.put("red", 0xff0000);
136 | colors.put("rosybrown", 0xbc8f8f);
137 | colors.put("royalblue", 0x4169e1);
138 | colors.put("saddlebrown", 0x8b4513);
139 | colors.put("salmon", 0xfa8072);
140 | colors.put("sandybrown", 0xf4a460);
141 | colors.put("seagreen", 0x2e8b57);
142 | colors.put("seashell", 0xfff5ee);
143 | colors.put("sienna", 0xa0522d);
144 | colors.put("silver", 0xc0c0c0);
145 | colors.put("skyblue", 0x87ceeb);
146 | colors.put("slateblue", 0x6a5acd);
147 | colors.put("slategray", 0x708090);
148 | colors.put("slategrey", 0x708090);
149 | colors.put("snow", 0xfffafa);
150 | colors.put("springgreen", 0x00ff7f);
151 | colors.put("steelblue", 0x4682b4);
152 | colors.put("tan", 0xd2b48c);
153 | colors.put("teal", 0x008080);
154 | colors.put("thistle", 0xd8bfd8);
155 | colors.put("tomato", 0xff6347);
156 | colors.put("turquoise", 0x40e0d0);
157 | colors.put("violet", 0xee82ee);
158 | colors.put("wheat", 0xf5deb3);
159 | colors.put("white", 0xffffff);
160 | colors.put("whitesmoke", 0xf5f5f5);
161 | colors.put("yellow", 0xffff00);
162 | colors.put("yellowgreen", 0x9acd32);
163 | COLOURS = Collections.unmodifiableMap(colors);
164 | }
165 | }
166 |
--------------------------------------------------------------------------------
/src/main/java/com/larvalabs/svgandroid/SVGDrawable.java:
--------------------------------------------------------------------------------
1 | package com.larvalabs.svgandroid;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.Rect;
5 | import android.graphics.drawable.Drawable;
6 | import android.graphics.drawable.PictureDrawable;
7 | import android.util.Log;
8 |
9 | /**
10 | * Based on work by nimingtao:
11 | * https://code.google.com/p/adet/source/browse/trunk/adet/src/cn/mobileww/adet/graphics/SvgDrawable.java
12 | *
13 | * @since 19 Aug 2013
14 | * @author nimingtao, mstevens83
15 | */
16 | public class SVGDrawable extends PictureDrawable {
17 |
18 | private final String TAG = "SVGDrawable";
19 |
20 | private SVGState mSvgState;
21 |
22 | /**
23 | * @param picture
24 | */
25 | public SVGDrawable(SVG svg) {
26 | super(svg.getPicture());
27 | this.mSvgState = new SVGState(svg);
28 | }
29 |
30 | @Override
31 | protected void onBoundsChange(Rect bounds) {
32 | super.onBoundsChange(bounds);
33 | }
34 |
35 | /**
36 | * Original author nimingtao wrote that this method may not work on devices with Ice Cream Sandwich (Android v4.0).
37 | * See: http://stackoverflow.com/q/10384613/1084488
38 | * Apparently this is because canvas.drawPicture is not supported with hardware acceleration. If the problem occurs
39 | * and solved by programmatically turning off hardware acceleration only on the view that will draw the Picture:
40 | * view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
41 | *
42 | * However, I (mstevens83) was unable to reproduce this problem on an emulator running Ice Cream Sandwich, nor on
43 | * physical devices running Jelly Bean (v4.1.2 and v4.3 tested).
44 | */
45 | @Override
46 | public void draw(Canvas canvas) {
47 | if (getPicture() != null) {
48 | Rect bounds = getBounds();
49 | canvas.save();
50 | // draw picture to fit bounds!
51 | canvas.drawPicture(getPicture(), bounds);
52 | canvas.restore();
53 | }
54 | }
55 |
56 | // @Override
57 | // public int getIntrinsicWidth() {
58 | // Rect bounds = getBounds();
59 | // RectF limits = mSvgState.mSvg.getLimits();
60 | // if (bounds != null) {
61 | // return (int) bounds.width();
62 | // } else if (limits != null) {
63 | // return (int) limits.width();
64 | // } else {
65 | // return -1;
66 | // }
67 | // }
68 | //
69 | // @Override
70 | // public int getIntrinsicHeight() {
71 | // Rect bounds = getBounds();
72 | // RectF limits = mSvgState.mSvg.getLimits();
73 | // if (bounds != null) {
74 | // return (int) bounds.height();
75 | // } else if (limits != null) {
76 | // return (int) limits.height();
77 | // } else {
78 | // return -1;
79 | // }
80 | // }
81 |
82 | @Override
83 | public int getChangingConfigurations() {
84 | int c = super.getChangingConfigurations() | mSvgState.mChangingConfigurations;
85 | Log.e(TAG, "CC = " + c);
86 | return c;
87 | }
88 |
89 | @Override
90 | public ConstantState getConstantState() {
91 | mSvgState.mChangingConfigurations = super.getChangingConfigurations();
92 | return this.mSvgState;
93 | }
94 |
95 | final static class SVGState extends ConstantState {
96 | int mChangingConfigurations;
97 | private SVG mSvg;
98 |
99 | private SVGState(SVG svg) {
100 | this.mSvg = svg;
101 | }
102 |
103 | /*
104 | * (non-Javadoc)
105 | * @see android.graphics.drawable.Drawable.ConstantState#newDrawable()
106 | */
107 | @Override
108 | public Drawable newDrawable() {
109 | return new SVGDrawable(mSvg);
110 | }
111 |
112 | /*
113 | * (non-Javadoc)
114 | * @see android.graphics.drawable.Drawable.ConstantState#getChangingConfigurations()
115 | */
116 | @Override
117 | public int getChangingConfigurations() {
118 | return mChangingConfigurations;
119 | }
120 |
121 | }
122 |
123 | }
--------------------------------------------------------------------------------
/src/main/java/com/larvalabs/svgandroid/SVGParseException.java:
--------------------------------------------------------------------------------
1 | package com.larvalabs.svgandroid;
2 |
3 | /**
4 | * Runtime exception thrown when there is a problem parsing an SVG.
5 | *
6 | * @author Larva Labs, LLC
7 | */
8 | public class SVGParseException extends RuntimeException {
9 |
10 | public SVGParseException(String s) {
11 | super(s);
12 | }
13 |
14 | public SVGParseException(String s, Throwable throwable) {
15 | super(s, throwable);
16 | }
17 |
18 | public SVGParseException(Throwable throwable) {
19 | super(throwable);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/com/larvalabs/svgandroid/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Provides a mechanism to parse a limited version of SVG Basic 1.1 files in to android.graphics.Picture
3 | * objects. This allows vector graphics files to be saved out of illustration software (such as Adobe Illustrator) as
4 | * SVG Basic and then used directly in an Android app. The android.graphics.Picture is a very optimized and
5 | * convenient vector graphics class. Performance is very good on a wide array of Android devices.
6 | *
7 | * Note that only SVG features that can be directly converted in to Android graphics calls are supported. The following
8 | * SVG Basic 1.1 features are not supported and will be ignored by the parser:
9 | *
10 | *
All text and font features.
11 | *
Styles.
12 | *
Symbols, conditional processing.
13 | *
Patterns.
14 | *
Masks, filters and views.
15 | *
Interactivity, linking, scripting and animation.
16 | *
17 | * Even with the above features missing, users will find that most Illustrator drawings will render perfectly well on
18 | * Android with this library. See the {@link com.larvalabs.svgandroid.SVGParser SVGParser} class for instructions on how
19 | * to use the parser.
20 | *
21 | * @see com.larvalabs.svgandroid.SVGParser
22 | */
23 | package com.larvalabs.svgandroid;
24 |
25 |
--------------------------------------------------------------------------------