center preview image

isolation_bkp/dynres
Dominik Madarász 2021-05-16 16:22:28 +02:00
parent 9e4120284d
commit a113bea553
7 changed files with 837 additions and 837 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -67,8 +67,7 @@ typedef enum {
TOP_DRAW_IMAGE,
TOP_DRAW_TEXT,
TOP_RESIZE_IMAGE,
TOP_COLOR_CONTRAST,
TOP_COLOR_BRIGHTNESS,
TOP_COLOR_TWEAKS,
TOP_FORCE_UINT8 = UINT8_MAX
} td_op_kind;
@ -261,7 +260,12 @@ void texed_run(int argc, char **argv) {
if (ctx.msgbox.visible) GuiLock();
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(property_pane, GetColor(0x422060));

View File

@ -77,11 +77,10 @@ void texed_process_ops(void) {
ImageResizeNN(&ctx.img, w, h);
}
}break;
case TOP_COLOR_CONTRAST: {
case TOP_COLOR_TWEAKS: {
ImageColorContrast(&ctx.img, texed_map_value(op->params[0].flt, -100.0f, 100.0f));
}break;
case TOP_COLOR_BRIGHTNESS: {
ImageColorBrightness(&ctx.img, (int)texed_map_value(op->params[0].flt, -255.0f, 255.0f));
ImageColorBrightness(&ctx.img, (int)texed_map_value(op->params[1].flt, -255.0f, 255.0f));
ImageColorTint(&ctx.img, op->params[2].color);
}break;
default: {
zpl_printf("%s\n", "unsupported op!");

View File

@ -65,14 +65,11 @@ static td_op default_ops[] = {
PARAM(TPARAM_COORD, "mode (0=nearest,1=bicubic)", "0"),
}
},{
OP(TOP_COLOR_CONTRAST),
PARAMS(1) {
PARAM(TPARAM_SLIDER, "contrast", "0.5")
}
},{
OP(TOP_COLOR_BRIGHTNESS),
PARAMS(1) {
PARAM(TPARAM_SLIDER, "brightness", "0.5")
OP(TOP_COLOR_TWEAKS),
PARAMS(3) {
PARAM(TPARAM_SLIDER, "contrast", "0.5"),
PARAM(TPARAM_SLIDER, "brightness", "0.5"),
PARAM(TPARAM_COLOR, "tint", "FFFFFFFF"),
}
}
};

View File

@ -264,7 +264,7 @@ void texed_draw_props_pane(zpl_aabb2 r) {
}
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);
zpl_aabb2 ok_r = zpl_aabb2_cut_left(&extra_r, 50.0f);