diff options
Diffstat (limited to 'src/ui/paint.c')
-rw-r--r-- | src/ui/paint.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/ui/paint.c b/src/ui/paint.c index 71ebb81d..89de47d4 100644 --- a/src/ui/paint.c +++ b/src/ui/paint.c | |||
@@ -33,7 +33,8 @@ iLocalDef SDL_Renderer *renderer_Paint_(const iPaint *d) { | |||
33 | 33 | ||
34 | static void setColor_Paint_(const iPaint *d, int color) { | 34 | static void setColor_Paint_(const iPaint *d, int color) { |
35 | const iColor clr = get_Color(color & mask_ColorId); | 35 | const iColor clr = get_Color(color & mask_ColorId); |
36 | SDL_SetRenderDrawColor(renderer_Paint_(d), clr.r, clr.g, clr.b, clr.a * d->alpha / 255); | 36 | SDL_SetRenderDrawColor(renderer_Paint_(d), clr.r, clr.g, clr.b, |
37 | (color & opaque_ColorId ? 255 : clr.a) * d->alpha / 255); | ||
37 | } | 38 | } |
38 | 39 | ||
39 | void init_Paint(iPaint *d) { | 40 | void init_Paint(iPaint *d) { |
@@ -186,6 +187,22 @@ void drawLines_Paint(const iPaint *d, const iInt2 *points, size_t n, int color) | |||
186 | free(offsetPoints); | 187 | free(offsetPoints); |
187 | } | 188 | } |
188 | 189 | ||
190 | void drawPin_Paint(iPaint *d, iRect rangeRect, int dir, int pinColor) { | ||
191 | const int height = height_Rect(rangeRect); | ||
192 | iRect pin; | ||
193 | if (dir == 0) { | ||
194 | pin = (iRect){ add_I2(topLeft_Rect(rangeRect), init_I2(-gap_UI / 4, -gap_UI)), | ||
195 | init_I2(gap_UI / 2, height + gap_UI) }; | ||
196 | } | ||
197 | else { | ||
198 | pin = (iRect){ addX_I2(topRight_Rect(rangeRect), -gap_UI / 4), | ||
199 | init_I2(gap_UI / 2, height + gap_UI) }; | ||
200 | } | ||
201 | fillRect_Paint(d, pin, pinColor); | ||
202 | fillRect_Paint(d, initCentered_Rect(dir == 0 ? topMid_Rect(pin) : bottomMid_Rect(pin), | ||
203 | init1_I2(gap_UI * 2)), pinColor); | ||
204 | } | ||
205 | |||
189 | iInt2 size_SDLTexture(SDL_Texture *d) { | 206 | iInt2 size_SDLTexture(SDL_Texture *d) { |
190 | iInt2 size; | 207 | iInt2 size; |
191 | SDL_QueryTexture(d, NULL, NULL, &size.x, &size.y); | 208 | SDL_QueryTexture(d, NULL, NULL, &size.x, &size.y); |