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)
- SVG drawable alpha value is not supporated HOT 1
- Make fallback color configurable HOT 3
- Svg Color Filter
- Fhhj
- Marcoscortes1
- Look for `currentColor` in case-insensitive manner
- Handle all CSS system colors HOT 1
- This svg file, there is a problem HOT 3
- I want to need content width and height without set view box so how can i resolve this issue ?
- I want to get only drawn content of svg as picture HOT 3
- below svg is getting cut in imageview, I want to get whole svg as picture how to do it HOT 5
- SVG Rendering Issue in androidsvg Library HOT 3
- Support animated gif and webp for <image> HOT 3
- Android 14 emulator: App crashes with java.lang.SecurityException: "Writable dex file is not allowed. " HOT 2
- Release 1.5
- colrv1 asset with multi-layers HOT 2
- Text is misplaced HOT 2
- 图片放到之后有黑色边框 HOT 2
- SVG href or xlink:href not working
- Text is hidden after scaled a element
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.