Comments (7)
Hi. Thanks for the report.
Can you possibly attach the file that caused the problem? If that is not
possible, can you try reducing the file to a simple form that still exhibits
the problem?
Original comment by [email protected]
on 21 Jan 2014 at 9:17
from androidsvg.
I'll do you one better, here's the fix:
// Parse a colour component value (0..255 or 0%-100%)
private static int parseColourComponent(final TextScanner scan)
throws SAXException {
float comp = scan.nextFloat();
if (scan.consume('%')) {
// Spec says to follow CSS rules, which says out-of-range values
should
// be clamped.
comp = comp < 0 ? 0 : comp > 100 ? 100 : comp;
return (int) (comp * 255.0 / 100.0);
} else {
comp = comp < 0 ? 0 : comp > 255 ? 255 : comp;
return (int) comp;
}
}
Original comment by [email protected]
on 21 Jan 2014 at 9:47
from androidsvg.
Hmmm... Neither SVG1.1, SVG 1.2 or CSS 2.1 allows float values in "rgb()"
colour values. So technically this is not a bug. SVG2 does allow float
values, however.
Was the file generated by a commercial program, or was it hand-written?
Chances are I will still merge this patch, since it is better to be permissive.
But it would still be good to know.
Original comment by [email protected]
on 21 Jan 2014 at 10:23
from androidsvg.
Commercial. Adobe InDesign.
Original comment by [email protected]
on 21 Jan 2014 at 10:39
from androidsvg.
Just so I know I am coping properly with the type of values InDesign generates,
would you mind pasting an actual example an faulty rgb() value from one of your
file please?
Better still, an actual file would still be useful for my test suite if you
have one you can share. Thanks.
Original comment by [email protected]
on 26 Jan 2014 at 1:54
- Changed state: Accepted
from androidsvg.
Correction to my comment #3. Number (float) values are allowed in colour
components that are percentages. This is allowed by the CSS spec. The fact
that the SVG spec says integer is an error.
I now suspect that InDesign wasn't producing bad files at all and was just
using floats in percentage colour components (eg. "rgb(0, 0, 33.33%)").
Original comment by [email protected]
on 27 Jan 2014 at 9:25
from androidsvg.
Fixed.
Issue30: Allow numbers (floats) in rgb colour components.
Original comment by [email protected]
on 27 Jan 2014 at 9:26
- Changed state: Fixed
from androidsvg.
Related Issues (20)
- SVGAndroidRenderer.processMaskBitmaps is very slow HOT 1
- SVGParser is not thread-safe [with fix] (SVG parse error: Invalid colour keyword: white) HOT 2
- Feature request: replace text HOT 6
- FAQ promotes extremely bad backward-compatibility practice HOT 6
- Image references missing SVG support. HOT 3
- Canvas changed after renderToCanvas HOT 1
- Position of Rectf ignored when renderToCanvas HOT 1
- Support for hardware acceleration
- Android version support HOT 1
- Android version support HOT 1
- Pattern fills are rendered with visible grid HOT 4
- Provide copy constructor or allow rendering to multiple viewBox at once HOT 3
- migrate the repository HOT 3
- Move project to Github HOT 1
- NullPointerException in 1.2.2-beta1 when parsing SVG document HOT 4
- SVGImageView crashes on Android 5.0 and higher HOT 5
- Proguard breaks reflective CSS selectors HOT 1
- java.lang.ArrayIndexOutOfBoundsException: length=0; index=-2 in SVGAndroidRenderer.arcTo(SourceFile:2572) HOT 1
- Incorrect rendering of SVG image HOT 5
- Unable to execute dex: Multiple dex files define HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from androidsvg.