Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Renderer::DrawRectGradV(int x, int y, int w, int h, Color from, Color to) {
- float r = (to.R() - from.R()) / h;
- float g = (to.G() - from.G()) / h;
- float b = (to.B() - from.B()) / h;
- float a = (to.A() - from.A()) / h;
- for (int i = 0; i < h; i++) {
- int R = from.R() + r * i;
- int G = from.G() + g * i;
- int B = from.B() + b * i;
- int A = from.A() + a * i;
- DrawRect(x, y + i, w, 1, Color(R, G, B, A));
- }
- }
- void Renderer::DrawRectGradH(int x, int y, int w, int h, Color from, Color to) {
- float r = (to.R() - from.R()) / w;
- float g = (to.G() - from.G()) / w;
- float b = (to.B() - from.B()) / w;
- float a = (to.A() - from.A()) / w;
- for (int i = 0; i < h; i++) {
- int R = from.R() + r * i;
- int G = from.G() + g * i;
- int B = from.B() + b * i;
- int A = from.A() + a * i;
- DrawRect(x + i, y, 1, h, Color(R, G, B, A));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement