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

lerp utility function throwing unexpected exception #1

Closed
onomated opened this issue Jun 5, 2022 · 2 comments
Closed

lerp utility function throwing unexpected exception #1

onomated opened this issue Jun 5, 2022 · 2 comments

Comments

@onomated
Copy link

onomated commented Jun 5, 2022

Describe the bug
lerp function throws an exception IllegalArgumentException. This is a result of the lerp function converting to the LAB colorspace, and then attempting to convert to back to sRBG color space. See stack below:

Caused by: java.lang.IllegalArgumentException: RgbaColor needs to have a ColorModel of RGB
        at com.chrynan.colors.BaseRgbaColor.<init>(BaseRgbaColor.kt:13)
        at com.chrynan.colors.BaseRgbaColor.<init>(Unknown Source:0)
        at com.chrynan.colors.ColorConstructorUtilsKt.RgbaColor(ColorConstructorUtils.kt:245)
        at com.chrynan.colors.ColorUtilsKt.lerp(ColorUtils.kt:103)

To Reproduce
Steps to reproduce the behavior:

  • Invoke this function
fun test(color: Long): Color {
   return lerp(Color(color), Color.White, 50.0)
}

Expected behavior
Return the linear interpolated color

Additional context
Utilizing in KMM project

@github-actions
Copy link

github-actions bot commented Jun 5, 2022

Welcome and thanks for contributing! Make sure to leave a detailed explanation of the issue.

@chRyNaN
Copy link
Owner

chRyNaN commented Aug 20, 2022

Thanks @onomated Good catch! This should be fixed in the latest release. Feel free to create another issue if it is still occurring.

https://github.com/chRyNaN/colors/releases/tag/0.8.0
ee0c169

@chRyNaN chRyNaN closed this as completed Aug 20, 2022
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