undo fixing the corners for now, it doesn't work on master anyways
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
41a874432d
commit
ba917c8b13
1 changed files with 31 additions and 34 deletions
65
src/draw.c
65
src/draw.c
|
|
@ -140,16 +140,15 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color, int rounde
|
|||
pixmap = MwLLCreatePixmap(handle->lowlevel, data, 1, rect->height);
|
||||
if(rounded && rect->height >= (roundness * 2) && rect->width >= (roundness * 2) && roundness > 0) {
|
||||
for(i = 0; i < roundness; i++) {
|
||||
int x = (roundness + 2);
|
||||
int y = rect->y + (roundness + 2);
|
||||
double point = ((i + (M_PI * 4)) / div);
|
||||
double point2 = (((i + 1) + (M_PI * 4)) / div);
|
||||
r.x = (roundness + 4) - (sin(point) * roundness);
|
||||
r.y = y + (cos(point) * roundness) + 1;
|
||||
r.width = roundness;
|
||||
r.height = (rect->height - ((r.y - rect->y) * 2) - 1);
|
||||
int x = (roundness + 2);
|
||||
int y = rect->y + (roundness + 2);
|
||||
double point = ((i + (M_PI * 4)) / div);
|
||||
r.x = (roundness + 4) - (sin(point) * roundness);
|
||||
r.y = y + (cos(point) * roundness) + 1;
|
||||
r.width = roundness;
|
||||
r.height = (rect->height - ((r.y - rect->y) * 2) - 1);
|
||||
MwLLDrawPixmap(handle->lowlevel, &r, pixmap);
|
||||
r.width = x + (sin(point2) * roundness);
|
||||
r.width = x + (sin(point + 1) * roundness);
|
||||
r.x = ((rect->width - (roundness + 1)) + (sin(point) * roundness)) - r.width;
|
||||
MwLLDrawPixmap(handle->lowlevel, &r, pixmap);
|
||||
}
|
||||
|
|
@ -198,11 +197,13 @@ void MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert
|
|||
if(rect->width <= 0 || rect->height <= 0) return;
|
||||
|
||||
if(border) {
|
||||
MwLLColor c = handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground));
|
||||
if(!handle->lowlevel->common.supports_transparency) {
|
||||
MwLLColor c = handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground));
|
||||
|
||||
if(c != NULL) {
|
||||
MwDrawRect(handle, rect, c);
|
||||
MwLLFreeColor(c);
|
||||
if(c != NULL) {
|
||||
MwDrawRect(handle, rect, c);
|
||||
MwLLFreeColor(c);
|
||||
}
|
||||
}
|
||||
|
||||
MwDrawFrame(handle, rect, color, invert, rounded);
|
||||
|
|
@ -356,15 +357,14 @@ static void frame_border_complex(MwWidget handle, MwRect* rect, MwLLColor lighte
|
|||
/* top left edge */
|
||||
for(i = 0; i < BORDER_SMOOTHNESS; i += 2) {
|
||||
MwPoint line[2];
|
||||
double point = ((i + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
|
||||
double point2 = (((i + 2) + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
|
||||
int x = rect->x + (roundness + 2);
|
||||
int y = rect->y + (roundness + 2);
|
||||
double point = ((i + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
|
||||
int x = rect->x + (roundness + 2);
|
||||
int y = rect->y + (roundness + 2);
|
||||
|
||||
line[0].x = x - (sin(point) * roundness);
|
||||
line[0].y = y + (cos(point) * roundness);
|
||||
line[1].x = x - (sin(point2) * roundness);
|
||||
line[1].y = y + (cos(point2) * roundness);
|
||||
line[1].x = x - (sin(point + 1) * roundness);
|
||||
line[1].y = y + (cos(point + 1) * roundness);
|
||||
MwLLLine(handle->lowlevel, line, invert ? lighter : darker);
|
||||
}
|
||||
|
||||
|
|
@ -391,14 +391,13 @@ static void frame_border_complex(MwWidget handle, MwRect* rect, MwLLColor lighte
|
|||
for(i = 0; i < BORDER_SMOOTHNESS; i += 2) {
|
||||
MwPoint line[2];
|
||||
double point = ((i + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
|
||||
double point2 = (((i + 1) + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
|
||||
int x = (rect->x + rect->width) - (roundness + 2);
|
||||
int y = rect->y + (roundness + 2);
|
||||
double placeholder = (sin(point) * roundness);
|
||||
line[0].x = x + placeholder;
|
||||
line[0].y = y + (cos(point) * roundness);
|
||||
line[1].x = x + (sin(point2) * roundness);
|
||||
line[1].y = y + (cos(point2) * roundness);
|
||||
line[1].x = x + (sin(point + 1) * roundness);
|
||||
line[1].y = y + (cos(point + 1) * roundness);
|
||||
MwLLLine(handle->lowlevel, line, invert ? lighter : darker);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -425,15 +424,14 @@ static void frame_border_complex(MwWidget handle, MwRect* rect, MwLLColor lighte
|
|||
/* bottom left edge */
|
||||
for(i = 0; i < BORDER_SMOOTHNESS; i += 2) {
|
||||
MwPoint line[2];
|
||||
double point = ((i + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
|
||||
double point2 = (((i + 1) + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
|
||||
int x = rect->x + (roundness + 2);
|
||||
int y = (rect->y + rect->height) - (roundness + 2);
|
||||
double point = ((i + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
|
||||
int x = rect->x + (roundness + 2);
|
||||
int y = (rect->y + rect->height) - (roundness + 2);
|
||||
|
||||
line[0].x = x - (sin(point) * roundness);
|
||||
line[0].y = y - (cos(point) * roundness);
|
||||
line[1].x = x - (sin(point2) * roundness);
|
||||
line[1].y = y - (cos(point2) * roundness);
|
||||
line[1].x = x - (sin(point + 1) * roundness);
|
||||
line[1].y = y - (cos(point + 1) * roundness);
|
||||
MwLLLine(handle->lowlevel, line, invert ? lighter : darker);
|
||||
}
|
||||
p[0].x = rect->x + roundness;
|
||||
|
|
@ -462,15 +460,14 @@ static void frame_border_complex(MwWidget handle, MwRect* rect, MwLLColor lighte
|
|||
/* bottom right edge */
|
||||
for(i = 0; i < BORDER_SMOOTHNESS; i += 2) {
|
||||
MwPoint line[2];
|
||||
double point = ((i + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
|
||||
double point2 = (((i + 2) + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
|
||||
int x = (rect->x + rect->width) - (roundness + 2);
|
||||
int y = (rect->y + rect->height) - (roundness + 2);
|
||||
double point = ((i + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
|
||||
int x = (rect->x + rect->width) - (roundness + 2);
|
||||
int y = (rect->y + rect->height) - (roundness + 2);
|
||||
|
||||
line[0].x = x + (sin(point) * roundness);
|
||||
line[0].y = y - (cos(point) * roundness);
|
||||
line[1].x = x + (sin(point2) * roundness);
|
||||
line[1].y = y - (cos(point2) * roundness);
|
||||
line[1].x = x + (sin(point + 1) * roundness);
|
||||
line[1].y = y - (cos(point + 1) * roundness);
|
||||
MwLLLine(handle->lowlevel, line, invert ? lighter : darker);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue