diff options
Diffstat (limited to 'src/ui/paint.c')
-rw-r--r-- | src/ui/paint.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ui/paint.c b/src/ui/paint.c index 1ac12a66..36e3f703 100644 --- a/src/ui/paint.c +++ b/src/ui/paint.c | |||
@@ -108,6 +108,33 @@ void fillRect_Paint(const iPaint *d, iRect rect, int color) { | |||
108 | SDL_RenderFillRect(renderer_Paint_(d), (SDL_Rect *) &rect); | 108 | SDL_RenderFillRect(renderer_Paint_(d), (SDL_Rect *) &rect); |
109 | } | 109 | } |
110 | 110 | ||
111 | void drawSoftShadow_Paint(const iPaint *d, iRect inner, int thickness, int color, int alpha) { | ||
112 | SDL_Renderer *render = renderer_Paint_(d); | ||
113 | SDL_Texture *shadow = get_Window()->borderShadow; | ||
114 | const iInt2 size = size_SDLTexture(shadow); | ||
115 | const iRect outer = expanded_Rect(inner, init1_I2(thickness)); | ||
116 | const iColor clr = get_Color(color); | ||
117 | SDL_SetTextureColorMod(shadow, clr.r, clr.g, clr.b); | ||
118 | SDL_SetTextureAlphaMod(shadow, alpha); | ||
119 | /* Classic stretched segmented border. */ | ||
120 | SDL_RenderCopy(render, shadow, &(SDL_Rect){ 0, 0, size.x / 2, size.y / 2}, | ||
121 | &(SDL_Rect){ outer.pos.x, outer.pos.y, thickness, thickness }); | ||
122 | SDL_RenderCopy(render, shadow, &(SDL_Rect){ size.x / 2, 0, 1, size.y / 2}, | ||
123 | &(SDL_Rect){ inner.pos.x, outer.pos.y, inner.size.x, thickness }); | ||
124 | SDL_RenderCopy(render, shadow, &(SDL_Rect){ size.x / 2, 0, size.x / 2, size.y / 2}, | ||
125 | &(SDL_Rect){ right_Rect(outer) - thickness, outer.pos.y, thickness, thickness }); | ||
126 | SDL_RenderCopy(render, shadow, &(SDL_Rect){ size.x / 2, size.y / 2, size.x / 2, 1 }, | ||
127 | &(SDL_Rect){ right_Rect(inner), inner.pos.y, thickness, inner.size.y }); | ||
128 | SDL_RenderCopy(render, shadow, &(SDL_Rect){ size.x / 2, size.y / 2, size.x / 2, size.y / 2}, | ||
129 | &(SDL_Rect){ right_Rect(inner), bottom_Rect(inner), thickness, thickness }); | ||
130 | SDL_RenderCopy(render, shadow, &(SDL_Rect){ size.x / 2, size.y / 2, 1, size.y / 2}, | ||
131 | &(SDL_Rect){ inner.pos.x, bottom_Rect(inner), inner.size.x, thickness }); | ||
132 | SDL_RenderCopy(render, shadow, &(SDL_Rect){ 0, size.y / 2, size.x / 2, size.y / 2}, | ||
133 | &(SDL_Rect){ outer.pos.x, bottom_Rect(inner), thickness, thickness }); | ||
134 | SDL_RenderCopy(render, shadow, &(SDL_Rect){ 0, size.y / 2, size.x / 2, 1 }, | ||
135 | &(SDL_Rect){ outer.pos.x, inner.pos.y, thickness, inner.size.y }); | ||
136 | } | ||
137 | |||
111 | void drawLines_Paint(const iPaint *d, const iInt2 *points, size_t count, int color) { | 138 | void drawLines_Paint(const iPaint *d, const iInt2 *points, size_t count, int color) { |
112 | setColor_Paint_(d, color); | 139 | setColor_Paint_(d, color); |
113 | SDL_RenderDrawLines(renderer_Paint_(d), (const SDL_Point *) points, count); | 140 | SDL_RenderDrawLines(renderer_Paint_(d), (const SDL_Point *) points, count); |