SonarSonic / DrawingBotV3

DrawingBotV3 is a software for converting images into vector art
https://docs.drawingbotv3.com
GNU General Public License v3.0
331 stars 43 forks source link

Add half-pixel offset to drawings only #34

Closed HanzPetrov closed 2 years ago

HanzPetrov commented 2 years ago

Hi Ollie, This is a fix to apply the half-pixel offset to drawings only. Without this check, Reference and Lightened images are also rendered with the offset in the GUI. Note that I had to set DisplayMode to DRAWING sooner (when the plot is initiated), rather than after the task stage is finished, so that updatePrintScale() sees the correct mode early enough. Perhaps the later call is now redundant..?

public void onPlottingTaskStageFinished(PlottingTask task, EnumTaskStage stage){
        switch (stage){
            case QUEUED:
                break;
            case PRE_PROCESSING:
                Platform.runLater(() -> display_mode.setValue(EnumDisplayMode.DRAWING));
                break;
SonarSonic commented 2 years ago

Thanks for this Hanz.

I'm afraid this fix won't work for all situations as PrintResolution.updateAll() is called from all PlottingTask, which includes ones triggered by Batch Processing / Split Plotting Tasks, where there is no way to guarantee the correct display mode is active.

I'll have a think about the best way to go about this, in my current branch as I'm making a few changes to the back-end of how geometries are added anyway so may be able to include the half pixel offset there instead.