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

Images with resizeMode "cover" loses its borderRadius #18

Closed
t1mp4 opened this issue Aug 14, 2024 · 4 comments
Closed

Images with resizeMode "cover" loses its borderRadius #18

t1mp4 opened this issue Aug 14, 2024 · 4 comments

Comments

@t1mp4
Copy link

t1mp4 commented Aug 14, 2024

(Not sure if "issue" or "question")

Images with resizeMode "cover" loses its borderRadius.

This is expected because it clips the element, however, it would be nice if it would keep the borderRadius.

<View style={{ width: 300, height: 300, borderRadius: 12 }}>
    <View
        src="http://some-external-site.com/image.png"
        textureOptions={{
            resizeMode: {
                type: "cover"
            }
        }}
        borderRadius={12}
    />
</View>

My workaround right now is to add a transparent overlay with a border and border radius, but it's wonky.

Is there a better method?

@chiefcll
Copy link
Contributor

I see - this is most likely an issue in the https://github.com/lightning-js/renderer - I'm just passing those options through. Glad it's all "working" though - this is my first time seeing textureOptions but that should all be wired up correctly on Solid & Core side. Sometimes borderRadius is wonky because the order it's added will affect other dynamic shaders as well (like linearGradient etc)

@chiefcll
Copy link
Contributor

chiefcll commented Aug 14, 2024

It looks like this is working in the renderer...
Original:
image

With radius
image

renderer.createNode({
            x: curX,
            width: SQUARE_SIZE,
            height: SQUARE_SIZE - 300,
            texture: renderer.createTexture('ImageTexture', {
              src: testscreenImg,
            }),
            textureOptions: {
              resizeMode: {
                type: 'cover',
              },
            },
            shader: renderer.createShader('DynamicShader', {
              effects: [
                {
                  type: 'radius',
                  props: {
                    radius: 70,
                  },
                }
              ]}),
            parent: rowNode,
          });

Is this what you're expecting? Can you upload images

@chiefcll
Copy link
Contributor

I see - yes this is a render question / issue...

image

This is radius 16 - not rounding at all. Extreme value will eventually round.

@chiefcll
Copy link
Contributor

Reposted to Lightning Renderer: lightning-js/renderer#357

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

No branches or pull requests

2 participants