-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature request/proposal: converting brightness to opacity #4
Comments
Thank you. |
@SuzuSuzu-HaruHaru |
Hello! Sorry for the delay, Sunday was in the middle (and I did not even realize it at first, maybe I should look at the calendar more often...) and thus I was somewhere else. For a second there my heart skipped a beat when reading these comments, fearing that I had caused some problems; especially when you wrote that you spent half a day trying to fix it, which I hope did not steal time away from you. But I am happy to know that, in the end, you were able to solve it and to replicate the exact way it works on Clip Studio Paint, and that my code was thus even just a little bit useful. You are very good at coding while I am merely a beginner, so I will definitely take a look at the improved version to see how you changed it—and I will learn from it! In any case, thank you so much for the feedback! |
Hello! First of all, I want to congratulate you on the great job behind this repository: but even before that I should point out that I am a novice and a total beginner, so I apologize in advance if I am being impolite as I am still learning the proper etiquette here on GitHub.
As a person who also likes to draw (and, in fact, I have spent a lot more time drawing on programs such as Photoshop or Clip Studio Paint than coding, although I like programming just as much), there is a feature that I typically appreciate a lot in programs that let you draw with layers: it is the ability to convert brightness to opacity, which is especially useful when you are working on a white background (because it's easier on the eyes), but then you want to set the white background to transparency and keep only the black lineart so you can paste it above another layer; and it can be useful in other circumstances too, like if you accidentally start drawing on a white layer while instead you thought that you were somewhere else, and now you want to get rid of the white background.
Now, I have thought of a little solution to implement this feature; but—as I said—I am still learning the proper etiquette and thus I asked some friends of mine who are more experienced than me, and they suggested that I should open an issue to discuss the idea first. Therefore, here I am!
You can see my solution at the forked version that I have on my account within the brightnessToOpacity branch, where I basically implemented something like this in
js/engine/CPColorBmp.js
:and likewise in
js/engine/CPGreyBmp.js
, amid the other changes needed to make it work (inCPMainMenu.js
,ChickenPaint.js
andCPArtwork.js)
.Considering a color to be bright when it is closer to white and less bright when it is closer to black, the idea is to sum the three color values (red, green and blue) and divide the result by three to get the total brightness of the pixel; we then invert it, and assign this value to the alpha channel. So, for example, white (which is the brightest color of them all) will become completely transparent, whereas black will remain fully visible; and the colors in-between will become only partially transparent, thus preserving the fading effect at the edges of the stroke.
Of course, this is merely a suggestion. This could probably be implemented in many other ways, and you definitely know the code much better than me. I tentatively implemented it as a new option in the Effects dropdown menu, but again, that could be moved—or even removed entirely if this is a feature that you do not like, or that you are not interested in. For the time being I also added a Japanese translation in
js/languages/ja.json
which I took from the name that this option has in the Japanese version of Clip Studio Paint, so I hope that it is grammatically correct.Well, this was it! As I said I am still a novice, so I am not doing a pull request because I am still very insecure and shy. But I tested it locally, and it seems to work on my machine! I hope that you like it and, in any case, congratulations for maintaining this project!
The text was updated successfully, but these errors were encountered: