Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
sotanmochi committed Apr 27, 2022
1 parent c416c5e commit f99c75d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,9 @@ public static float SRGBToLinear(float alpha_srgb, Vector3 foregroundColor, Vect
}

// Calculate transparency value
if (c <= 0.04045)
{
return alpha_srgb;
}
else
{
var numerator = (Math.Pow((c + 0.055) / 1.055, 2.4) - Math.Pow((cb + 0.055) / 1.055, 2.4));
var denominator = (Math.Pow((cf + 0.055) / 1.055, 2.4) - Math.Pow((cb + 0.055) / 1.055, 2.4));
return (float)(numerator / denominator);
}
var numerator = (Math.Pow((c + 0.055) / 1.055, 2.4) - Math.Pow((cb + 0.055) / 1.055, 2.4));
var denominator = (Math.Pow((cf + 0.055) / 1.055, 2.4) - Math.Pow((cb + 0.055) / 1.055, 2.4));
return (float)(numerator / denominator);
}

public static float SRGBToLinearApproximately(float alpha_srgb, Vector3 foregroundColor, Vector3 backgroundColor)
Expand Down
2 changes: 1 addition & 1 deletion Assets/TransparencyConverter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jp.sotanmochi.transparencyconverter",
"version": "0.3.1",
"version": "0.3.2",
"displayName": "TransparencyConverter",
"description": "Calculate the transparency value in linear color space from the value in sRGB color space.",
"license": "MIT",
Expand Down

0 comments on commit f99c75d

Please sign in to comment.