center preview image
parent
9e4120284d
commit
a113bea553
BIN
art/demo.ecotex
BIN
art/demo.ecotex
Binary file not shown.
1642
art/gen/demo.h
1642
art/gen/demo.h
File diff suppressed because it is too large
Load Diff
BIN
art/gen/demo.png
BIN
art/gen/demo.png
Binary file not shown.
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 6.0 KiB |
|
@ -67,8 +67,7 @@ typedef enum {
|
||||||
TOP_DRAW_IMAGE,
|
TOP_DRAW_IMAGE,
|
||||||
TOP_DRAW_TEXT,
|
TOP_DRAW_TEXT,
|
||||||
TOP_RESIZE_IMAGE,
|
TOP_RESIZE_IMAGE,
|
||||||
TOP_COLOR_CONTRAST,
|
TOP_COLOR_TWEAKS,
|
||||||
TOP_COLOR_BRIGHTNESS,
|
|
||||||
|
|
||||||
TOP_FORCE_UINT8 = UINT8_MAX
|
TOP_FORCE_UINT8 = UINT8_MAX
|
||||||
} td_op_kind;
|
} td_op_kind;
|
||||||
|
@ -261,7 +260,12 @@ void texed_run(int argc, char **argv) {
|
||||||
if (ctx.msgbox.visible) GuiLock();
|
if (ctx.msgbox.visible) GuiLock();
|
||||||
|
|
||||||
DrawTextureEx(checker_tex, (Vector2){ preview_window.min.x, preview_window.min.y}, 0.0f, 1.0f, WHITE);
|
DrawTextureEx(checker_tex, (Vector2){ preview_window.min.x, preview_window.min.y}, 0.0f, 1.0f, WHITE);
|
||||||
DrawTextureEx(ctx.tex, (Vector2){ preview_window.min.x, preview_window.min.y}, 0.0f, zoom, WHITE);
|
|
||||||
|
Rectangle tex_rect = aabb2_ray(preview_window);
|
||||||
|
DrawTextureEx(ctx.tex, (Vector2){
|
||||||
|
tex_rect.x + zpl_max(0.0f, tex_rect.width/2.0f - (ctx.tex.width*zoom)/2.0f),
|
||||||
|
tex_rect.y + zpl_max(0.0f, tex_rect.height/2.0f - (ctx.tex.height*zoom)/2.0f),
|
||||||
|
}, 0.0f, zoom, WHITE);
|
||||||
|
|
||||||
DrawAABB(topbar, RAYWHITE);
|
DrawAABB(topbar, RAYWHITE);
|
||||||
DrawAABB(property_pane, GetColor(0x422060));
|
DrawAABB(property_pane, GetColor(0x422060));
|
||||||
|
|
|
@ -77,11 +77,10 @@ void texed_process_ops(void) {
|
||||||
ImageResizeNN(&ctx.img, w, h);
|
ImageResizeNN(&ctx.img, w, h);
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case TOP_COLOR_CONTRAST: {
|
case TOP_COLOR_TWEAKS: {
|
||||||
ImageColorContrast(&ctx.img, texed_map_value(op->params[0].flt, -100.0f, 100.0f));
|
ImageColorContrast(&ctx.img, texed_map_value(op->params[0].flt, -100.0f, 100.0f));
|
||||||
}break;
|
ImageColorBrightness(&ctx.img, (int)texed_map_value(op->params[1].flt, -255.0f, 255.0f));
|
||||||
case TOP_COLOR_BRIGHTNESS: {
|
ImageColorTint(&ctx.img, op->params[2].color);
|
||||||
ImageColorBrightness(&ctx.img, (int)texed_map_value(op->params[0].flt, -255.0f, 255.0f));
|
|
||||||
}break;
|
}break;
|
||||||
default: {
|
default: {
|
||||||
zpl_printf("%s\n", "unsupported op!");
|
zpl_printf("%s\n", "unsupported op!");
|
||||||
|
|
|
@ -65,14 +65,11 @@ static td_op default_ops[] = {
|
||||||
PARAM(TPARAM_COORD, "mode (0=nearest,1=bicubic)", "0"),
|
PARAM(TPARAM_COORD, "mode (0=nearest,1=bicubic)", "0"),
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
OP(TOP_COLOR_CONTRAST),
|
OP(TOP_COLOR_TWEAKS),
|
||||||
PARAMS(1) {
|
PARAMS(3) {
|
||||||
PARAM(TPARAM_SLIDER, "contrast", "0.5")
|
PARAM(TPARAM_SLIDER, "contrast", "0.5"),
|
||||||
}
|
PARAM(TPARAM_SLIDER, "brightness", "0.5"),
|
||||||
},{
|
PARAM(TPARAM_COLOR, "tint", "FFFFFFFF"),
|
||||||
OP(TOP_COLOR_BRIGHTNESS),
|
|
||||||
PARAMS(1) {
|
|
||||||
PARAM(TPARAM_SLIDER, "brightness", "0.5")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -264,7 +264,7 @@ void texed_draw_props_pane(zpl_aabb2 r) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->edit_mode) {
|
if (p->edit_mode) {
|
||||||
zpl_aabb2 extra_r = zpl_aabb2_add_bottom(&tbox_r, prop_height);
|
zpl_aabb2 extra_r = zpl_aabb2_add_bottom(&tbox_r, prop_height*4.0f);
|
||||||
DrawRectangleRec(aabb2_ray(extra_r), GRAY);
|
DrawRectangleRec(aabb2_ray(extra_r), GRAY);
|
||||||
|
|
||||||
zpl_aabb2 ok_r = zpl_aabb2_cut_left(&extra_r, 50.0f);
|
zpl_aabb2 ok_r = zpl_aabb2_cut_left(&extra_r, 50.0f);
|
||||||
|
|
Loading…
Reference in New Issue