mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-07 01:49:47 +00:00
method name consistency
This commit is contained in:
@@ -142,10 +142,10 @@ int main() {
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
bgcolor = MwParseColor(window, MwGetText(window, MwNbackground));
|
bgcolor = MwParseColor(window, MwGetText(window, MwNbackground));
|
||||||
MwGetColor(bgcolor, &br, &bg, &bb);
|
MwColorGet(bgcolor, &br, &bg, &bb);
|
||||||
|
|
||||||
fgcolor = MwParseColor(window, MwGetText(window, MwNforeground));
|
fgcolor = MwParseColor(window, MwGetText(window, MwNforeground));
|
||||||
MwGetColor(fgcolor, &fr, &fg, &fb);
|
MwColorGet(fgcolor, &fr, &fg, &fb);
|
||||||
|
|
||||||
opengl = MwCreateWidget(MwOpenGLClass, "clock", window, 0, 0, 100, 100);
|
opengl = MwCreateWidget(MwOpenGLClass, "clock", window, 0, 0, 100, 100);
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ MWDECL MwLLPixmap MwLoadImage(MwWidget handle, const char* path);
|
|||||||
* @param green Pointer to green color
|
* @param green Pointer to green color
|
||||||
* @param blue Pointer to blue color
|
* @param blue Pointer to blue color
|
||||||
*/
|
*/
|
||||||
MWDECL void MwGetColor(MwLLColor color, int* red, int* green, int* blue);
|
MWDECL void MwColorGet(MwLLColor color, int* red, int* green, int* blue);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Creates a pixmap from raw data
|
* @brief Creates a pixmap from raw data
|
||||||
@@ -125,14 +125,25 @@ MWDECL void MwGetColor(MwLLColor color, int* red, int* green, int* blue);
|
|||||||
MWDECL MwLLPixmap MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height);
|
MWDECL MwLLPixmap MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Creates a pixmap from raw data
|
* @brief Updates a pixmap using raw data
|
||||||
* @param handle Widget
|
|
||||||
* @param pixmap Pixmap to update
|
* @param pixmap Pixmap to update
|
||||||
* @param rgb RGBA data
|
* @param rgb RGBA data
|
||||||
* @param width Width
|
|
||||||
* @param height Height
|
|
||||||
*/
|
*/
|
||||||
MWDECL void MwReloadRaw(MwWidget handle, MwLLPixmap pixmap, unsigned char* rgb, int width, int height);
|
MWDECL void MwPixmapReloadRaw(MwLLPixmap pixmap, unsigned char* rgb);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Gets the raw data of pixmap
|
||||||
|
* @param pixmap Pixmap
|
||||||
|
* @return RFBA data
|
||||||
|
*/
|
||||||
|
MWDECL unsigned char* MwPixmapGetRaw(MwLLPixmap pixmap);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Gets the size of pixmap
|
||||||
|
* @param pixmap Pixmap
|
||||||
|
* @param rect Size
|
||||||
|
*/
|
||||||
|
MWDECL void MwPixmapGetSize(MwLLPixmap pixmap, MwRect* rect);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Creates a pixmap from XPM data
|
* @brief Creates a pixmap from XPM data
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ struct _MwLLCommonPixmap {
|
|||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
unsigned char* raw;
|
unsigned char* raw;
|
||||||
|
void* user;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _MILSKO
|
#ifdef _MILSKO
|
||||||
|
|||||||
@@ -146,11 +146,11 @@ static void color_picker_image_update(color_picker_t* picker) {
|
|||||||
picker->color_picker_pixmap = MwLoadRaw(
|
picker->color_picker_pixmap = MwLoadRaw(
|
||||||
picker->parent, picker->color_picker_image_data, PICKER_SIZE, PICKER_SIZE);
|
picker->parent, picker->color_picker_image_data, PICKER_SIZE, PICKER_SIZE);
|
||||||
} else {
|
} else {
|
||||||
MwReloadRaw(
|
MwPixmapReloadRaw(
|
||||||
picker->parent, picker->color_picker_pixmap, picker->color_picker_image_data, PICKER_SIZE, PICKER_SIZE);
|
picker->color_picker_pixmap, picker->color_picker_image_data);
|
||||||
}
|
}
|
||||||
MwVaApply(picker->color_picker_img, MwNpixmap, picker->color_picker_pixmap, NULL);
|
MwVaApply(picker->color_picker_img, MwNpixmap, picker->color_picker_pixmap, NULL);
|
||||||
// printf("%d\n", n);
|
/* printf("%d\n", n); */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void color_picker_click(MwWidget handle, void* user, void* call) {
|
static void color_picker_click(MwWidget handle, void* user, void* call) {
|
||||||
@@ -165,7 +165,7 @@ static void color_picker_click(MwWidget handle, void* user, void* call) {
|
|||||||
(void)user;
|
(void)user;
|
||||||
(void)call;
|
(void)call;
|
||||||
|
|
||||||
// color_picker_image_update(picker);
|
/* color_picker_image_update(picker); */
|
||||||
|
|
||||||
i = ((mouse->point.y * PICKER_SIZE) + mouse->point.x) * 4;
|
i = ((mouse->point.y * PICKER_SIZE) + mouse->point.x) * 4;
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ static void color_picker_on_change_value(MwWidget handle, void* user,
|
|||||||
picker->value = ((double)value / 1024.);
|
picker->value = ((double)value / 1024.);
|
||||||
|
|
||||||
picker->doUpdate = 1;
|
picker->doUpdate = 1;
|
||||||
// color_picker_image_update(picker);
|
/* color_picker_image_update(picker); */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void color_picker_tick(MwWidget handle, void* user,
|
static void color_picker_tick(MwWidget handle, void* user,
|
||||||
@@ -282,12 +282,12 @@ color_picker_t* color_picker_setup(MwWidget parent, int w, int h) {
|
|||||||
MwVaCreateWidget(MwImageClass, "image", picker->parent, IMG_POS_X(w), IMG_POS_Y(h),
|
MwVaCreateWidget(MwImageClass, "image", picker->parent, IMG_POS_X(w), IMG_POS_Y(h),
|
||||||
PICKER_SIZE, PICKER_SIZE, NULL);
|
PICKER_SIZE, PICKER_SIZE, NULL);
|
||||||
|
|
||||||
// picker->color_picker_image_data = malloc(PICKER_SIZE * PICKER_SIZE * 4);
|
/* picker->color_picker_image_data = malloc(PICKER_SIZE * PICKER_SIZE * 4); */
|
||||||
|
|
||||||
picker->color_picker_pixmap = NULL;
|
picker->color_picker_pixmap = NULL;
|
||||||
picker->value = 0;
|
picker->value = 0;
|
||||||
|
|
||||||
// color_picker_image_update(picker);
|
/* color_picker_image_update(picker); */
|
||||||
picker->doUpdate = 1;
|
picker->doUpdate = 1;
|
||||||
|
|
||||||
MwAddUserHandler(picker->color_picker_img, MwNmouseDownHandler,
|
MwAddUserHandler(picker->color_picker_img, MwNmouseDownHandler,
|
||||||
@@ -299,7 +299,7 @@ color_picker_t* color_picker_setup(MwWidget parent, int w, int h) {
|
|||||||
|
|
||||||
MwSetText(picker->color_display_text, MwNbackground, "#FFFFFF");
|
MwSetText(picker->color_display_text, MwNbackground, "#FFFFFF");
|
||||||
MwSetText(picker->color_display_text, MwNtext, "#FFFFFF");
|
MwSetText(picker->color_display_text, MwNtext, "#FFFFFF");
|
||||||
// MwSetInteger(picker->color_display_text, Mwnali, MwALIGNMENT_CENTER);
|
/* MwSetInteger(picker->color_display_text, Mwnali, MwALIGNMENT_CENTER); */
|
||||||
|
|
||||||
MwAddUserHandler(picker->color_display_text, MwNactivateHandler,
|
MwAddUserHandler(picker->color_display_text, MwNactivateHandler,
|
||||||
color_display_text_change, picker);
|
color_display_text_change, picker);
|
||||||
|
|||||||
19
src/draw.c
19
src/draw.c
@@ -658,17 +658,19 @@ MwLLPixmap MwLoadImage(MwWidget handle, const char* path) {
|
|||||||
MwLLPixmap MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height) {
|
MwLLPixmap MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height) {
|
||||||
MwLLPixmap px = MwLLCreatePixmap(handle->lowlevel, rgb, width, height);
|
MwLLPixmap px = MwLLCreatePixmap(handle->lowlevel, rgb, width, height);
|
||||||
|
|
||||||
MwReloadRaw(handle, px, rgb, width, height);
|
px->common.user = handle;
|
||||||
|
MwPixmapReloadRaw(px, rgb);
|
||||||
|
|
||||||
return px;
|
return px;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwReloadRaw(MwWidget handle, MwLLPixmap px, unsigned char* rgb, int width, int height) {
|
void MwPixmapReloadRaw(MwLLPixmap px, unsigned char* rgb) {
|
||||||
int i;
|
int i;
|
||||||
MwLLColor base = handle->bgcolor == NULL ? MwParseColor(handle, MwGetText(handle, MwNbackground)) : handle->bgcolor;
|
MwWidget handle = px->common.user;
|
||||||
|
MwLLColor base = handle->bgcolor == NULL ? MwParseColor(handle, MwGetText(handle, MwNbackground)) : handle->bgcolor;
|
||||||
|
|
||||||
memset(px->common.raw, 0, width * height * 4);
|
memset(px->common.raw, 0, px->common.width * px->common.height * 4);
|
||||||
for(i = 0; i < width * height; i++) {
|
for(i = 0; i < px->common.width * px->common.height; i++) {
|
||||||
unsigned char* pin = &rgb[i * 4];
|
unsigned char* pin = &rgb[i * 4];
|
||||||
unsigned char* pout = &px->common.raw[i * 4];
|
unsigned char* pout = &px->common.raw[i * 4];
|
||||||
double a = pin[3];
|
double a = pin[3];
|
||||||
@@ -691,7 +693,12 @@ void MwReloadRaw(MwWidget handle, MwLLPixmap px, unsigned char* rgb, int width,
|
|||||||
MwLLPixmapUpdate(px);
|
MwLLPixmapUpdate(px);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwGetColor(MwLLColor color, int* red, int* green, int* blue) {
|
void MwPixmapGetSize(MwLLPixmap pixmap, MwRect* rect) {
|
||||||
|
rect->width = pixmap->common.width;
|
||||||
|
rect->height = pixmap->common.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MwColorGet(MwLLColor color, int* red, int* green, int* blue) {
|
||||||
*red = color->common.red;
|
*red = color->common.red;
|
||||||
*green = color->common.green;
|
*green = color->common.green;
|
||||||
*blue = color->common.blue;
|
*blue = color->common.blue;
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||||||
if(tree->selected) {
|
if(tree->selected) {
|
||||||
r.x = p->x;
|
r.x = p->x;
|
||||||
r.y = p->y - MwTextHeight(handle, "M") / 2;
|
r.y = p->y - MwTextHeight(handle, "M") / 2;
|
||||||
r.width = MwGetInteger(handle, MwNwidth) - MwGetInteger(handle, MwNleftPadding) - shift; // MwTextWidth(handle, tree->label);
|
r.width = MwGetInteger(handle, MwNwidth) - MwGetInteger(handle, MwNleftPadding) - shift;
|
||||||
r.height = MwTextHeight(handle, "M");
|
r.height = MwTextHeight(handle, "M");
|
||||||
MwDrawRect(handle, &r, text2);
|
MwDrawRect(handle, &r, text2);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user