Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vectors doesn't looks like vectors, but pixels #1761

Closed
gersonmontenegromatrix opened this issue May 3, 2022 · 2 comments
Closed

Vectors doesn't looks like vectors, but pixels #1761

gersonmontenegromatrix opened this issue May 3, 2022 · 2 comments
Labels

Comments

@gersonmontenegromatrix
Copy link

Bug

When rendering a SVG based on an XML, lines are aliased. How do I get an antialiasing effect?
image

Unexpected behavior

Lines are full of alias effect.

Environment info

System:
    OS: macOS 12.3
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 17.29 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.18 - ~/.yarn/bin/yarn
    npm: 8.5.0 - /usr/local/bin/npm
    Watchman: 2022.03.21.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /Users/gerson.montenegro/.rvm/rubies/ruby-3.0.0/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.1 AI-211.7628.21.2111.8193401
    Xcode: 13.3/13E113 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.14 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.66.3 => 0.66.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Library version: 12.1.1

Steps To Reproduce

I'm just loading the SVG image based on an XML file. This file is:

const CircleSvg = `
<svg width="354" height="354" xmlns="http://www.w3.org/2000/svg">
 <g>
  <title>Layer 1</title>
  <ellipse stroke-width="10" ry="175.5" rx="175.5" id="svg_2" cy="177" cx="177" stroke-dasharray="5,15" stroke="#000"/>
 </g>
</svg>
`;

export default CircleSvg;

Describe what you expected to happen:

I expect to see a not aliased vector.

Short, Self Contained, Correct (Compilable), Example

This is the way I'm using the XML and the library

import { SvgXml } from 'react-native-svg';
import { CircleSvg } from 'assets/images';

const Intro = () => {
  return (
            <View>
                <SvgXml xml={CircleSvg} width="100%" height="100%" style={{flex: 1}} />
            </View>
  );
}

Any idea?. Thanks

@gersonmontenegromatrix gersonmontenegromatrix changed the title Vectors doesn't looks like vector, but pixels Vectors doesn't looks like vectors, but pixels May 3, 2022
@labmorales
Copy link
Contributor

Had some issues with SVG quality and in my case, I had to use the width and height multiplied by the current device DPR. So maybe just increasing the size of the vector can help.

@bohdanprog
Copy link
Member

Hello @gersonmontenegromatrix @labmorales,
It seems that the issue has already been solved.
But if you still face the problem, feel free to open a new issue.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants