Files
OrcaSlicer/tests
ExPikaPaka c07165888b feat: add an image-adjustment panel to texture displacement layers
Adds brightness, contrast, sharpness, blur and hue over one layer's image,
shown on the image itself and updating as the sliders move. Reached from an
"Adjust image" button in the layer card, beside Smoothing.

What the panel produces is not a set of layer parameters: it replaces the
layer's image, so the adjusted pixels feed the colour and the displacement
together and a brightness change moves the relief too. That is deliberate,
and the panel says so. It is also why brightness is a lift toward white
rather than an additive offset: an offset drives everything above mid-grey
to a flat 255, and since the image is the height map, that region would bake
as flat relief instead of bright relief.

Three exits: Cancel discards, Overwrite replaces the layer's image_data, and
Save as copy writes a new PNG into the user's texture library and points the
layer at it. Overwrite and Save as copy both hand the layer a brand new
allocation, which is what invalidates decode_height_texture()'s cache,
analyze_texture_detail()'s, and the GPU thumbnail and height/colour
textures, all of them keyed by that pointer.

Grayscale in, grayscale out: a grey image is not promoted to RGB, since that
would offer the colour feature a row of identical greys and triple the
stored PNG for it. Hue is disabled for a grayscale source, with the reason
shown, because grey has no hue to turn.

The live preview runs on its own thread over a 384 px downscale, one pass in
flight at a time so a drag coalesces to wherever the sliders stop. Measured
on a 1024x1024 with every knob engaged, a full-size pass costs 13-19 ms
grayscale and 40-60 ms in colour (130-190 ms at 2048 in colour), which is
far too much to repeat per slider frame; the same pass on the downscale is
3-4 ms and 9-12 ms. Not the plater's job worker either: that is a single
FIFO shared with Bake, where a per-frame image filter would queue behind
multi-second mesh work. The full-size pass runs once, on commit, on the UI
thread, because the rebuild_preview() immediately after it is an order of
magnitude more work synchronously already.

The image maths lands in libslic3r as apply_texture_adjustments() and
downscale_height_texture(), so it is testable without a GUI, and the blur
reuses the same smooth_height_pixels() the Smoothing slider drives.
2026-10-12 07:56:54 +02:00
..
2025-12-08 22:42:11 +08:00

OrcaSlicer tests

Building, running and writing tests is documented on the wiki, under How to Test.

Two files here rather than there, because coding agents only read what is in the repository:

  • AGENTS.md is the same guidance in short form, and is what an agent working under tests/ picks up.
  • CATCH2.md is the Catch2 reference, including the mistakes that break a test at runtime.