I am designing a 2D drawing library (it is its very early stages) and I was wondering what to do with Alpha (transparency).
I have two trains of thought:
A. Implement Alpha in the Color class since it affects the eventual color. The color red (255, 0, 0, 255) looks totally different from the color (255, 0, 0, 127) both on a white background.
B. Implement the Alpha value in the Shape class containing all base properties for a shape like position, color (in this case color would only contain r, g, b values), stroke weight etc. This could also work since Alpha would affect the entire object.
What do you guys think makes more sense?
Side notes:
If Alpha would be part of Shape it would be harder to quickly change colors and reassign them.
But this would make it easier to implement functions like color mixing etc in the color class.
(let me know if this is the place to ask this, I was also thinking about software engineering stack exchange. But this seemed to make more sense)