diff --git a/krita/krita4.xmlgui b/krita/krita4.xmlgui
index 907ebfe326..7c29c0e666 100644
--- a/krita/krita4.xmlgui
+++ b/krita/krita4.xmlgui
@@ -1,386 +1,379 @@
&View
&Canvas
&Snap To
&Image
&Rotate
&Layer
New
&Import/Export
Import
&Convert
&Select
&Group
&Transform
&Rotate
S&plit
S&plit Alpha
&Select
Filte&r
&Tools
Scripts
-
- Macros
-
-
-
-
-
Setti&ngs
&Help
File
Brushes and Stuff
diff --git a/krita/kritamenu.action b/krita/kritamenu.action
index 151a10df76..22e8e1e24d 100644
--- a/krita/kritamenu.action
+++ b/krita/kritamenu.action
@@ -1,1822 +1,1770 @@
File
document-new
&New
Create new document
New
0
0
Ctrl+N
false
document-open
&Open...
Open an existing document
Open
0
0
Ctrl+O
false
document-open-recent
Open &Recent
Open a document which was recently opened
Open Recent
1
0
false
document-save
&Save
Save
Save
1
0
Ctrl+S
false
document-save-as
Save &As...
Save document under a new name
Save As
1
0
Ctrl+Shift+S
false
Sessions...
Open session manager
Sessions
0
0
false
document-import
Open ex&isting Document as Untitled Document...
Open existing Document as Untitled Document
Open existing Document as Untitled Document
0
0
false
document-export
E&xport...
Export
Export
1
0
false
application-pdf
&Export as PDF...
Export as PDF
Export as PDF
1
0
false
Import animation frames...
Import animation frames
Import animation frames
1
0
false
&Render Animation...
Render Animation to GIF, Image Sequence or Video
Render Animation
1000
0
false
&Render Image Sequence Again
Render Animation to Image Sequence Again
Render Animation
1000
0
false
Save Incremental &Version
Save Incremental Version
Save Incremental Version
1
0
Ctrl+Alt+S
false
Save Incremental &Backup
Save Incremental Backup
Save Incremental Backup
1
0
F4
false
&Create Template From Image...
Create Template From Image
Create Template From Image
1
0
false
Create Copy &From Current Image
Create Copy From Current Image
Create Copy From Current Image
1
0
false
document-print
&Print...
Print document
Print
1
0
Ctrl+P
false
document-print-preview
Print Previe&w
Show a print preview of document
Print Preview
1
0
false
configure
&Document Information
Document Information
Document Information
1
0
false
&Close All
Close All
Close All
1
0
Ctrl+Shift+W
false
C&lose
Close
Close
1
0
false
&Quit
Quit application
Quit
0
0
Ctrl+Q
false
Edit
edit-undo
Undo
Undo last action
Undo
1
0
Ctrl+Z
false
edit-redo
Redo
Redo last undone action
Redo
1
0
Ctrl+Shift+Z
false
edit-cut
Cu&t
Cut selection to clipboard
Cut
0
0
Ctrl+X
false
edit-copy
&Copy
Copy selection to clipboard
Copy
0
0
Ctrl+C
false
C&opy (sharp)
Copy (sharp)
Copy (sharp)
100000000
0
false
Cut (&sharp)
Cut (sharp)
Cut (sharp)
100000000
0
false
Copy &merged
Copy merged
Copy merged
100000000
0
Ctrl+Shift+C
false
edit-paste
&Paste
Paste clipboard content
Paste
0
0
Ctrl+V
false
Paste at Cursor
Paste at cursor
Paste at cursor
0
0
Ctrl+Alt+V
false
Paste into &New Image
Paste into New Image
Paste into New Image
0
0
Ctrl+Shift+N
false
edit-clear
C&lear
Clear
Clear
1
0
Del
false
&Fill with Foreground Color
Fill with Foreground Color
Fill with Foreground Color
10000
1
Shift+Backspace
false
Fill &with Background Color
Fill with Background Color
Fill with Background Color
10000
1
Backspace
false
F&ill with Pattern
Fill with Pattern
Fill with Pattern
10000
1
false
Fill Special
Fill with Foreground Color (Opacity)
Fill with Foreground Color (Opacity)
Fill with Foreground Color (Opacity)
10000
1
Ctrl+Shift+Backspace
false
Fill with Background Color (Opacity)
Fill with Background Color (Opacity)
Fill with Background Color (Opacity)
10000
1
Ctrl+Backspace
false
Fill with Pattern (Opacity)
Fill with Pattern (Opacity)
Fill with Pattern (Opacity)
10000
1
false
Stro&ke selected shapes
Stroke selected shapes
Stroke selected shapes
1000000000
0
false
Stroke Selec&tion...
Stroke selection
Stroke selection
10000000000
0
false
Delete keyframe
Delete keyframe
Delete keyframe
100000
0
false
Window
window-new
&New Window
New Window
New Window
0
0
false
N&ext
Next
Next
10
0
false
Previous
Previous
Previous
false
View
&Show Canvas Only
Show just the canvas or the whole window
Show Canvas Only
0
0
Tab
true
view-fullscreen
F&ull Screen Mode
Display the window in full screen
Full Screen Mode
0
0
Ctrl+Shift+F
true
&Wrap Around Mode
Wrap Around Mode
Wrap Around Mode
1
0
W
true
&Instant Preview Mode
Instant Preview Mode
Instant Preview Mode
1
0
Shift+L
true
Soft Proofing
Turns on Soft Proofing
Turns on Soft Proofing
Ctrl+Y
true
Out of Gamut Warnings
Turns on warnings for colors out of proofed gamut, needs soft proofing to be turned on.
Turns on warnings for colors out of proofed gamut, needs soft proofing to be turned on.
Ctrl+Shift+Y
true
mirror-view
Mirror View
Mirror View
Mirror View
M
false
zoom-original
&Reset zoom
Reset zoom
Reset zoom
1
0
Ctrl+0
false
zoom-in
Zoom &In
Zoom In
0
0
Ctrl++
false
zoom-out
Zoom &Out
Zoom Out
0
0
Ctrl+-
false
rotate-canvas-right
Rotate &Canvas Right
Rotate Canvas Right
Rotate Canvas Right
1
0
Ctrl+]
false
rotate-canvas-left
Rotate Canvas &Left
Rotate Canvas Left
Rotate Canvas Left
1
0
Ctrl+[
false
rotation-reset
Reset Canvas Rotation
Reset Canvas Rotation
Reset Canvas Rotation
1
0
false
Show &Rulers
The rulers show the horizontal and vertical positions of the mouse on the image and can be used to position your mouse at the right place on the canvas. <p>Uncheck this to hide the rulers.</p>
Show Rulers
Show Rulers
1
0
true
Rulers Track Pointer
The rulers will track current mouse position and show it on screen. It can cause suptle performance slowdown
Rulers Track Pointer
Rulers Track Pointer
1
0
true
Show Guides
Show or hide guides
Show Guides
1
0
true
Lock Guides
Lock or unlock guides
Lock Guides
1
0
true
Snap to Guides
Snap cursor to guides position
Snap to Guides
1
0
true
Show Status &Bar
Show or hide the status bar
Show Status Bar
0
0
true
Show Pixel Grid
Show Pixel Grid
Show Pixel Grid
1000
0
true
view-grid
Show &Grid
Show Grid
Show Grid
1000
0
Ctrl+Shift+'
true
Snap To Grid
Snap To Grid
Snap To Grid
1000
Ctrl+Shift+;
true
Show Snap Options Popup
Show Snap Options Popup
Show Snap Options Popup
1000
Shift+s
false
Snap Orthogonal
Snap Orthogonal
Snap Orthogonal
1000
true
Snap Node
Snap Node
Snap Node
1000
true
Snap Extension
Snap Extension
Snap Extension
1000
true
Snap Intersection
Snap Intersection
Snap Intersection
1000
true
Snap Bounding Box
Snap Bounding Box
Snap Bounding Box
1000
true
Snap Image Bounds
Snap Image Bounds
Snap Image Bounds
1000
true
Snap Image Center
Snap Image Center
Snap Image Center
1000
true
S&how Painting Assistants
Show Painting Assistants
Show Painting Assistants
1000
0
true
Show &Assistant Previews
Show Assistant Previews
Show Assistant Previews
1000
0
true
S&how Reference Images
Show Reference Images
Show Reference Images
1000
0
true
Image
document-properties
&Properties...
Properties
Properties
1000
0
false
format-stroke-color
&Image Background Color and Transparency...
Change the background color of the image
Image Background Color and Transparency
1000
0
false
&Convert Image Color Space...
Convert Image Color Space
Convert Image Color Space
1000
0
false
trim-to-image
&Trim to Image Size
Trim to Image Size
Trim to Image Size
1
0
false
Trim to Current &Layer
Trim to Current Layer
Trim to Current Layer
100000
0
false
Trim to S&election
Trim to Selection
Trim to Selection
100000000
0
false
&Rotate Image...
Rotate Image
Rotate Image
1000
0
false
object-rotate-right
Rotate &Image 90° to the Right
Rotate Image 90° to the Right
Rotate Image 90° to the Right
1000
0
false
object-rotate-left
Rotate Image &90° to the Left
Rotate Image 90° to the Left
Rotate Image 90° to the Left
1000
0
false
Rotate Image &180°
Rotate Image 180°
Rotate Image 180°
1000
0
false
&Shear Image...
Shear Image
Shear Image
1000
0
false
symmetry-horizontal
&Mirror Image Horizontally
Mirror Image Horizontally
Mirror Image Horizontally
1000
0
false
symmetry-vertical
Mirror Image &Vertically
Mirror Image Vertically
Mirror Image Vertically
1000
0
false
Scale Image To &New Size...
Scale Image To New Size
Scale Image To New Size
1000
0
Ctrl+Alt+I
false
&Offset Image...
Offset Image
Offset Image
1000
0
false
R&esize Canvas...
Resize Canvas
Resize Canvas
1000
0
Ctrl+Alt+C
false
Im&age Split
Image Split
Image Split
1000
0
false
Separate Ima&ge...
Separate Image
Separate Image
1000
0
false
Select
edit-select-all
Select &All
Select All
Select All
0
0
Ctrl+A
false
edit-select-all
&Deselect
Deselect
Deselect
1100000000
0
Ctrl+Shift+A
false
&Reselect
Reselect
Reselect
0
0
Ctrl+Shift+D
false
&Invert Selection
Invert Selection
Invert Selection
10000
0
Ctrl+I
false
&Convert to Vector Selection
Convert to Vector Selection
Convert to Vector Selection
10000000000
0
false
Convert Shapes to &Vector Selection
Convert Shapes to Vector Selection
Convert Shapes to Vector Selection
1000000000
0
false
&Feather Selection...
Feather Selection
Feather Selection
10000000000
100
Shift+F6
false
Dis&play Selection
Display Selection
Display Selection
1000
0
Ctrl+H
true
Sca&le...
Scale
Scale
100000000
100
false
S&elect from Color Range...
Select from Color Range
Select from Color Range
10000
100
false
Select &Opaque
Select Opaque
Select Opaque
10000
100
false
&Grow Selection...
Grow Selection
Grow Selection
10000000000
100
false
S&hrink Selection...
Shrink Selection
Shrink Selection
10000000000
100
false
&Border Selection...
Border Selection
Border Selection
10000000000
100
false
S&mooth
Smooth
Smooth
10000000000
100
false
Filter
&Apply Filter Again
Apply Filter Again
Apply Filter Again
0
0
Ctrl+F
false
Adjust
Adjust
Adjust
false
Artistic
Artistic
Artistic
false
Blur
Blur
Blur
false
Colors
Colors
Colors
false
Edge Detection
Edge Detection
Edge Detection
false
Enhance
Enhance
Enhance
false
Emboss
Emboss
Emboss
false
Map
Map
Map
false
Other
Other
Other
false
gmic
Start G'MIC-Qt
Start G'Mic-Qt
Start G'Mic-Qt
false
gmic
Re-apply the last G'MIC filter
Apply the last G'Mic-Qt action again
Apply the last G'Mic-Qt action again
false
-
- Tools
-
- media-record
- &Start recording macro
-
- Start recording macro
- Start recording macro
- 1000
- 0
-
- false
-
-
-
- media-playback-stop
- Stop &recording macro
-
- Stop recording macro
- Stop recording macro
- 1000
- 0
-
- false
-
-
-
- media-playback-start
- &Open and play...
-
- Open and play
- Open and play
- 0
- 0
-
- false
-
-
-
- document-edit
- Open &and edit...
-
- Open and edit
- Open and edit
- 0
- 0
-
- false
-
-
-
-
Settings
configure
&Configure Krita...
Configure Krita
Configure Krita
0
0
false
&Manage Resources...
Manage Resources
Manage Resources
0
0
false
preferences-desktop-locale
Switch Application &Language...
Switch Application Language
Switch Application Language
false
&Show Dockers
Show Dockers
Show Dockers
0
0
true
configure
Configure Tool&bars...
Configure Toolbars
Configure Toolbars
0
0
false
Dockers
Dockers
Dockers
false
&Themes
Themes
Themes
false
im-user
Active Author Profile
Active Author Profile
Active Author Profile
configure-shortcuts
Configure S&hortcuts...
Configure Shortcuts
Configure Shortcuts
0
0
false
&Window
Window
Window
false
Help
help-contents
Krita &Handbook
Krita Handbook
Krita Handbook
F1
false
tools-report-bug
&Report Bug...
Report Bug
Report Bug
false
calligrakrita
&About Krita
About Krita
About Krita
false
kde
About &KDE
About KDE
About KDE
false
Brushes and Stuff
&Gradients
Gradients
Gradients
false
&Patterns
Patterns
Patterns
false
&Color
Color
Color
false
&Painter's Tools
Painter's Tools
Painter's Tools
false
Brush composite
Brush composite
Brush composite
false
Brush option slider 1
Brush option slider 1
Brush option slider 1
false
Brush option slider 2
Brush option slider 2
Brush option slider 2
false
Brush option slider 3
Brush option slider 3
Brush option slider 3
false
Mirror
Mirror
Mirror
false
Layouts
Select layout
false
Workspaces
Workspaces
Workspaces
false
diff --git a/libs/image/CMakeLists.txt b/libs/image/CMakeLists.txt
index d20f437daa..f72d83badf 100644
--- a/libs/image/CMakeLists.txt
+++ b/libs/image/CMakeLists.txt
@@ -1,402 +1,387 @@
add_subdirectory( tests )
add_subdirectory( tiles3 )
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/metadata
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty
${CMAKE_CURRENT_SOURCE_DIR}/brushengine
${CMAKE_CURRENT_SOURCE_DIR}/commands
${CMAKE_CURRENT_SOURCE_DIR}/commands_new
${CMAKE_CURRENT_SOURCE_DIR}/filter
${CMAKE_CURRENT_SOURCE_DIR}/floodfill
${CMAKE_CURRENT_SOURCE_DIR}/generator
${CMAKE_CURRENT_SOURCE_DIR}/layerstyles
${CMAKE_CURRENT_SOURCE_DIR}/processing
- ${CMAKE_CURRENT_SOURCE_DIR}/recorder
${CMAKE_SOURCE_DIR}/sdk/tests
)
include_directories(SYSTEM
${EIGEN3_INCLUDE_DIR}
)
if(FFTW3_FOUND)
include_directories(${FFTW3_INCLUDE_DIR})
endif()
if(HAVE_VC)
include_directories(SYSTEM ${Vc_INCLUDE_DIR} ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS})
ko_compile_for_all_implementations(__per_arch_circle_mask_generator_objs kis_brush_mask_applicator_factories.cpp)
else()
set(__per_arch_circle_mask_generator_objs kis_brush_mask_applicator_factories.cpp)
endif()
set(kritaimage_LIB_SRCS
tiles3/kis_tile.cc
tiles3/kis_tile_data.cc
tiles3/kis_tile_data_store.cc
tiles3/kis_tile_data_pooler.cc
tiles3/kis_tiled_data_manager.cc
tiles3/KisTiledExtentManager.cpp
tiles3/kis_memento_manager.cc
tiles3/kis_hline_iterator.cpp
tiles3/kis_vline_iterator.cpp
tiles3/kis_random_accessor.cc
tiles3/swap/kis_abstract_compression.cpp
tiles3/swap/kis_lzf_compression.cpp
tiles3/swap/kis_abstract_tile_compressor.cpp
tiles3/swap/kis_legacy_tile_compressor.cpp
tiles3/swap/kis_tile_compressor_2.cpp
tiles3/swap/kis_chunk_allocator.cpp
tiles3/swap/kis_memory_window.cpp
tiles3/swap/kis_swapped_data_store.cpp
tiles3/swap/kis_tile_data_swapper.cpp
kis_distance_information.cpp
kis_painter.cc
kis_painter_blt_multi_fixed.cpp
kis_marker_painter.cpp
KisPrecisePaintDeviceWrapper.cpp
kis_progress_updater.cpp
brushengine/kis_paint_information.cc
brushengine/kis_random_source.cpp
brushengine/KisPerStrokeRandomSource.cpp
brushengine/kis_stroke_random_source.cpp
brushengine/kis_paintop.cc
brushengine/kis_paintop_factory.cpp
brushengine/kis_paintop_preset.cpp
brushengine/kis_paintop_registry.cc
brushengine/kis_paintop_settings.cpp
brushengine/kis_paintop_settings_update_proxy.cpp
brushengine/kis_paintop_utils.cpp
brushengine/kis_no_size_paintop_settings.cpp
brushengine/kis_locked_properties.cc
brushengine/kis_locked_properties_proxy.cpp
brushengine/kis_locked_properties_server.cpp
brushengine/kis_paintop_config_widget.cpp
brushengine/kis_uniform_paintop_property.cpp
brushengine/kis_combo_based_paintop_property.cpp
brushengine/kis_slider_based_paintop_property.cpp
brushengine/kis_standard_uniform_properties_factory.cpp
brushengine/KisStrokeSpeedMeasurer.cpp
brushengine/KisPaintopSettingsIds.cpp
commands/kis_deselect_global_selection_command.cpp
commands/kis_image_change_layers_command.cpp
commands/kis_image_change_visibility_command.cpp
commands/kis_image_command.cpp
commands/kis_image_set_projection_color_space_command.cpp
commands/kis_image_layer_add_command.cpp
commands/kis_image_layer_move_command.cpp
commands/kis_image_layer_remove_command.cpp
commands/kis_image_layer_remove_command_impl.cpp
commands/kis_image_lock_command.cpp
commands/kis_node_command.cpp
commands/kis_node_compositeop_command.cpp
commands/kis_node_opacity_command.cpp
commands/kis_node_property_list_command.cpp
commands/kis_reselect_global_selection_command.cpp
commands/kis_set_global_selection_command.cpp
commands_new/kis_saved_commands.cpp
commands_new/kis_processing_command.cpp
commands_new/kis_image_resize_command.cpp
commands_new/kis_image_set_resolution_command.cpp
commands_new/kis_node_move_command2.cpp
commands_new/kis_set_layer_style_command.cpp
commands_new/kis_selection_move_command2.cpp
commands_new/kis_update_command.cpp
commands_new/kis_switch_current_time_command.cpp
commands_new/kis_change_projection_color_command.cpp
commands_new/kis_activate_selection_mask_command.cpp
processing/kis_do_nothing_processing_visitor.cpp
processing/kis_simple_processing_visitor.cpp
processing/kis_crop_processing_visitor.cpp
processing/kis_crop_selections_processing_visitor.cpp
processing/kis_transform_processing_visitor.cpp
processing/kis_mirror_processing_visitor.cpp
filter/kis_filter.cc
filter/kis_filter_configuration.cc
filter/kis_color_transformation_configuration.cc
filter/kis_filter_registry.cc
filter/kis_color_transformation_filter.cc
generator/kis_generator.cpp
generator/kis_generator_layer.cpp
generator/kis_generator_registry.cpp
floodfill/kis_fill_interval_map.cpp
floodfill/kis_scanline_fill.cpp
lazybrush/kis_min_cut_worker.cpp
lazybrush/kis_lazy_fill_tools.cpp
lazybrush/kis_multiway_cut.cpp
lazybrush/KisWatershedWorker.cpp
lazybrush/kis_colorize_mask.cpp
lazybrush/kis_colorize_stroke_strategy.cpp
KisDelayedUpdateNodeInterface.cpp
kis_adjustment_layer.cc
kis_selection_based_layer.cpp
kis_node_filter_interface.cpp
kis_base_accessor.cpp
kis_base_node.cpp
kis_base_processor.cpp
kis_bookmarked_configuration_manager.cc
kis_node_uuid_info.cpp
kis_clone_layer.cpp
kis_colorspace_convert_visitor.cpp
kis_config_widget.cpp
kis_convolution_kernel.cc
kis_convolution_painter.cc
kis_gaussian_kernel.cpp
kis_edge_detection_kernel.cpp
kis_cubic_curve.cpp
kis_default_bounds.cpp
kis_default_bounds_base.cpp
kis_effect_mask.cc
kis_fast_math.cpp
kis_fill_painter.cc
kis_filter_mask.cpp
kis_filter_strategy.cc
kis_transform_mask.cpp
kis_transform_mask_params_interface.cpp
kis_recalculate_transform_mask_job.cpp
kis_recalculate_generator_layer_job.cpp
kis_transform_mask_params_factory_registry.cpp
kis_safe_transform.cpp
kis_gradient_painter.cc
kis_gradient_shape_strategy.cpp
kis_cached_gradient_shape_strategy.cpp
kis_polygonal_gradient_shape_strategy.cpp
kis_iterator_ng.cpp
kis_async_merger.cpp
kis_merge_walker.cc
kis_updater_context.cpp
kis_update_job_item.cpp
kis_stroke_strategy_undo_command_based.cpp
kis_simple_stroke_strategy.cpp
KisRunnableBasedStrokeStrategy.cpp
KisRunnableStrokeJobData.cpp
KisRunnableStrokeJobsInterface.cpp
KisFakeRunnableStrokeJobsExecutor.cpp
kis_stroke_job_strategy.cpp
kis_stroke_strategy.cpp
kis_stroke.cpp
kis_strokes_queue.cpp
KisStrokesQueueMutatedJobInterface.cpp
kis_simple_update_queue.cpp
kis_update_scheduler.cpp
kis_queues_progress_updater.cpp
kis_composite_progress_proxy.cpp
kis_sync_lod_cache_stroke_strategy.cpp
kis_lod_capable_layer_offset.cpp
kis_update_time_monitor.cpp
KisUpdateSchedulerConfigNotifier.cpp
kis_group_layer.cc
kis_count_visitor.cpp
kis_histogram.cc
kis_image_interfaces.cpp
kis_image_animation_interface.cpp
kis_time_range.cpp
kis_node_graph_listener.cpp
kis_image.cc
kis_image_signal_router.cpp
kis_image_config.cpp
kis_projection_updates_filter.cpp
kis_suspend_projection_updates_stroke_strategy.cpp
kis_regenerate_frame_stroke_strategy.cpp
kis_switch_time_stroke_strategy.cpp
kis_crop_saved_extra_data.cpp
kis_timed_signal_threshold.cpp
kis_layer.cc
kis_indirect_painting_support.cpp
kis_abstract_projection_plane.cpp
kis_layer_projection_plane.cpp
kis_layer_utils.cpp
kis_mask_projection_plane.cpp
kis_projection_leaf.cpp
kis_mask.cc
kis_base_mask_generator.cpp
kis_rect_mask_generator.cpp
kis_circle_mask_generator.cpp
kis_gauss_circle_mask_generator.cpp
kis_gauss_rect_mask_generator.cpp
${__per_arch_circle_mask_generator_objs}
kis_curve_circle_mask_generator.cpp
kis_curve_rect_mask_generator.cpp
kis_math_toolbox.cpp
kis_memory_statistics_server.cpp
kis_name_server.cpp
kis_node.cpp
kis_node_facade.cpp
kis_node_progress_proxy.cpp
kis_busy_progress_indicator.cpp
kis_node_visitor.cpp
kis_paint_device.cc
kis_paint_device_debug_utils.cpp
kis_fixed_paint_device.cpp
KisOptimizedByteArray.cpp
kis_paint_layer.cc
kis_perspective_math.cpp
kis_pixel_selection.cpp
kis_processing_information.cpp
kis_properties_configuration.cc
kis_random_accessor_ng.cpp
kis_random_generator.cc
kis_random_sub_accessor.cpp
kis_wrapped_random_accessor.cpp
kis_selection.cc
kis_selection_mask.cpp
kis_update_outline_job.cpp
kis_update_selection_job.cpp
kis_serializable_configuration.cc
kis_transaction_data.cpp
kis_transform_worker.cc
kis_perspectivetransform_worker.cpp
bsplines/kis_bspline_1d.cpp
bsplines/kis_bspline_2d.cpp
bsplines/kis_nu_bspline_2d.cpp
kis_warptransform_worker.cc
kis_cage_transform_worker.cpp
kis_liquify_transform_worker.cpp
kis_green_coordinates_math.cpp
kis_transparency_mask.cc
kis_undo_adapter.cpp
kis_macro_based_undo_store.cpp
kis_surrogate_undo_adapter.cpp
kis_legacy_undo_adapter.cpp
kis_post_execution_undo_adapter.cpp
kis_processing_visitor.cpp
kis_processing_applicator.cpp
krita_utils.cpp
kis_outline_generator.cpp
kis_layer_composition.cpp
kis_selection_filters.cpp
KisProofingConfiguration.h
metadata/kis_meta_data_entry.cc
metadata/kis_meta_data_filter.cc
metadata/kis_meta_data_filter_p.cc
metadata/kis_meta_data_filter_registry.cc
metadata/kis_meta_data_filter_registry_model.cc
metadata/kis_meta_data_io_backend.cc
metadata/kis_meta_data_merge_strategy.cc
metadata/kis_meta_data_merge_strategy_p.cc
metadata/kis_meta_data_merge_strategy_registry.cc
metadata/kis_meta_data_parser.cc
metadata/kis_meta_data_schema.cc
metadata/kis_meta_data_schema_registry.cc
metadata/kis_meta_data_store.cc
metadata/kis_meta_data_type_info.cc
metadata/kis_meta_data_validator.cc
metadata/kis_meta_data_value.cc
- recorder/kis_action_recorder.cc
- recorder/kis_macro.cc
- recorder/kis_macro_player.cc
- recorder/kis_node_query_path.cc
- recorder/kis_play_info.cc
- recorder/kis_recorded_action.cc
- recorder/kis_recorded_action_factory_registry.cc
- recorder/kis_recorded_action_load_context.cpp
- recorder/kis_recorded_action_save_context.cpp
- recorder/kis_recorded_filter_action.cpp
- recorder/kis_recorded_fill_paint_action.cpp
- recorder/kis_recorded_node_action.cc
- recorder/kis_recorded_paint_action.cpp
- recorder/kis_recorded_path_paint_action.cpp
- recorder/kis_recorded_shape_paint_action.cpp
kis_keyframe.cpp
kis_keyframe_channel.cpp
kis_keyframe_commands.cpp
kis_scalar_keyframe_channel.cpp
kis_raster_keyframe_channel.cpp
kis_onion_skin_compositor.cpp
kis_onion_skin_cache.cpp
kis_idle_watcher.cpp
kis_psd_layer_style.cpp
kis_layer_properties_icons.cpp
layerstyles/kis_multiple_projection.cpp
layerstyles/kis_layer_style_filter.cpp
layerstyles/kis_layer_style_filter_environment.cpp
layerstyles/kis_layer_style_filter_projection_plane.cpp
layerstyles/kis_layer_style_projection_plane.cpp
layerstyles/kis_ls_drop_shadow_filter.cpp
layerstyles/kis_ls_satin_filter.cpp
layerstyles/kis_ls_stroke_filter.cpp
layerstyles/kis_ls_bevel_emboss_filter.cpp
layerstyles/kis_ls_overlay_filter.cpp
layerstyles/kis_ls_utils.cpp
layerstyles/gimp_bump_map.cpp
KisProofingConfiguration.cpp
+
+ kis_node_query_path.cc
)
set(einspline_SRCS
3rdparty/einspline/bspline_create.cpp
3rdparty/einspline/bspline_data.cpp
3rdparty/einspline/multi_bspline_create.cpp
3rdparty/einspline/nubasis.cpp
3rdparty/einspline/nubspline_create.cpp
3rdparty/einspline/nugrid.cpp
)
add_library(kritaimage SHARED ${kritaimage_LIB_SRCS} ${einspline_SRCS})
generate_export_header(kritaimage BASE_NAME kritaimage)
target_link_libraries(kritaimage
PUBLIC
kritaversion
kritawidgets
kritaglobal kritapsd
kritaodf kritapigment
kritacommand
kritawidgetutils
Qt5::Concurrent
)
target_link_libraries(kritaimage PUBLIC ${Boost_SYSTEM_LIBRARY})
if(OPENEXR_FOUND)
target_link_libraries(kritaimage PUBLIC ${OPENEXR_LIBRARIES})
endif()
if(FFTW3_FOUND)
target_link_libraries(kritaimage PRIVATE ${FFTW3_LIBRARIES})
endif()
if(HAVE_VC)
target_link_libraries(kritaimage PUBLIC ${Vc_LIBRARIES})
endif()
if (NOT GSL_FOUND)
message (WARNING "KRITA WARNING! No GNU Scientific Library was found! Krita's Shaped Gradients might be non-normalized! Please install GSL library.")
else ()
target_link_libraries(kritaimage PRIVATE ${GSL_LIBRARIES} ${GSL_CBLAS_LIBRARIES})
endif ()
target_include_directories(kritaimage
PUBLIC
$
$
$
$
$
$
- $
)
set_target_properties(kritaimage PROPERTIES
VERSION ${GENERIC_KRITA_LIB_VERSION} SOVERSION ${GENERIC_KRITA_LIB_SOVERSION}
)
install(TARGETS kritaimage ${INSTALL_TARGETS_DEFAULT_ARGS})
########### install schemas #############
install( FILES
metadata/schemas/dc.schema
metadata/schemas/exif.schema
metadata/schemas/tiff.schema
metadata/schemas/mkn.schema
metadata/schemas/xmp.schema
metadata/schemas/xmpmm.schema
metadata/schemas/xmprights.schema
DESTINATION ${DATA_INSTALL_DIR}/krita/metadata/schemas)
diff --git a/libs/image/TODO b/libs/image/TODO
deleted file mode 100644
index 6698919416..0000000000
--- a/libs/image/TODO
+++ /dev/null
@@ -1,5 +0,0 @@
-because KoUpdater was moved to komvc, Krita/Image now
-depends on komvc again -- this is not right, since it
-makes it impossible to use krita/image outside a calligra
-mvc application framework, so KoUpdater must be moved out
-again.
diff --git a/libs/image/brushengine/kis_paintop_settings.h b/libs/image/brushengine/kis_paintop_settings.h
index d820f5bcce..14c39bbf89 100644
--- a/libs/image/brushengine/kis_paintop_settings.h
+++ b/libs/image/brushengine/kis_paintop_settings.h
@@ -1,351 +1,351 @@
/*
* Copyright (c) 2007 Boudewijn Rempt
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTOP_SETTINGS_H_
#define KIS_PAINTOP_SETTINGS_H_
#include "kis_types.h"
#include "kritaimage_export.h"
#include
#include
#include "kis_properties_configuration.h"
#include
#include
class KisPaintOpConfigWidget;
class KisPaintopSettingsUpdateProxy;
/**
* Configuration property used to control whether airbrushing is enabled.
*/
const QString AIRBRUSH_ENABLED = "PaintOpSettings/isAirbrushing";
/**
* Configuration property used to control airbrushing rate. The value should be in dabs per second.
*/
const QString AIRBRUSH_RATE = "PaintOpSettings/rate";
/**
* Configuration property used to control whether airbrushing is configured to ignore distance-based
* spacing.
*/
const QString AIRBRUSH_IGNORE_SPACING = "PaintOpSettings/ignoreSpacing";
/**
* Configuration property used to control whether the spacing settings can be updated between
* painted dabs.
*/
const QString SPACING_USE_UPDATES = "PaintOpSettings/updateSpacingBetweenDabs";
/**
* This class is used to cache the settings for a paintop
* between two creations. There is one KisPaintOpSettings per input device (mouse, tablet,
* etc...).
*
- * The settings may be stored in a preset or a recorded brush stroke. Note that if your
+ * The settings may be stored in a preset. Note that if your
* paintop's settings subclass has data that is not stored as a property, that data is not
* saved and restored.
*
* The object also contains a pointer to its parent KisPaintOpPreset object.This is to control the DirtyPreset
* property of KisPaintOpPreset. Whenever the settings are changed/modified from the original -- the preset is
* set to dirty.
*/
class KRITAIMAGE_EXPORT KisPaintOpSettings : public KisPropertiesConfiguration
{
public:
KisPaintOpSettings();
~KisPaintOpSettings() override;
KisPaintOpSettings(const KisPaintOpSettings &rhs);
/**
*
*/
void setOptionsWidget(KisPaintOpConfigWidget* widget);
/**
* This function is called by a tool when the mouse is pressed. It's useful if
* the paintop needs mouse interaction for instance in the case of the clone op.
* If the tool is supposed to ignore the event, the paint op should return false
* and if the tool is supposed to use the event, return true.
*/
virtual bool mousePressEvent(const KisPaintInformation &paintInformation, Qt::KeyboardModifiers modifiers, KisNodeWSP currentNode);
/**
* Clone the current settings object. Override this if your settings instance doesn't
* store everything as properties.
*/
virtual KisPaintOpSettingsSP clone() const;
/**
* Removes all the settings from the object while keeping the paintop id,
* which is loaded to the object by the factory
*/
void resetSettings(const QStringList &preserveProperties = QStringList());
/**
* @return the node the paintop is working on.
*/
KisNodeSP node() const;
/**
* Call this function when the paint op is selected or the tool is activated
*/
virtual void activate();
/**
* XXX: Remove this after 2.0, when the paint operation (incremental/non incremental) will
* be completely handled in the paintop, not in the tool. This is a filthy hack to move
* the option to the right place, at least.
* @return true if we paint incrementally, false if we paint like Photoshop. By default, paintops
* do not support non-incremental.
*/
virtual bool paintIncremental() {
return true;
}
/**
* @return the composite op it to which the indirect painting device
* should be initialized to. This is used by clone op to reset
* the composite op to COMPOSITE_COPY
*/
virtual QString indirectPaintingCompositeOp() const;
/**
* Whether this paintop wants to deposit paint even when not moving, i.e. the tool needs to
* activate its timer. If this is true, painting updates need to be generated at regular
* intervals even in the absence of input device events, e.g. when the cursor is not moving.
*
* The default implementation checks the property AIRBRUSH_ENABLED, defaulting to false if the
* property is not found. This should be suitable for most paintops.
*/
virtual bool isAirbrushing() const;
/**
* Indicates the minimum time interval that might be needed between airbrush dabs, in
* milliseconds. A lower value means painting updates need to happen more frequently. This value
* should be ignored if isAirbrushing() is false.
*
* The default implementation uses the property AIRBRUSH_RATE, defaulting to an interval of
* one second if the property is not found. This should be suitable for most paintops.
*/
virtual qreal airbrushInterval() const;
/**
* Indicates whether this configuration allows spacing information to be updated between painted
* dabs during a stroke.
*/
virtual bool useSpacingUpdates() const;
/**
* Indicates if the tool should call paintOp->doAsynchronousUpdate() inbetween
* paintAt() calls to do the asynchronous rendering
*/
virtual bool needsAsynchronousUpdates() const;
/**
* This structure defines the current mode for painting an outline.
*/
struct OutlineMode {
bool isVisible = false;
bool forceCircle = false;
bool showTiltDecoration = false;
bool forceFullSize = false;
};
/**
* Returns the brush outline in pixel coordinates. Tool is responsible for conversion into view coordinates.
* Outline mode has to be passed to the paintop which builds the outline as some paintops have to paint outline
* always like clone paintop indicating the duplicate position
*/
virtual QPainterPath brushOutline(const KisPaintInformation &info, const OutlineMode &mode);
/**
* Helpers for drawing the brush outline
*/
static QPainterPath ellipseOutline(qreal width, qreal height, qreal scale, qreal rotation);
/**
* Helper for drawing a triangle representing the tilt of the stylus.
*
* @param start is the offset from the brush's outline's bounding box
* @param lengthScale is used for deciding the size of the triangle.
* Brush diameter or width are common choices for this.
* @param angle is the angle between the two sides of the triangle.
*/
static QPainterPath makeTiltIndicator(KisPaintInformation const& info,
QPointF const& start, qreal lengthScale, qreal angle);
/**
* Set paintop opacity directly in the properties
*/
void setPaintOpOpacity(qreal value);
/**
* Set paintop flow directly in the properties
*/
void setPaintOpFlow(qreal value);
/**
* Set paintop composite mode directly in the properties
*/
void setPaintOpCompositeOp(const QString &value);
/**
* @return opacity saved in the properties
*/
qreal paintOpOpacity();
/**
* @return flow saved in the properties
*/
qreal paintOpFlow();
/**
* @return composite mode saved in the properties
*/
QString paintOpCompositeOp();
/**
* Set paintop size directly in the properties
*/
virtual void setPaintOpSize(qreal value) = 0;
/**
* @return size saved in the properties
*/
virtual qreal paintOpSize() const = 0;
void setEraserMode(bool value);
bool eraserMode();
qreal savedEraserSize() const;
void setSavedEraserSize(qreal value);
qreal savedBrushSize() const;
void setSavedBrushSize(qreal value);
qreal savedEraserOpacity() const;
void setSavedEraserOpacity(qreal value);
qreal savedBrushOpacity() const;
void setSavedBrushOpacity(qreal value);
QString effectivePaintOpCompositeOp();
void setPreset(KisPaintOpPresetWSP preset);
KisPaintOpPresetWSP preset() const;
/**
* @return filename of the 3D brush model, empty if no brush is set
*/
virtual QString modelName() const;
/**
* Set filename of 3D brush model. By default no brush is set
*/
void setModelName(const QString & modelName);
/// Check if the settings are valid, setting might be invalid through missing brushes etc
/// Overwrite if the settings of a paintop can be invalid
/// @return state of the settings, default implementation is true
virtual bool isValid() const;
/// Check if the settings are loadable, that might the case if we can fallback to something
/// Overwrite if the settings can do some kind of fallback
/// @return loadable state of the settings, by default implementation return the same as isValid()
virtual bool isLoadable();
/**
* These methods are populating properties with runtime
* information about canvas rotation/mirroring. This information
* is set directly by KisToolFreehand. Later the data is accessed
* by the pressure options to make a final decision.
*/
void setCanvasRotation(qreal angle);
void setCanvasMirroring(bool xAxisMirrored, bool yAxisMirrored);
/**
* Overrides the method in KisPropertiesCofiguration to allow
* onPropertyChanged() callback
*/
void setProperty(const QString & name, const QVariant & value) override;
virtual QList uniformProperties(KisPaintOpSettingsSP settings);
static bool isLodUserAllowed(const KisPropertiesConfigurationSP config);
static void setLodUserAllowed(KisPropertiesConfigurationSP config, bool value);
virtual bool lodSizeThresholdSupported() const;
qreal lodSizeThreshold() const;
void setLodSizeThreshold(qreal value);
/**
* @return the option widget of the paintop (can be 0 is no option widgets is set)
*/
KisPaintOpConfigWidget* optionsWidget() const;
/**
* This function is called to set random offsets to the brush whenever the mouse is clicked. It is
* specific to when the pattern option is set.
*
*/
virtual void setRandomOffset(const KisPaintInformation &paintInformation);
/**
* @return true if this preset demands a secondary masked brush running
* alongside it
*/
bool hasMaskingSettings() const;
/**
* @return a newly created settings object representing a preset of the masking
* brush that should be run alongside the current brush
*/
KisPaintOpSettingsSP createMaskingSettings() const;
/**
* @return a composite op id of the masked brush rendering algorithm.
*
* Please take into account that the brush itself always paints in alpha-
* darken mode, but the final result is combined with this composite op.
*/
QString maskingBrushCompositeOp() const;
protected:
/**
* The callback is called every time when a property changes
*/
virtual void onPropertyChanged();
private:
struct Private;
const QScopedPointer d;
};
#endif
diff --git a/libs/image/kis_image.cc b/libs/image/kis_image.cc
index 51be3f46df..fa5415f891 100644
--- a/libs/image/kis_image.cc
+++ b/libs/image/kis_image.cc
@@ -1,1778 +1,1769 @@
/*
* Copyright (c) 2002 Patrick Julien
* Copyright (c) 2007 Boudewijn Rempt
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_image.h"
#include // WORDS_BIGENDIAN
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "KoColorSpaceRegistry.h"
#include "KoColor.h"
#include "KoColorProfile.h"
#include
#include "KisProofingConfiguration.h"
-#include "recorder/kis_action_recorder.h"
#include "kis_adjustment_layer.h"
#include "kis_annotation.h"
#include "kis_change_profile_visitor.h"
#include "kis_colorspace_convert_visitor.h"
#include "kis_count_visitor.h"
#include "kis_filter_strategy.h"
#include "kis_group_layer.h"
#include "commands/kis_image_commands.h"
#include "kis_layer.h"
#include "kis_meta_data_merge_strategy_registry.h"
#include "kis_name_server.h"
#include "kis_paint_layer.h"
#include "kis_projection_leaf.h"
#include "kis_painter.h"
#include "kis_selection.h"
#include "kis_transaction.h"
#include "kis_meta_data_merge_strategy.h"
#include "kis_memory_statistics_server.h"
#include "kis_image_config.h"
#include "kis_update_scheduler.h"
#include "kis_image_signal_router.h"
#include "kis_image_animation_interface.h"
#include "kis_stroke_strategy.h"
#include "kis_simple_stroke_strategy.h"
#include "kis_image_barrier_locker.h"
#include "kis_undo_stores.h"
#include "kis_legacy_undo_adapter.h"
#include "kis_post_execution_undo_adapter.h"
#include "kis_transform_worker.h"
#include "kis_processing_applicator.h"
#include "processing/kis_crop_processing_visitor.h"
#include "processing/kis_crop_selections_processing_visitor.h"
#include "processing/kis_transform_processing_visitor.h"
#include "commands_new/kis_image_resize_command.h"
#include "commands_new/kis_image_set_resolution_command.h"
#include "commands_new/kis_activate_selection_mask_command.h"
#include "kis_composite_progress_proxy.h"
#include "kis_layer_composition.h"
#include "kis_wrapped_rect.h"
#include "kis_crop_saved_extra_data.h"
#include "kis_layer_utils.h"
#include "kis_lod_transform.h"
#include "kis_suspend_projection_updates_stroke_strategy.h"
#include "kis_sync_lod_cache_stroke_strategy.h"
#include "kis_projection_updates_filter.h"
#include "kis_layer_projection_plane.h"
#include "kis_update_time_monitor.h"
#include "kis_image_barrier_locker.h"
#include
#include
#include "kis_time_range.h"
// #define SANITY_CHECKS
#ifdef SANITY_CHECKS
#define SANITY_CHECK_LOCKED(name) \
if (!locked()) warnKrita() << "Locking policy failed:" << name \
<< "has been called without the image" \
"being locked";
#else
#define SANITY_CHECK_LOCKED(name)
#endif
struct KisImageSPStaticRegistrar {
KisImageSPStaticRegistrar() {
qRegisterMetaType("KisImageSP");
}
};
static KisImageSPStaticRegistrar __registrar;
class KisImage::KisImagePrivate
{
public:
KisImagePrivate(KisImage *_q, qint32 w, qint32 h,
const KoColorSpace *c,
KisUndoStore *undo,
KisImageAnimationInterface *_animationInterface)
: q(_q)
, lockedForReadOnly(false)
, width(w)
, height(h)
, colorSpace(c ? c : KoColorSpaceRegistry::instance()->rgb8())
, nserver(1)
, undoStore(undo ? undo : new KisDumbUndoStore())
, legacyUndoAdapter(undoStore.data(), _q)
, postExecutionUndoAdapter(undoStore.data(), _q)
- , recorder(_q)
, signalRouter(_q)
, animationInterface(_animationInterface)
, scheduler(_q, _q)
, axesCenter(QPointF(0.5, 0.5))
{
{
KisImageConfig cfg;
if (cfg.enableProgressReporting()) {
scheduler.setProgressProxy(&compositeProgressProxy);
}
// Each of these lambdas defines a new factory function.
scheduler.setLod0ToNStrokeStrategyFactory(
[=](bool forgettable) {
return KisLodSyncPair(
new KisSyncLodCacheStrokeStrategy(KisImageWSP(q), forgettable),
KisSyncLodCacheStrokeStrategy::createJobsData(KisImageWSP(q)));
});
scheduler.setSuspendUpdatesStrokeStrategyFactory(
[=]() {
return KisSuspendResumePair(
new KisSuspendProjectionUpdatesStrokeStrategy(KisImageWSP(q), true),
KisSuspendProjectionUpdatesStrokeStrategy::createSuspendJobsData(KisImageWSP(q)));
});
scheduler.setResumeUpdatesStrokeStrategyFactory(
[=]() {
return KisSuspendResumePair(
new KisSuspendProjectionUpdatesStrokeStrategy(KisImageWSP(q), false),
KisSuspendProjectionUpdatesStrokeStrategy::createResumeJobsData(KisImageWSP(q)));
});
}
connect(q, SIGNAL(sigImageModified()), KisMemoryStatisticsServer::instance(), SLOT(notifyImageChanged()));
}
~KisImagePrivate() {
/**
* Stop animation interface. It may use the rootLayer.
*/
delete animationInterface;
/**
* First delete the nodes, while strokes
* and undo are still alive
*/
rootLayer.clear();
}
KisImage *q;
quint32 lockCount = 0;
bool lockedForReadOnly;
qint32 width;
qint32 height;
double xres = 1.0;
double yres = 1.0;
const KoColorSpace * colorSpace;
KisProofingConfigurationSP proofingConfig;
KisSelectionSP deselectedGlobalSelection;
KisGroupLayerSP rootLayer; // The layers are contained in here
QList compositions;
KisNodeSP isolatedRootNode;
bool wrapAroundModePermitted = false;
KisNameServer nserver;
QScopedPointer undoStore;
KisLegacyUndoAdapter legacyUndoAdapter;
KisPostExecutionUndoAdapter postExecutionUndoAdapter;
- KisActionRecorder recorder;
-
vKisAnnotationSP annotations;
QAtomicInt disableUIUpdateSignals;
KisProjectionUpdatesFilterSP projectionUpdatesFilter;
KisImageSignalRouter signalRouter;
KisImageAnimationInterface *animationInterface;
KisUpdateScheduler scheduler;
QAtomicInt disableDirtyRequests;
KisCompositeProgressProxy compositeProgressProxy;
bool blockLevelOfDetail = false;
QPointF axesCenter;
bool tryCancelCurrentStrokeAsync();
void notifyProjectionUpdatedInPatches(const QRect &rc);
};
KisImage::KisImage(KisUndoStore *undoStore, qint32 width, qint32 height, const KoColorSpace * colorSpace, const QString& name)
: QObject(0)
, KisShared()
, m_d(new KisImagePrivate(this, width, height,
colorSpace, undoStore,
new KisImageAnimationInterface(this)))
{
// make sure KisImage belongs to the GUI thread
moveToThread(qApp->thread());
connect(this, SIGNAL(sigInternalStopIsolatedModeRequested()), SLOT(stopIsolatedMode()));
setObjectName(name);
setRootLayer(new KisGroupLayer(this, "root", OPACITY_OPAQUE_U8));
}
KisImage::~KisImage()
{
dbgImage << "deleting kisimage" << objectName();
/**
* Request the tools to end currently running strokes
*/
waitForDone();
delete m_d;
disconnect(); // in case Qt gets confused
}
KisImage *KisImage::clone(bool exactCopy)
{
return new KisImage(*this, 0, exactCopy);
}
KisImage::KisImage(const KisImage& rhs, KisUndoStore *undoStore, bool exactCopy)
: KisNodeFacade(),
KisNodeGraphListener(),
KisShared(),
m_d(new KisImagePrivate(this,
rhs.width(), rhs.height(),
rhs.colorSpace(),
undoStore ? undoStore : new KisDumbUndoStore(),
new KisImageAnimationInterface(*rhs.animationInterface(), this)))
{
// make sure KisImage belongs to the GUI thread
moveToThread(qApp->thread());
connect(this, SIGNAL(sigInternalStopIsolatedModeRequested()), SLOT(stopIsolatedMode()));
setObjectName(rhs.objectName());
m_d->xres = rhs.m_d->xres;
m_d->yres = rhs.m_d->yres;
if (rhs.m_d->proofingConfig) {
m_d->proofingConfig = toQShared(new KisProofingConfiguration(*rhs.m_d->proofingConfig));
}
KisNodeSP newRoot = rhs.root()->clone();
newRoot->setGraphListener(this);
newRoot->setImage(this);
m_d->rootLayer = dynamic_cast(newRoot.data());
setRoot(newRoot);
if (exactCopy || rhs.m_d->isolatedRootNode) {
QQueue linearizedNodes;
KisLayerUtils::recursiveApplyNodes(rhs.root(),
[&linearizedNodes](KisNodeSP node) {
linearizedNodes.enqueue(node);
});
KisLayerUtils::recursiveApplyNodes(newRoot,
[&linearizedNodes, exactCopy, &rhs, this](KisNodeSP node) {
KisNodeSP refNode = linearizedNodes.dequeue();
if (exactCopy) {
node->setUuid(refNode->uuid());
}
if (rhs.m_d->isolatedRootNode &&
rhs.m_d->isolatedRootNode == refNode) {
m_d->isolatedRootNode = node;
}
});
}
Q_FOREACH (KisLayerCompositionSP comp, rhs.m_d->compositions) {
m_d->compositions << toQShared(new KisLayerComposition(*comp, this));
}
rhs.m_d->nserver = KisNameServer(rhs.m_d->nserver);
vKisAnnotationSP newAnnotations;
Q_FOREACH (KisAnnotationSP annotation, rhs.m_d->annotations) {
newAnnotations << annotation->clone();
}
m_d->annotations = newAnnotations;
KIS_ASSERT_RECOVER_NOOP(!rhs.m_d->projectionUpdatesFilter);
KIS_ASSERT_RECOVER_NOOP(!rhs.m_d->disableUIUpdateSignals);
KIS_ASSERT_RECOVER_NOOP(!rhs.m_d->disableDirtyRequests);
m_d->blockLevelOfDetail = rhs.m_d->blockLevelOfDetail;
}
void KisImage::aboutToAddANode(KisNode *parent, int index)
{
KisNodeGraphListener::aboutToAddANode(parent, index);
SANITY_CHECK_LOCKED("aboutToAddANode");
}
void KisImage::nodeHasBeenAdded(KisNode *parent, int index)
{
KisNodeGraphListener::nodeHasBeenAdded(parent, index);
SANITY_CHECK_LOCKED("nodeHasBeenAdded");
m_d->signalRouter.emitNodeHasBeenAdded(parent, index);
KisNodeSP newNode = parent->at(index);
if (!dynamic_cast(newNode.data())) {
emit sigInternalStopIsolatedModeRequested();
}
}
void KisImage::aboutToRemoveANode(KisNode *parent, int index)
{
KisNodeSP deletedNode = parent->at(index);
if (!dynamic_cast(deletedNode.data())) {
emit sigInternalStopIsolatedModeRequested();
}
KisNodeGraphListener::aboutToRemoveANode(parent, index);
SANITY_CHECK_LOCKED("aboutToRemoveANode");
m_d->signalRouter.emitAboutToRemoveANode(parent, index);
}
void KisImage::nodeChanged(KisNode* node)
{
KisNodeGraphListener::nodeChanged(node);
requestStrokeEnd();
m_d->signalRouter.emitNodeChanged(node);
}
void KisImage::invalidateAllFrames()
{
invalidateFrames(KisTimeRange::infinite(0), QRect());
}
KisSelectionSP KisImage::globalSelection() const
{
KisSelectionMaskSP selectionMask = m_d->rootLayer->selectionMask();
if (selectionMask) {
return selectionMask->selection();
} else {
return 0;
}
}
void KisImage::setGlobalSelection(KisSelectionSP globalSelection)
{
KisSelectionMaskSP selectionMask = m_d->rootLayer->selectionMask();
if (!globalSelection) {
if (selectionMask) {
removeNode(selectionMask);
}
}
else {
if (!selectionMask) {
selectionMask = new KisSelectionMask(this);
selectionMask->initSelection(m_d->rootLayer);
addNode(selectionMask);
// If we do not set the selection now, the setActive call coming next
// can be very, very expensive, depending on the size of the image.
selectionMask->setSelection(globalSelection);
selectionMask->setActive(true);
}
else {
selectionMask->setSelection(globalSelection);
}
Q_ASSERT(m_d->rootLayer->childCount() > 0);
Q_ASSERT(m_d->rootLayer->selectionMask());
}
m_d->deselectedGlobalSelection = 0;
m_d->legacyUndoAdapter.emitSelectionChanged();
}
void KisImage::deselectGlobalSelection()
{
KisSelectionSP savedSelection = globalSelection();
setGlobalSelection(0);
m_d->deselectedGlobalSelection = savedSelection;
}
bool KisImage::canReselectGlobalSelection()
{
return m_d->deselectedGlobalSelection;
}
void KisImage::reselectGlobalSelection()
{
if(m_d->deselectedGlobalSelection) {
setGlobalSelection(m_d->deselectedGlobalSelection);
}
}
QString KisImage::nextLayerName(const QString &_baseName) const
{
QString baseName = _baseName;
if (m_d->nserver.currentSeed() == 0) {
m_d->nserver.number();
return i18n("background");
}
if (baseName.isEmpty()) {
baseName = i18n("Layer");
}
return QString("%1 %2").arg(baseName).arg(m_d->nserver.number());
}
void KisImage::rollBackLayerName()
{
m_d->nserver.rollback();
}
KisCompositeProgressProxy* KisImage::compositeProgressProxy()
{
return &m_d->compositeProgressProxy;
}
bool KisImage::locked() const
{
return m_d->lockCount != 0;
}
void KisImage::barrierLock(bool readOnly)
{
if (!locked()) {
requestStrokeEnd();
m_d->scheduler.barrierLock();
m_d->lockedForReadOnly = readOnly;
} else {
m_d->lockedForReadOnly &= readOnly;
}
m_d->lockCount++;
}
bool KisImage::tryBarrierLock(bool readOnly)
{
bool result = true;
if (!locked()) {
result = m_d->scheduler.tryBarrierLock();
m_d->lockedForReadOnly = readOnly;
}
if (result) {
m_d->lockCount++;
m_d->lockedForReadOnly &= readOnly;
}
return result;
}
bool KisImage::isIdle(bool allowLocked)
{
return (allowLocked || !locked()) && m_d->scheduler.isIdle();
}
void KisImage::lock()
{
if (!locked()) {
requestStrokeEnd();
m_d->scheduler.lock();
}
m_d->lockCount++;
m_d->lockedForReadOnly = false;
}
void KisImage::unlock()
{
Q_ASSERT(locked());
if (locked()) {
m_d->lockCount--;
if (m_d->lockCount == 0) {
m_d->scheduler.unlock(!m_d->lockedForReadOnly);
}
}
}
void KisImage::blockUpdates()
{
m_d->scheduler.blockUpdates();
}
void KisImage::unblockUpdates()
{
m_d->scheduler.unblockUpdates();
}
void KisImage::setSize(const QSize& size)
{
m_d->width = size.width();
m_d->height = size.height();
}
void KisImage::resizeImageImpl(const QRect& newRect, bool cropLayers)
{
if (newRect == bounds() && !cropLayers) return;
KUndo2MagicString actionName = cropLayers ?
kundo2_i18n("Crop Image") :
kundo2_i18n("Resize Image");
KisImageSignalVector emitSignals;
emitSignals << ComplexSizeChangedSignal(newRect, newRect.size());
emitSignals << ModifiedSignal;
KisCropSavedExtraData *extraData =
new KisCropSavedExtraData(cropLayers ?
KisCropSavedExtraData::CROP_IMAGE :
KisCropSavedExtraData::RESIZE_IMAGE,
newRect);
KisProcessingApplicator applicator(this, m_d->rootLayer,
KisProcessingApplicator::RECURSIVE |
KisProcessingApplicator::NO_UI_UPDATES,
emitSignals, actionName, extraData);
if (cropLayers || !newRect.topLeft().isNull()) {
KisProcessingVisitorSP visitor =
new KisCropProcessingVisitor(newRect, cropLayers, true);
applicator.applyVisitorAllFrames(visitor, KisStrokeJobData::CONCURRENT);
}
applicator.applyCommand(new KisImageResizeCommand(this, newRect.size()));
applicator.end();
}
void KisImage::resizeImage(const QRect& newRect)
{
resizeImageImpl(newRect, false);
}
void KisImage::cropImage(const QRect& newRect)
{
resizeImageImpl(newRect, true);
}
void KisImage::cropNode(KisNodeSP node, const QRect& newRect)
{
bool isLayer = qobject_cast(node.data());
KUndo2MagicString actionName = isLayer ?
kundo2_i18n("Crop Layer") :
kundo2_i18n("Crop Mask");
KisImageSignalVector emitSignals;
emitSignals << ModifiedSignal;
KisCropSavedExtraData *extraData =
new KisCropSavedExtraData(KisCropSavedExtraData::CROP_LAYER,
newRect, node);
KisProcessingApplicator applicator(this, node,
KisProcessingApplicator::RECURSIVE,
emitSignals, actionName, extraData);
KisProcessingVisitorSP visitor =
new KisCropProcessingVisitor(newRect, true, false);
applicator.applyVisitorAllFrames(visitor, KisStrokeJobData::CONCURRENT);
applicator.end();
}
void KisImage::scaleImage(const QSize &size, qreal xres, qreal yres, KisFilterStrategy *filterStrategy)
{
bool resolutionChanged = xres != xRes() && yres != yRes();
bool sizeChanged = size != this->size();
if (!resolutionChanged && !sizeChanged) return;
KisImageSignalVector emitSignals;
if (resolutionChanged) emitSignals << ResolutionChangedSignal;
if (sizeChanged) emitSignals << ComplexSizeChangedSignal(bounds(), size);
emitSignals << ModifiedSignal;
KUndo2MagicString actionName = sizeChanged ?
kundo2_i18n("Scale Image") :
kundo2_i18n("Change Image Resolution");
KisProcessingApplicator::ProcessingFlags signalFlags =
(resolutionChanged || sizeChanged) ?
KisProcessingApplicator::NO_UI_UPDATES :
KisProcessingApplicator::NONE;
KisProcessingApplicator applicator(this, m_d->rootLayer,
KisProcessingApplicator::RECURSIVE | signalFlags,
emitSignals, actionName);
qreal sx = qreal(size.width()) / this->size().width();
qreal sy = qreal(size.height()) / this->size().height();
QTransform shapesCorrection;
if (resolutionChanged) {
shapesCorrection = QTransform::fromScale(xRes() / xres, yRes() / yres);
}
KisProcessingVisitorSP visitor =
new KisTransformProcessingVisitor(sx, sy,
0, 0,
QPointF(),
0,
0, 0,
filterStrategy,
shapesCorrection);
applicator.applyVisitorAllFrames(visitor, KisStrokeJobData::CONCURRENT);
if (resolutionChanged) {
KUndo2Command *parent =
new KisResetShapesCommand(m_d->rootLayer);
new KisImageSetResolutionCommand(this, xres, yres, parent);
applicator.applyCommand(parent);
}
if (sizeChanged) {
applicator.applyCommand(new KisImageResizeCommand(this, size));
}
applicator.end();
}
void KisImage::scaleNode(KisNodeSP node, qreal scaleX, qreal scaleY, KisFilterStrategy *filterStrategy)
{
KUndo2MagicString actionName(kundo2_i18n("Scale Layer"));
KisImageSignalVector emitSignals;
emitSignals << ModifiedSignal;
KisProcessingApplicator applicator(this, node,
KisProcessingApplicator::RECURSIVE,
emitSignals, actionName);
KisProcessingVisitorSP visitor =
new KisTransformProcessingVisitor(scaleX, scaleY,
0, 0,
QPointF(),
0,
0, 0,
filterStrategy);
applicator.applyVisitorAllFrames(visitor, KisStrokeJobData::CONCURRENT);
applicator.end();
}
void KisImage::rotateImpl(const KUndo2MagicString &actionName,
KisNodeSP rootNode,
bool resizeImage,
double radians)
{
QPointF offset;
QSize newSize;
{
KisTransformWorker worker(0,
1.0, 1.0,
0, 0, 0, 0,
radians,
0, 0, 0, 0);
QTransform transform = worker.transform();
if (resizeImage) {
QRect newRect = transform.mapRect(bounds());
newSize = newRect.size();
offset = -newRect.topLeft();
}
else {
QPointF origin = QRectF(rootNode->exactBounds()).center();
newSize = size();
offset = -(transform.map(origin) - origin);
}
}
bool sizeChanged = resizeImage &&
(newSize.width() != width() || newSize.height() != height());
// These signals will be emitted after processing is done
KisImageSignalVector emitSignals;
if (sizeChanged) emitSignals << ComplexSizeChangedSignal(bounds(), newSize);
emitSignals << ModifiedSignal;
// These flags determine whether updates are transferred to the UI during processing
KisProcessingApplicator::ProcessingFlags signalFlags =
sizeChanged ?
KisProcessingApplicator::NO_UI_UPDATES :
KisProcessingApplicator::NONE;
KisProcessingApplicator applicator(this, rootNode,
KisProcessingApplicator::RECURSIVE | signalFlags,
emitSignals, actionName);
KisFilterStrategy *filter = KisFilterStrategyRegistry::instance()->value("Bicubic");
KisProcessingVisitorSP visitor =
new KisTransformProcessingVisitor(1.0, 1.0, 0.0, 0.0,
QPointF(),
radians,
offset.x(), offset.y(),
filter);
applicator.applyVisitorAllFrames(visitor, KisStrokeJobData::CONCURRENT);
if (sizeChanged) {
applicator.applyCommand(new KisImageResizeCommand(this, newSize));
}
applicator.end();
}
void KisImage::rotateImage(double radians)
{
rotateImpl(kundo2_i18n("Rotate Image"), root(), true, radians);
}
void KisImage::rotateNode(KisNodeSP node, double radians)
{
if (node->inherits("KisMask")) {
rotateImpl(kundo2_i18n("Rotate Mask"), node, false, radians);
} else {
rotateImpl(kundo2_i18n("Rotate Layer"), node, false, radians);
}
}
void KisImage::shearImpl(const KUndo2MagicString &actionName,
KisNodeSP rootNode,
bool resizeImage,
double angleX, double angleY,
const QPointF &origin)
{
//angleX, angleY are in degrees
const qreal pi = 3.1415926535897932385;
const qreal deg2rad = pi / 180.0;
qreal tanX = tan(angleX * deg2rad);
qreal tanY = tan(angleY * deg2rad);
QPointF offset;
QSize newSize;
{
KisTransformWorker worker(0,
1.0, 1.0,
tanX, tanY, origin.x(), origin.y(),
0,
0, 0, 0, 0);
QRect newRect = worker.transform().mapRect(bounds());
newSize = newRect.size();
if (resizeImage) offset = -newRect.topLeft();
}
if (newSize == size()) return;
KisImageSignalVector emitSignals;
if (resizeImage) emitSignals << ComplexSizeChangedSignal(bounds(), newSize);
emitSignals << ModifiedSignal;
KisProcessingApplicator::ProcessingFlags signalFlags =
KisProcessingApplicator::RECURSIVE;
if (resizeImage) signalFlags |= KisProcessingApplicator::NO_UI_UPDATES;
KisProcessingApplicator applicator(this, rootNode,
signalFlags,
emitSignals, actionName);
KisFilterStrategy *filter = KisFilterStrategyRegistry::instance()->value("Bilinear");
KisProcessingVisitorSP visitor =
new KisTransformProcessingVisitor(1.0, 1.0,
tanX, tanY, origin,
0,
offset.x(), offset.y(),
filter);
applicator.applyVisitorAllFrames(visitor, KisStrokeJobData::CONCURRENT);
if (resizeImage) {
applicator.applyCommand(new KisImageResizeCommand(this, newSize));
}
applicator.end();
}
void KisImage::shearNode(KisNodeSP node, double angleX, double angleY)
{
QPointF shearOrigin = QRectF(bounds()).center();
if (node->inherits("KisMask")) {
shearImpl(kundo2_i18n("Shear Mask"), node, false,
angleX, angleY, shearOrigin);
} else {
shearImpl(kundo2_i18n("Shear Layer"), node, false,
angleX, angleY, shearOrigin);
}
}
void KisImage::shear(double angleX, double angleY)
{
shearImpl(kundo2_i18n("Shear Image"), m_d->rootLayer, true,
angleX, angleY, QPointF());
}
void KisImage::convertImageColorSpace(const KoColorSpace *dstColorSpace,
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::ConversionFlags conversionFlags)
{
if (!dstColorSpace) return;
const KoColorSpace *srcColorSpace = m_d->colorSpace;
undoAdapter()->beginMacro(kundo2_i18n("Convert Image Color Space"));
undoAdapter()->addCommand(new KisImageLockCommand(KisImageWSP(this), true));
undoAdapter()->addCommand(new KisImageSetProjectionColorSpaceCommand(KisImageWSP(this), dstColorSpace));
KisColorSpaceConvertVisitor visitor(this, srcColorSpace, dstColorSpace, renderingIntent, conversionFlags);
m_d->rootLayer->accept(visitor);
undoAdapter()->addCommand(new KisImageLockCommand(KisImageWSP(this), false));
undoAdapter()->endMacro();
setModified();
}
bool KisImage::assignImageProfile(const KoColorProfile *profile)
{
if (!profile) return false;
const KoColorSpace *dstCs = KoColorSpaceRegistry::instance()->colorSpace(colorSpace()->colorModelId().id(), colorSpace()->colorDepthId().id(), profile);
const KoColorSpace *srcCs = colorSpace();
if (!dstCs) return false;
m_d->colorSpace = dstCs;
KisChangeProfileVisitor visitor(srcCs, dstCs);
bool retval = m_d->rootLayer->accept(visitor);
m_d->signalRouter.emitNotification(ProfileChangedSignal);
return retval;
}
void KisImage::convertProjectionColorSpace(const KoColorSpace *dstColorSpace)
{
if (*m_d->colorSpace == *dstColorSpace) return;
undoAdapter()->beginMacro(kundo2_i18n("Convert Projection Color Space"));
undoAdapter()->addCommand(new KisImageLockCommand(KisImageWSP(this), true));
undoAdapter()->addCommand(new KisImageSetProjectionColorSpaceCommand(KisImageWSP(this), dstColorSpace));
undoAdapter()->addCommand(new KisImageLockCommand(KisImageWSP(this), false));
undoAdapter()->endMacro();
setModified();
}
void KisImage::setProjectionColorSpace(const KoColorSpace * colorSpace)
{
m_d->colorSpace = colorSpace;
m_d->rootLayer->resetCache();
m_d->signalRouter.emitNotification(ColorSpaceChangedSignal);
}
const KoColorSpace * KisImage::colorSpace() const
{
return m_d->colorSpace;
}
const KoColorProfile * KisImage::profile() const
{
return colorSpace()->profile();
}
double KisImage::xRes() const
{
return m_d->xres;
}
double KisImage::yRes() const
{
return m_d->yres;
}
void KisImage::setResolution(double xres, double yres)
{
m_d->xres = xres;
m_d->yres = yres;
m_d->signalRouter.emitNotification(ResolutionChangedSignal);
}
QPointF KisImage::documentToPixel(const QPointF &documentCoord) const
{
return QPointF(documentCoord.x() * xRes(), documentCoord.y() * yRes());
}
QPoint KisImage::documentToImagePixelFloored(const QPointF &documentCoord) const
{
QPointF pixelCoord = documentToPixel(documentCoord);
return QPoint(qFloor(pixelCoord.x()), qFloor(pixelCoord.y()));
}
QRectF KisImage::documentToPixel(const QRectF &documentRect) const
{
return QRectF(documentToPixel(documentRect.topLeft()), documentToPixel(documentRect.bottomRight()));
}
QPointF KisImage::pixelToDocument(const QPointF &pixelCoord) const
{
return QPointF(pixelCoord.x() / xRes(), pixelCoord.y() / yRes());
}
QPointF KisImage::pixelToDocument(const QPoint &pixelCoord) const
{
return QPointF((pixelCoord.x() + 0.5) / xRes(), (pixelCoord.y() + 0.5) / yRes());
}
QRectF KisImage::pixelToDocument(const QRectF &pixelCoord) const
{
return QRectF(pixelToDocument(pixelCoord.topLeft()), pixelToDocument(pixelCoord.bottomRight()));
}
qint32 KisImage::width() const
{
return m_d->width;
}
qint32 KisImage::height() const
{
return m_d->height;
}
KisGroupLayerSP KisImage::rootLayer() const
{
Q_ASSERT(m_d->rootLayer);
return m_d->rootLayer;
}
KisPaintDeviceSP KisImage::projection() const
{
if (m_d->isolatedRootNode) {
return m_d->isolatedRootNode->projection();
}
Q_ASSERT(m_d->rootLayer);
KisPaintDeviceSP projection = m_d->rootLayer->projection();
Q_ASSERT(projection);
return projection;
}
qint32 KisImage::nlayers() const
{
QStringList list;
list << "KisLayer";
KisCountVisitor visitor(list, KoProperties());
m_d->rootLayer->accept(visitor);
return visitor.count();
}
qint32 KisImage::nHiddenLayers() const
{
QStringList list;
list << "KisLayer";
KoProperties properties;
properties.setProperty("visible", false);
KisCountVisitor visitor(list, properties);
m_d->rootLayer->accept(visitor);
return visitor.count();
}
void KisImage::flatten()
{
KisLayerUtils::flattenImage(this);
}
void KisImage::mergeMultipleLayers(QList mergedNodes, KisNodeSP putAfter)
{
if (!KisLayerUtils::tryMergeSelectionMasks(this, mergedNodes, putAfter)) {
KisLayerUtils::mergeMultipleLayers(this, mergedNodes, putAfter);
}
}
void KisImage::mergeDown(KisLayerSP layer, const KisMetaData::MergeStrategy* strategy)
{
KisLayerUtils::mergeDown(this, layer, strategy);
}
void KisImage::flattenLayer(KisLayerSP layer)
{
KisLayerUtils::flattenLayer(this, layer);
}
void KisImage::setModified()
{
m_d->signalRouter.emitNotification(ModifiedSignal);
}
QImage KisImage::convertToQImage(QRect imageRect,
const KoColorProfile * profile)
{
qint32 x;
qint32 y;
qint32 w;
qint32 h;
imageRect.getRect(&x, &y, &w, &h);
return convertToQImage(x, y, w, h, profile);
}
QImage KisImage::convertToQImage(qint32 x,
qint32 y,
qint32 w,
qint32 h,
const KoColorProfile * profile)
{
KisPaintDeviceSP dev = projection();
if (!dev) return QImage();
QImage image = dev->convertToQImage(const_cast(profile), x, y, w, h,
KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
return image;
}
QImage KisImage::convertToQImage(const QSize& scaledImageSize, const KoColorProfile *profile)
{
if (scaledImageSize.isEmpty()) {
return QImage();
}
KisPaintDeviceSP dev = new KisPaintDevice(colorSpace());
KisPainter gc;
gc.copyAreaOptimized(QPoint(0, 0), projection(), dev, bounds());
gc.end();
double scaleX = qreal(scaledImageSize.width()) / width();
double scaleY = qreal(scaledImageSize.height()) / height();
QPointer updater = new KoDummyUpdater();
KisTransformWorker worker(dev, scaleX, scaleY, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, updater, KisFilterStrategyRegistry::instance()->value("Bicubic"));
worker.run();
delete updater;
return dev->convertToQImage(profile);
}
void KisImage::notifyLayersChanged()
{
m_d->signalRouter.emitNotification(LayersChangedSignal);
}
QRect KisImage::bounds() const
{
return QRect(0, 0, width(), height());
}
QRect KisImage::effectiveLodBounds() const
{
QRect boundRect = bounds();
const int lod = currentLevelOfDetail();
if (lod > 0) {
KisLodTransform t(lod);
boundRect = t.map(boundRect);
}
return boundRect;
}
KisPostExecutionUndoAdapter* KisImage::postExecutionUndoAdapter() const
{
const int lod = currentLevelOfDetail();
return lod > 0 ?
m_d->scheduler.lodNPostExecutionUndoAdapter() :
&m_d->postExecutionUndoAdapter;
}
void KisImage::setUndoStore(KisUndoStore *undoStore)
{
m_d->legacyUndoAdapter.setUndoStore(undoStore);
m_d->postExecutionUndoAdapter.setUndoStore(undoStore);
m_d->undoStore.reset(undoStore);
}
KisUndoStore* KisImage::undoStore()
{
return m_d->undoStore.data();
}
KisUndoAdapter* KisImage::undoAdapter() const
{
return &m_d->legacyUndoAdapter;
}
-KisActionRecorder* KisImage::actionRecorder() const
-{
- return &m_d->recorder;
-}
-
void KisImage::setDefaultProjectionColor(const KoColor &color)
{
KIS_ASSERT_RECOVER_RETURN(m_d->rootLayer);
m_d->rootLayer->setDefaultProjectionColor(color);
}
KoColor KisImage::defaultProjectionColor() const
{
KIS_ASSERT_RECOVER(m_d->rootLayer) {
return KoColor(Qt::transparent, m_d->colorSpace);
}
return m_d->rootLayer->defaultProjectionColor();
}
void KisImage::setRootLayer(KisGroupLayerSP rootLayer)
{
emit sigInternalStopIsolatedModeRequested();
KoColor defaultProjectionColor(Qt::transparent, m_d->colorSpace);
if (m_d->rootLayer) {
m_d->rootLayer->setGraphListener(0);
m_d->rootLayer->disconnect();
KisPaintDeviceSP original = m_d->rootLayer->original();
defaultProjectionColor = original->defaultPixel();
}
m_d->rootLayer = rootLayer;
m_d->rootLayer->disconnect();
m_d->rootLayer->setGraphListener(this);
m_d->rootLayer->setImage(this);
KisPaintDeviceSP newOriginal = m_d->rootLayer->original();
newOriginal->setDefaultPixel(defaultProjectionColor);
setRoot(m_d->rootLayer.data());
}
void KisImage::addAnnotation(KisAnnotationSP annotation)
{
// Find the icc annotation, if there is one
vKisAnnotationSP_it it = m_d->annotations.begin();
while (it != m_d->annotations.end()) {
if ((*it)->type() == annotation->type()) {
*it = annotation;
return;
}
++it;
}
m_d->annotations.push_back(annotation);
}
KisAnnotationSP KisImage::annotation(const QString& type)
{
vKisAnnotationSP_it it = m_d->annotations.begin();
while (it != m_d->annotations.end()) {
if ((*it)->type() == type) {
return *it;
}
++it;
}
return KisAnnotationSP(0);
}
void KisImage::removeAnnotation(const QString& type)
{
vKisAnnotationSP_it it = m_d->annotations.begin();
while (it != m_d->annotations.end()) {
if ((*it)->type() == type) {
m_d->annotations.erase(it);
return;
}
++it;
}
}
vKisAnnotationSP_it KisImage::beginAnnotations()
{
return m_d->annotations.begin();
}
vKisAnnotationSP_it KisImage::endAnnotations()
{
return m_d->annotations.end();
}
void KisImage::notifyAboutToBeDeleted()
{
emit sigAboutToBeDeleted();
}
KisImageSignalRouter* KisImage::signalRouter()
{
return &m_d->signalRouter;
}
void KisImage::waitForDone()
{
requestStrokeEnd();
m_d->scheduler.waitForDone();
}
KisStrokeId KisImage::startStroke(KisStrokeStrategy *strokeStrategy)
{
/**
* Ask open strokes to end gracefully. All the strokes clients
* (including the one calling this method right now) will get
* a notification that they should probably end their strokes.
* However this is purely their choice whether to end a stroke
* or not.
*/
if (strokeStrategy->requestsOtherStrokesToEnd()) {
requestStrokeEnd();
}
/**
* Some of the strokes can cancel their work with undoing all the
* changes they did to the paint devices. The problem is that undo
* stack will know nothing about it. Therefore, just notify it
* explicitly
*/
if (strokeStrategy->clearsRedoOnStart()) {
m_d->undoStore->purgeRedoState();
}
return m_d->scheduler.startStroke(strokeStrategy);
}
void KisImage::KisImagePrivate::notifyProjectionUpdatedInPatches(const QRect &rc)
{
KisImageConfig imageConfig;
int patchWidth = imageConfig.updatePatchWidth();
int patchHeight = imageConfig.updatePatchHeight();
for (int y = 0; y < rc.height(); y += patchHeight) {
for (int x = 0; x < rc.width(); x += patchWidth) {
QRect patchRect(x, y, patchWidth, patchHeight);
patchRect &= rc;
QtConcurrent::run(std::bind(&KisImage::notifyProjectionUpdated, q, patchRect));
}
}
}
bool KisImage::startIsolatedMode(KisNodeSP node)
{
struct StartIsolatedModeStroke : public KisSimpleStrokeStrategy {
StartIsolatedModeStroke(KisNodeSP node, KisImageSP image)
: KisSimpleStrokeStrategy("start-isolated-mode", kundo2_noi18n("start-isolated-mode")),
m_node(node),
m_image(image)
{
this->enableJob(JOB_INIT, true, KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::EXCLUSIVE);
setClearsRedoOnStart(false);
}
void initStrokeCallback() {
// pass-though node don't have any projection prepared, so we should
// explicitly regenerate it before activating isolated mode.
m_node->projectionLeaf()->explicitlyRegeneratePassThroughProjection();
m_image->m_d->isolatedRootNode = m_node;
emit m_image->sigIsolatedModeChanged();
// the GUI uses our thread to do the color space conversion so we
// need to emit this signal in multiple threads
m_image->m_d->notifyProjectionUpdatedInPatches(m_image->bounds());
m_image->invalidateAllFrames();
}
private:
KisNodeSP m_node;
KisImageSP m_image;
};
KisStrokeId id = startStroke(new StartIsolatedModeStroke(node, this));
endStroke(id);
return true;
}
void KisImage::stopIsolatedMode()
{
if (!m_d->isolatedRootNode) return;
struct StopIsolatedModeStroke : public KisSimpleStrokeStrategy {
StopIsolatedModeStroke(KisImageSP image)
: KisSimpleStrokeStrategy("stop-isolated-mode", kundo2_noi18n("stop-isolated-mode")),
m_image(image)
{
this->enableJob(JOB_INIT);
setClearsRedoOnStart(false);
}
void initStrokeCallback() {
if (!m_image->m_d->isolatedRootNode) return;
//KisNodeSP oldRootNode = m_image->m_d->isolatedRootNode;
m_image->m_d->isolatedRootNode = 0;
emit m_image->sigIsolatedModeChanged();
// the GUI uses our thread to do the color space conversion so we
// need to emit this signal in multiple threads
m_image->m_d->notifyProjectionUpdatedInPatches(m_image->bounds());
m_image->invalidateAllFrames();
// TODO: Substitute notifyProjectionUpdated() with this code
// when update optimization is implemented
//
// QRect updateRect = bounds() | oldRootNode->extent();
// oldRootNode->setDirty(updateRect);
}
private:
KisImageSP m_image;
};
KisStrokeId id = startStroke(new StopIsolatedModeStroke(this));
endStroke(id);
}
KisNodeSP KisImage::isolatedModeRoot() const
{
return m_d->isolatedRootNode;
}
void KisImage::addJob(KisStrokeId id, KisStrokeJobData *data)
{
KisUpdateTimeMonitor::instance()->reportJobStarted(data);
m_d->scheduler.addJob(id, data);
}
void KisImage::endStroke(KisStrokeId id)
{
m_d->scheduler.endStroke(id);
}
bool KisImage::cancelStroke(KisStrokeId id)
{
return m_d->scheduler.cancelStroke(id);
}
bool KisImage::KisImagePrivate::tryCancelCurrentStrokeAsync()
{
return scheduler.tryCancelCurrentStrokeAsync();
}
void KisImage::requestUndoDuringStroke()
{
emit sigUndoDuringStrokeRequested();
}
void KisImage::requestStrokeCancellation()
{
if (!m_d->tryCancelCurrentStrokeAsync()) {
emit sigStrokeCancellationRequested();
}
}
UndoResult KisImage::tryUndoUnfinishedLod0Stroke()
{
return m_d->scheduler.tryUndoLastStrokeAsync();
}
void KisImage::requestStrokeEnd()
{
emit sigStrokeEndRequested();
emit sigStrokeEndRequestedActiveNodeFiltered();
}
void KisImage::requestStrokeEndActiveNode()
{
emit sigStrokeEndRequested();
}
void KisImage::refreshGraph(KisNodeSP root)
{
refreshGraph(root, bounds(), bounds());
}
void KisImage::refreshGraph(KisNodeSP root, const QRect &rc, const QRect &cropRect)
{
if (!root) root = m_d->rootLayer;
m_d->animationInterface->notifyNodeChanged(root.data(), rc, true);
m_d->scheduler.fullRefresh(root, rc, cropRect);
}
void KisImage::initialRefreshGraph()
{
/**
* NOTE: Tricky part. We set crop rect to null, so the clones
* will not rely on precalculated projections of their sources
*/
refreshGraphAsync(0, bounds(), QRect());
waitForDone();
}
void KisImage::refreshGraphAsync(KisNodeSP root)
{
refreshGraphAsync(root, bounds(), bounds());
}
void KisImage::refreshGraphAsync(KisNodeSP root, const QRect &rc)
{
refreshGraphAsync(root, rc, bounds());
}
void KisImage::refreshGraphAsync(KisNodeSP root, const QRect &rc, const QRect &cropRect)
{
if (!root) root = m_d->rootLayer;
m_d->animationInterface->notifyNodeChanged(root.data(), rc, true);
m_d->scheduler.fullRefreshAsync(root, rc, cropRect);
}
void KisImage::requestProjectionUpdateNoFilthy(KisNodeSP pseudoFilthy, const QRect &rc, const QRect &cropRect)
{
KIS_ASSERT_RECOVER_RETURN(pseudoFilthy);
m_d->animationInterface->notifyNodeChanged(pseudoFilthy.data(), rc, false);
m_d->scheduler.updateProjectionNoFilthy(pseudoFilthy, rc, cropRect);
}
void KisImage::addSpontaneousJob(KisSpontaneousJob *spontaneousJob)
{
m_d->scheduler.addSpontaneousJob(spontaneousJob);
}
void KisImage::setProjectionUpdatesFilter(KisProjectionUpdatesFilterSP filter)
{
// update filters are *not* recursive!
KIS_ASSERT_RECOVER_NOOP(!filter || !m_d->projectionUpdatesFilter);
m_d->projectionUpdatesFilter = filter;
}
KisProjectionUpdatesFilterSP KisImage::projectionUpdatesFilter() const
{
return m_d->projectionUpdatesFilter;
}
void KisImage::disableDirtyRequests()
{
setProjectionUpdatesFilter(KisProjectionUpdatesFilterSP(new KisDropAllProjectionUpdatesFilter()));
}
void KisImage::enableDirtyRequests()
{
setProjectionUpdatesFilter(KisProjectionUpdatesFilterSP());
}
void KisImage::disableUIUpdates()
{
m_d->disableUIUpdateSignals.ref();
}
void KisImage::enableUIUpdates()
{
m_d->disableUIUpdateSignals.deref();
}
void KisImage::notifyProjectionUpdated(const QRect &rc)
{
KisUpdateTimeMonitor::instance()->reportUpdateFinished(rc);
if (!m_d->disableUIUpdateSignals) {
int lod = currentLevelOfDetail();
QRect dirtyRect = !lod ? rc : KisLodTransform::upscaledRect(rc, lod);
if (dirtyRect.isEmpty()) return;
emit sigImageUpdated(dirtyRect);
}
}
void KisImage::setWorkingThreadsLimit(int value)
{
m_d->scheduler.setThreadsLimit(value);
}
int KisImage::workingThreadsLimit() const
{
return m_d->scheduler.threadsLimit();
}
void KisImage::notifySelectionChanged()
{
/**
* The selection is calculated asynchromously, so it is not
* handled by disableUIUpdates() and other special signals of
* KisImageSignalRouter
*/
m_d->legacyUndoAdapter.emitSelectionChanged();
/**
* Editing of selection masks doesn't necessary produce a
* setDirty() call, so in the end of the stroke we need to request
* direct update of the UI's cache.
*/
if (m_d->isolatedRootNode &&
dynamic_cast(m_d->isolatedRootNode.data())) {
notifyProjectionUpdated(bounds());
}
}
void KisImage::requestProjectionUpdateImpl(KisNode *node,
const QVector &rects,
const QRect &cropRect)
{
if (rects.isEmpty()) return;
m_d->scheduler.updateProjection(node, rects, cropRect);
}
void KisImage::requestProjectionUpdate(KisNode *node, const QVector &rects, bool resetAnimationCache)
{
if (m_d->projectionUpdatesFilter
&& m_d->projectionUpdatesFilter->filter(this, node, rects, resetAnimationCache)) {
return;
}
if (resetAnimationCache) {
m_d->animationInterface->notifyNodeChanged(node, rects, false);
}
/**
* Here we use 'permitted' instead of 'active' intentively,
* because the updates may come after the actual stroke has been
* finished. And having some more updates for the stroke not
* supporting the wrap-around mode will not make much harm.
*/
if (m_d->wrapAroundModePermitted) {
QVector allSplitRects;
const QRect boundRect = effectiveLodBounds();
Q_FOREACH (const QRect &rc, rects) {
KisWrappedRect splitRect(rc, boundRect);
allSplitRects.append(splitRect);
}
requestProjectionUpdateImpl(node, allSplitRects, boundRect);
} else {
requestProjectionUpdateImpl(node, rects, bounds());
}
KisNodeGraphListener::requestProjectionUpdate(node, rects, resetAnimationCache);
}
void KisImage::invalidateFrames(const KisTimeRange &range, const QRect &rect)
{
m_d->animationInterface->invalidateFrames(range, rect);
}
void KisImage::requestTimeSwitch(int time)
{
m_d->animationInterface->requestTimeSwitchNonGUI(time);
}
QList KisImage::compositions()
{
return m_d->compositions;
}
void KisImage::addComposition(KisLayerCompositionSP composition)
{
m_d->compositions.append(composition);
}
void KisImage::removeComposition(KisLayerCompositionSP composition)
{
m_d->compositions.removeAll(composition);
}
bool checkMasksNeedConversion(KisNodeSP root, const QRect &bounds)
{
KisSelectionMask *mask = dynamic_cast(root.data());
if (mask &&
(!bounds.contains(mask->paintDevice()->exactBounds()) ||
mask->selection()->hasShapeSelection())) {
return true;
}
KisNodeSP node = root->firstChild();
while (node) {
if (checkMasksNeedConversion(node, bounds)) {
return true;
}
node = node->nextSibling();
}
return false;
}
void KisImage::setWrapAroundModePermitted(bool value)
{
if (m_d->wrapAroundModePermitted != value) {
requestStrokeEnd();
}
m_d->wrapAroundModePermitted = value;
if (m_d->wrapAroundModePermitted &&
checkMasksNeedConversion(root(), bounds())) {
KisProcessingApplicator applicator(this, root(),
KisProcessingApplicator::RECURSIVE,
KisImageSignalVector() << ModifiedSignal,
kundo2_i18n("Crop Selections"));
KisProcessingVisitorSP visitor =
new KisCropSelectionsProcessingVisitor(bounds());
applicator.applyVisitor(visitor, KisStrokeJobData::CONCURRENT);
applicator.end();
}
}
bool KisImage::wrapAroundModePermitted() const
{
return m_d->wrapAroundModePermitted;
}
bool KisImage::wrapAroundModeActive() const
{
return m_d->wrapAroundModePermitted &&
m_d->scheduler.wrapAroundModeSupported();
}
void KisImage::setDesiredLevelOfDetail(int lod)
{
if (m_d->blockLevelOfDetail) {
qWarning() << "WARNING: KisImage::setDesiredLevelOfDetail()"
<< "was called while LoD functionality was being blocked!";
return;
}
m_d->scheduler.setDesiredLevelOfDetail(lod);
}
int KisImage::currentLevelOfDetail() const
{
if (m_d->blockLevelOfDetail) {
return 0;
}
return m_d->scheduler.currentLevelOfDetail();
}
void KisImage::setLevelOfDetailBlocked(bool value)
{
KisImageBarrierLockerRaw l(this);
if (value && !m_d->blockLevelOfDetail) {
m_d->scheduler.setDesiredLevelOfDetail(0);
}
m_d->blockLevelOfDetail = value;
}
void KisImage::explicitRegenerateLevelOfDetail()
{
if (!m_d->blockLevelOfDetail) {
m_d->scheduler.explicitRegenerateLevelOfDetail();
}
}
bool KisImage::levelOfDetailBlocked() const
{
return m_d->blockLevelOfDetail;
}
void KisImage::notifyNodeCollpasedChanged()
{
emit sigNodeCollapsedChanged();
}
KisImageAnimationInterface* KisImage::animationInterface() const
{
return m_d->animationInterface;
}
void KisImage::setProofingConfiguration(KisProofingConfigurationSP proofingConfig)
{
m_d->proofingConfig = proofingConfig;
emit sigProofingConfigChanged();
}
KisProofingConfigurationSP KisImage::proofingConfiguration() const
{
if (m_d->proofingConfig) {
return m_d->proofingConfig;
}
return KisProofingConfigurationSP();
}
QPointF KisImage::mirrorAxesCenter() const
{
return m_d->axesCenter;
}
void KisImage::setMirrorAxesCenter(const QPointF &value) const
{
m_d->axesCenter = value;
}
diff --git a/libs/image/kis_image.h b/libs/image/kis_image.h
index 240ffbc2d7..fcea5fd28a 100644
--- a/libs/image/kis_image.h
+++ b/libs/image/kis_image.h
@@ -1,1109 +1,1103 @@
/*
* Copyright (c) 2002 Patrick Julien
* Copyright (c) 2007 Boudewijn Rempt
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_H_
#define KIS_IMAGE_H_
#include
#include
#include
#include
#include
#include
#include
#include "kis_paint_device.h" // msvc cannot handle forward declarations, so include kis_paint_device here
#include "kis_types.h"
#include "kis_shared.h"
#include "kis_node_graph_listener.h"
#include "kis_node_facade.h"
#include "kis_image_interfaces.h"
#include "kis_strokes_queue_undo_result.h"
#include
class KisDocument;
class KoColorSpace;
class KoColor;
class KisCompositeProgressProxy;
-class KisActionRecorder;
class KisUndoStore;
class KisUndoAdapter;
class KisImageSignalRouter;
class KisPostExecutionUndoAdapter;
class KisFilterStrategy;
class KoColorProfile;
class KisLayerComposition;
class KisSpontaneousJob;
class KisImageAnimationInterface;
class KUndo2MagicString;
class KisProofingConfiguration;
namespace KisMetaData
{
class MergeStrategy;
}
/**
* This is the image class, it contains a tree of KisLayer stack and
* meta information about the image. And it also provides some
* functions to manipulate the whole image.
*/
class KRITAIMAGE_EXPORT KisImage : public QObject,
public KisStrokesFacade,
public KisStrokeUndoFacade,
public KisUpdatesFacade,
public KisProjectionUpdateListener,
public KisNodeFacade,
public KisNodeGraphListener,
public KisShared
{
Q_OBJECT
public:
/// @param colorSpace can be null. in that case it will be initialised to a default color space.
KisImage(KisUndoStore *undoStore, qint32 width, qint32 height, const KoColorSpace *colorSpace, const QString& name);
~KisImage() override;
public: // KisNodeGraphListener implementation
void aboutToAddANode(KisNode *parent, int index) override;
void nodeHasBeenAdded(KisNode *parent, int index) override;
void aboutToRemoveANode(KisNode *parent, int index) override;
void nodeChanged(KisNode * node) override;
void invalidateAllFrames() override;
void notifySelectionChanged() override;
void requestProjectionUpdate(KisNode *node, const QVector &rects, bool resetAnimationCache) override;
void invalidateFrames(const KisTimeRange &range, const QRect &rect) override;
void requestTimeSwitch(int time) override;
public: // KisProjectionUpdateListener implementation
void notifyProjectionUpdated(const QRect &rc) override;
public:
/**
* Set the number of threads used by the image's working threads
*/
void setWorkingThreadsLimit(int value);
/**
* Return the number of threads available to the image's working threads
*/
int workingThreadsLimit() const;
/**
* Makes a copy of the image with all the layers. If possible, shallow
* copies of the layers are made.
*
* \p exactCopy shows if the copied image should look *exactly* the same as
* the other one (according to it's .kra xml representation). It means that
* the layers will have the same UUID keys and, therefore, you are not
* expected to use the copied image anywhere except for saving. Don't use
* this option if you plan to work with the copied image later.
*/
KisImage *clone(bool exactCopy = false);
/**
* Render the projection onto a QImage.
*/
QImage convertToQImage(qint32 x1,
qint32 y1,
qint32 width,
qint32 height,
const KoColorProfile * profile);
/**
* Render the projection onto a QImage.
* (this is an overloaded function)
*/
QImage convertToQImage(QRect imageRect,
const KoColorProfile * profile);
/**
* Render a thumbnail of the projection onto a QImage.
*/
QImage convertToQImage(const QSize& scaledImageSize, const KoColorProfile *profile);
/**
* [low-level] Lock the image without waiting for all the internal job queues are processed
*
* WARNING: Don't use it unless you really know what you are doing! Use barrierLock() instead!
*
* Waits for all the **currently running** internal jobs to complete and locks the image
* for writing. Please note that this function does **not** wait for all the internal
* queues to process, so there might be some non-finished actions pending. It means that
* you just postpone these actions until you unlock() the image back. Until then, then image
* might easily be frozen in some inconsistent state.
*
* The only sane usage for this function is to lock the image for **emergency**
* processing, when some internal action or scheduler got hung up, and you just want
* to fetch some data from the image without races.
*
* In all other cases, please use barrierLock() instead!
*/
void lock();
/**
* Unlocks the image and starts/resumes all the pending internal jobs. If the image
* has been locked for a non-readOnly access, then all the internal caches of the image
* (e.g. lod-planes) are reset and regeneration jobs are scheduled.
*/
void unlock();
/**
* @return return true if the image is in a locked state, i.e. all the internal
* jobs are blocked from execution by calling wither lock() or barrierLock().
*
* When the image is locked, the user can do some modifications to the image
* contents safely without a perspective having race conditions with internal
* image jobs.
*/
bool locked() const;
/**
* @return the global selection object or 0 if there is none. The
* global selection is always read-write.
*/
KisSelectionSP globalSelection() const;
/**
* Retrieve the next automatic layername (XXX: fix to add option to return Mask X)
*/
QString nextLayerName(const QString &baseName = "") const;
/**
* Set the automatic layer name counter one back.
*/
void rollBackLayerName();
/**
* @brief start asynchronous operation on resizing the image
*
* The method will resize the image to fit the new size without
* dropping any pixel data. The GUI will get correct
* notification with old and new sizes, so it adjust canvas origin
* accordingly and avoid jumping of the canvas on screen
*
* @param newRect the rectangle of the image which will be visible
* after operation is completed
*
* Please note that the actual operation starts asynchronously in
* a background, so you cannot expect the image having new size
* right after ths call.
*/
void resizeImage(const QRect& newRect);
/**
* @brief start asynchronous operation on cropping the image
*
* The method will **drop** all the image data outside \p newRect
* and resize the image to fit the new size. The GUI will get correct
* notification with old and new sizes, so it adjust canvas origin
* accordingly and avoid jumping of the canvas on screen
*
* @param newRect the rectangle of the image which will be cut-out
*
* Please note that the actual operation starts asynchronously in
* a background, so you cannot expect the image having new size
* right after ths call.
*/
void cropImage(const QRect& newRect);
/**
* @brief start asynchronous operation on cropping a subtree of nodes starting at \p node
*
* The method will **drop** all the layer data outside \p newRect. Neither
* image nor a layer will be moved anywhere
*
* @param newRect the rectangle of the layer which will be cut-out
*
* Please note that the actual operation starts asynchronously in
* a background, so you cannot expect the image having new size
* right after ths call.
*/
void cropNode(KisNodeSP node, const QRect& newRect);
/**
* @brief start asynchronous operation on scaling the image
* @param size new image size in pixels
* @param xres new image x-resolution pixels-per-pt
* @param yres new image y-resolution pixels-per-pt
* @param filterStrategy filtering strategy
*
* Please note that the actual operation starts asynchronously in
* a background, so you cannot expect the image having new size
* right after ths call.
*/
void scaleImage(const QSize &size, qreal xres, qreal yres, KisFilterStrategy *filterStrategy);
/**
* @brief start asynchronous operation on scaling a subtree of nodes starting at \p node
* @param node node to scale
* @param scaleX, @param scaleY scale coefficient to be applied to the node
* @param filterStrategy filtering strategy
*
* Please note that the actual operation starts asynchronously in
* a background, so you cannot expect the image having new size
* right after ths call.
*/
void scaleNode(KisNodeSP node, qreal scaleX, qreal scaleY, KisFilterStrategy *filterStrategy);
/**
* @brief start asynchronous operation on rotating the image
*
* The image is resized to fit the rotated rectangle
*
* @param radians rotation angle in radians
*
* Please note that the actual operation starts asynchronously in
* a background, so you cannot expect the operation being completed
* right after the call
*/
void rotateImage(double radians);
/**
* @brief start asynchronous operation on rotating a subtree of nodes starting at \p node
*
* The image is not resized!
*
* @param node the root of the subtree to rotate
* @param radians rotation angle in radians
*
* Please note that the actual operation starts asynchronously in
* a background, so you cannot expect the operation being completed
* right after the call
*/
void rotateNode(KisNodeSP node, double radians);
/**
* @brief start asynchronous operation on shearing the image
*
* The image is resized to fit the sheared polygon
*
* @param angleX, @param angleY are given in degrees.
*
* Please note that the actual operation starts asynchronously in
* a background, so you cannot expect the operation being completed
* right after the call
*/
void shear(double angleX, double angleY);
/**
* @brief start asynchronous operation on shearing a subtree of nodes starting at \p node
*
* The image is not resized!
*
* @param node the root of the subtree to rotate
* @param angleX, @param angleY are given in degrees.
*
* Please note that the actual operation starts asynchronously in
* a background, so you cannot expect the operation being completed
* right after the call
*/
void shearNode(KisNodeSP node, double angleX, double angleY);
/**
* Convert the image and all its layers to the dstColorSpace
*/
void convertImageColorSpace(const KoColorSpace *dstColorSpace,
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::ConversionFlags conversionFlags);
/**
* Set the color space of the projection (and the root layer)
* to dstColorSpace. No conversion is done for other layers,
* their colorspace can differ.
* NOTE: Note conversion is done, only regeneration, so no rendering
* intent needed
*/
void convertProjectionColorSpace(const KoColorSpace *dstColorSpace);
// Get the profile associated with this image
const KoColorProfile * profile() const;
/**
* Set the profile of the image to the new profile and do the same for
* all layers that have the same colorspace and profile of the image.
* It doesn't do any pixel conversion.
*
* This is essential if you have loaded an image that didn't
* have an embedded profile to which you want to attach the right profile.
*
* This does not create an undo action; only call it when creating or
* loading an image.
*
* @returns false if the profile could not be assigned
*/
bool assignImageProfile(const KoColorProfile *profile);
/**
* Returns the current undo adapter. You can add new commands to the
* undo stack using the adapter. This adapter is used for a backward
* compatibility for old commands created before strokes. It blocks
* all the porcessing at the scheduler, waits until it's finished
* and executes commands exclusively.
*/
KisUndoAdapter* undoAdapter() const;
/**
* This adapter is used by the strokes system. The commands are added
* to it *after* redo() is done (in the scheduler context). They are
* wrapped into a special command and added to the undo stack. redo()
* in not called.
*/
KisPostExecutionUndoAdapter* postExecutionUndoAdapter() const override;
/**
* Replace current undo store with the new one. The old store
* will be deleted.
* This method is used by KisDocument for dropping all the commands
* during file loading.
*/
void setUndoStore(KisUndoStore *undoStore);
/**
* Return current undo store of the image
*/
KisUndoStore* undoStore();
- /**
- * @return the action recorder associated with this image
- */
- KisActionRecorder* actionRecorder() const;
-
/**
* Tell the image it's modified; this emits the sigImageModified
* signal. This happens when the image needs to be saved
*/
void setModified();
/**
* The default colorspace of this image: new layers will have this
* colorspace and the projection will have this colorspace.
*/
const KoColorSpace * colorSpace() const;
/**
* X resolution in pixels per pt
*/
double xRes() const;
/**
* Y resolution in pixels per pt
*/
double yRes() const;
/**
* Set the resolution in pixels per pt.
*/
void setResolution(double xres, double yres);
/**
* Convert a document coordinate to a pixel coordinate.
*
* @param documentCoord PostScript Pt coordinate to convert.
*/
QPointF documentToPixel(const QPointF &documentCoord) const;
/**
* Convert a document coordinate to an integer pixel coordinate rounded down.
*
* @param documentCoord PostScript Pt coordinate to convert.
*/
QPoint documentToImagePixelFloored(const QPointF &documentCoord) const;
/**
* Convert a document rectangle to a pixel rectangle.
*
* @param documentRect PostScript Pt rectangle to convert.
*/
QRectF documentToPixel(const QRectF &documentRect) const;
/**
* Convert a pixel coordinate to a document coordinate.
*
* @param pixelCoord pixel coordinate to convert.
*/
QPointF pixelToDocument(const QPointF &pixelCoord) const;
/**
* Convert an integer pixel coordinate to a document coordinate.
* The document coordinate is at the centre of the pixel.
*
* @param pixelCoord pixel coordinate to convert.
*/
QPointF pixelToDocument(const QPoint &pixelCoord) const;
/**
* Convert a document rectangle to an integer pixel rectangle.
*
* @param pixelCoord pixel coordinate to convert.
*/
QRectF pixelToDocument(const QRectF &pixelCoord) const;
/**
* Return the width of the image
*/
qint32 width() const;
/**
* Return the height of the image
*/
qint32 height() const;
/**
* Return the size of the image
*/
QSize size() const {
return QSize(width(), height());
}
/**
* @return the root node of the image node graph
*/
KisGroupLayerSP rootLayer() const;
/**
* Return the projection; that is, the complete, composited
* representation of this image.
*/
KisPaintDeviceSP projection() const;
/**
* Return the number of layers (not other nodes) that are in this
* image.
*/
qint32 nlayers() const;
/**
* Return the number of layers (not other node types) that are in
* this image and that are hidden.
*/
qint32 nHiddenLayers() const;
/**
* Merge all visible layers and discard hidden ones.
*/
void flatten();
/**
* Merge the specified layer with the layer
* below this layer, remove the specified layer.
*/
void mergeDown(KisLayerSP l, const KisMetaData::MergeStrategy* strategy);
/**
* flatten the layer: that is, the projection becomes the layer
* and all subnodes are removed. If this is not a paint layer, it will morph
* into a paint layer.
*/
void flattenLayer(KisLayerSP layer);
/**
* Merges layers in \p mergedLayers and creates a new layer above
* \p putAfter
*/
void mergeMultipleLayers(QList mergedLayers, KisNodeSP putAfter);
/// @return the exact bounds of the image in pixel coordinates.
QRect bounds() const;
/**
* Returns the actual bounds of the image, taking LevelOfDetail
* into account. This value is used as a bounds() value of
* KisDefaultBounds object.
*/
QRect effectiveLodBounds() const;
/// use if the layers have changed _completely_ (eg. when flattening)
void notifyLayersChanged();
/**
* Sets the default color of the root layer projection. All the layers
* will be merged on top of this very color
*/
void setDefaultProjectionColor(const KoColor &color);
/**
* \see setDefaultProjectionColor()
*/
KoColor defaultProjectionColor() const;
void setRootLayer(KisGroupLayerSP rootLayer);
/**
* Add an annotation for this image. This can be anything: Gamma, EXIF, etc.
* Note that the "icc" annotation is reserved for the color strategies.
* If the annotation already exists, overwrite it with this one.
*/
void addAnnotation(KisAnnotationSP annotation);
/** get the annotation with the given type, can return 0 */
KisAnnotationSP annotation(const QString& type);
/** delete the annotation, if the image contains it */
void removeAnnotation(const QString& type);
/**
* Start of an iteration over the annotations of this image (including the ICC Profile)
*/
vKisAnnotationSP_it beginAnnotations();
/** end of an iteration over the annotations of this image */
vKisAnnotationSP_it endAnnotations();
/**
* Called before the image is delted and sends the sigAboutToBeDeleted signal
*/
void notifyAboutToBeDeleted();
KisImageSignalRouter* signalRouter();
/**
* Returns whether we can reselect current global selection
*
* \see reselectGlobalSelection()
*/
bool canReselectGlobalSelection();
/**
* Returns the layer compositions for the image
*/
QList compositions();
/**
* Adds a new layer composition, will be saved with the image
*/
void addComposition(KisLayerCompositionSP composition);
/**
* Remove the layer compostion
*/
void removeComposition(KisLayerCompositionSP composition);
/**
* Permit or deny the wrap-around mode for all the paint devices
* of the image. Note that permitting the wraparound mode will not
* necessarily activate it right now. To be activated the wrap
* around mode should be 1) permitted; 2) supported by the
* currently running stroke.
*/
void setWrapAroundModePermitted(bool value);
/**
* \return whether the wrap-around mode is permitted for this
* image. If the wrap around mode is permitted and the
* currently running stroke supports it, the mode will be
* activated for all paint devices of the image.
*
* \see setWrapAroundMode
*/
bool wrapAroundModePermitted() const;
/**
* \return whether the wraparound mode is activated for all the
* devices of the image. The mode is activated when both
* factors are true: the user permitted it and the stroke
* supports it
*/
bool wrapAroundModeActive() const;
/**
* \return current level of detail which is used when processing the image.
* Current working zoom = 2 ^ (- currentLevelOfDetail()). Default value is
* null, which means we work on the original image.
*/
int currentLevelOfDetail() const;
/**
* Notify KisImage which level of detail should be used in the
* lod-mode. Setting the mode does not guarantee the LOD to be
* used. It will be activated only when the stokes supports it.
*/
void setDesiredLevelOfDetail(int lod);
/**
* Relative position of the mirror axis center
* 0,0 - topleft corner of the image
* 1,1 - bottomright corner of the image
*/
QPointF mirrorAxesCenter() const;
/**
* Sets the relative position of the axes center
* \see mirrorAxesCenter() for details
*/
void setMirrorAxesCenter(const QPointF &value) const;
public Q_SLOTS:
/**
* Explicitly start regeneration of LoD planes of all the devices
* in the image. This call should be performed when the user is idle,
* just to make the quality of image updates better.
*/
void explicitRegenerateLevelOfDetail();
public:
/**
* Blocks usage of level of detail functionality. After this method
* has been called, no new strokes will use LoD.
*/
void setLevelOfDetailBlocked(bool value);
/**
* \see setLevelOfDetailBlocked()
*/
bool levelOfDetailBlocked() const;
/**
* Notifies that the node collapsed state has changed
*/
void notifyNodeCollpasedChanged();
KisImageAnimationInterface *animationInterface() const;
/**
* @brief setProofingConfiguration, this sets the image's proofing configuration, and signals
* the proofingConfiguration has changed.
* @param proofingConfig - the kis proofing config that will be used instead.
*/
void setProofingConfiguration(KisProofingConfigurationSP proofingConfig);
/**
* @brief proofingConfiguration
* @return the proofing configuration of the image.
*/
KisProofingConfigurationSP proofingConfiguration() const;
public Q_SLOTS:
bool startIsolatedMode(KisNodeSP node);
void stopIsolatedMode();
public:
KisNodeSP isolatedModeRoot() const;
Q_SIGNALS:
/**
* Emitted whenever an action has caused the image to be
* recomposited.
*
* @param rc The rect that has been recomposited.
*/
void sigImageUpdated(const QRect &);
/**
Emitted whenever the image has been modified, so that it
doesn't match with the version saved on disk.
*/
void sigImageModified();
/**
* The signal is emitted when the size of the image is changed.
* \p oldStillPoint and \p newStillPoint give the receiver the
* hint about how the new and old rect of the image correspond to
* each other. They specify the point of the image around which
* the conversion was done. This point will stay still on the
* user's screen. That is the \p newStillPoint of the new image
* will be painted at the same screen position, where \p
* oldStillPoint of the old image was painted.
*
* \param oldStillPoint is a still point represented in *old*
* image coordinates
*
* \param newStillPoint is a still point represented in *new*
* image coordinates
*/
void sigSizeChanged(const QPointF &oldStillPoint, const QPointF &newStillPoint);
void sigProfileChanged(const KoColorProfile * profile);
void sigColorSpaceChanged(const KoColorSpace* cs);
void sigResolutionChanged(double xRes, double yRes);
void sigRequestNodeReselection(KisNodeSP activeNode, const KisNodeList &selectedNodes);
/**
* Inform the model that a node was changed
*/
void sigNodeChanged(KisNodeSP node);
/**
* Inform that the image is going to be deleted
*/
void sigAboutToBeDeleted();
/**
* The signal is emitted right after a node has been connected
* to the graph of the nodes.
*
* WARNING: you must not request any graph-related information
* about the node being run in a not-scheduler thread. If you need
* information about the parent/siblings of the node connect
* with Qt::DirectConnection, get needed information and then
* emit another Qt::AutoConnection signal to pass this information
* to your thread. See details of the implementation
* in KisDummiesfacadeBase.
*/
void sigNodeAddedAsync(KisNodeSP node);
/**
* This signal is emitted right before a node is going to removed
* from the graph of the nodes.
*
* WARNING: you must not request any graph-related information
* about the node being run in a not-scheduler thread.
*
* \see comment in sigNodeAddedAsync()
*/
void sigRemoveNodeAsync(KisNodeSP node);
/**
* Emitted when the root node of the image has changed.
* It happens, e.g. when we flatten the image. When
* this happens the receiver should reload information
* about the image
*/
void sigLayersChangedAsync();
/**
* Emitted when the UI has requested the undo of the last stroke's
* operation. The point is, we cannot deal with the internals of
* the stroke without its creator knowing about it (which most
* probably cause a crash), so we just forward this request from
* the UI to the creator of the stroke.
*
* If your tool supports undoing part of its work, just listen to
* this signal and undo when it comes
*/
void sigUndoDuringStrokeRequested();
/**
* Emitted when the UI has requested the cancellation of
* the stroke. The point is, we cannot cancel the stroke
* without its creator knowing about it (which most probably
* cause a crash), so we just forward this request from the UI
* to the creator of the stroke.
*
* If your tool supports cancelling of its work in the middle
* of operation, just listen to this signal and cancel
* the stroke when it comes
*/
void sigStrokeCancellationRequested();
/**
* Emitted when the image decides that the stroke should better
* be ended. The point is, we cannot just end the stroke
* without its creator knowing about it (which most probably
* cause a crash), so we just forward this request from the UI
* to the creator of the stroke.
*
* If your tool supports long strokes that may involve multiple
* mouse actions in one stroke, just listen to this signal and
* end the stroke when it comes.
*/
void sigStrokeEndRequested();
/**
* Same as sigStrokeEndRequested() but is not emitted when the active node
* is changed.
*/
void sigStrokeEndRequestedActiveNodeFiltered();
/**
* Emitted when the isolated mode status has changed.
*
* Can be used by the receivers to catch a fact of forcefully
* stopping the isolated mode by the image when some complex
* action was requested
*/
void sigIsolatedModeChanged();
/**
* Emitted when one or more nodes changed the collapsed state
*
*/
void sigNodeCollapsedChanged();
/**
* Emitted when the proofing configuration of the image is being changed.
*
*/
void sigProofingConfigChanged();
/**
* Internal signal for asynchronously requesting isolated mode to stop. Don't use it
* outside KisImage, use sigIsolatedModeChanged() instead.
*/
void sigInternalStopIsolatedModeRequested();
public Q_SLOTS:
KisCompositeProgressProxy* compositeProgressProxy();
bool isIdle(bool allowLocked = false);
/**
* @brief Wait until all the queued background jobs are completed and lock the image.
*
* KisImage object has a local scheduler that executes long-running image
* rendering/modifying jobs (we call them "strokes") in a background. Basically,
* one should either access the image from the scope of such jobs (strokes) or
* just lock the image before using.
*
* Calling barrierLock() will wait until all the queued operations are finished
* and lock the image, so you can start accessing it in a safe way.
*
* @p readOnly tells the image if the caller is going to modify the image during
* holding the lock. Locking with non-readOnly access will reset all
* the internal caches of the image (lod-planes) when the lock status
* will be lifted.
*/
void barrierLock(bool readOnly = false);
/**
* @brief Tries to lock the image without waiting for the jobs to finish
*
* Same as barrierLock(), but doesn't block execution of the calling thread
* until all the background jobs are finished. Instead, in case of presence of
* unfinished jobs in the queue, it just returns false
*
* @return whether the lock has been acquired
* @see barrierLock
*/
bool tryBarrierLock(bool readOnly = false);
/**
* Wait for all the internal image jobs to complete and return without locking
* the image. This function is handly for tests or other synchronous actions,
* when one needs to wait for the result of his actions.
*/
void waitForDone();
KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy) override;
void addJob(KisStrokeId id, KisStrokeJobData *data) override;
void endStroke(KisStrokeId id) override;
bool cancelStroke(KisStrokeId id) override;
/**
* @brief blockUpdates block updating the image projection
*/
void blockUpdates() override;
/**
* @brief unblockUpdates unblock updating the image project. This
* only restarts the scheduler and does not schedule a full refresh.
*/
void unblockUpdates() override;
/**
* Disables notification of the UI about the changes in the image.
* This feature is used by KisProcessingApplicator. It is needed
* when we change the size of the image. In this case, the whole
* image will be reloaded into UI by sigSizeChanged(), so there is
* no need to inform the UI about individual dirty rects.
*/
void disableUIUpdates() override;
/**
* \see disableUIUpdates
*/
void enableUIUpdates() override;
/**
* Disables the processing of all the setDirty() requests that
* come to the image. The incoming requests are effectively
* *dropped*.
*
* This feature is used by KisProcessingApplicator. For many cases
* it provides its own updates interface, which recalculates the
* whole subtree of nodes. But while we change any particular
* node, it can ask for an update itself. This method is a way of
* blocking such intermediate (and excessive) requests.
*
* NOTE: this is a convenience function for setProjectionUpdatesFilter()
* that installs a predefined filter that eats everything. Please
* note that these calls are *not* recursive
*/
void disableDirtyRequests() override;
/**
* \see disableDirtyRequests()
*/
void enableDirtyRequests() override;
/**
* Installs a filter object that will filter all the incoming projection update
* requests. If the filter return true, the incoming update is dropped.
*
* NOTE: you cannot set filters recursively!
*/
void setProjectionUpdatesFilter(KisProjectionUpdatesFilterSP filter) override;
/**
* \see setProjectionUpdatesFilter()
*/
KisProjectionUpdatesFilterSP projectionUpdatesFilter() const override;
void refreshGraphAsync(KisNodeSP root = KisNodeSP()) override;
void refreshGraphAsync(KisNodeSP root, const QRect &rc) override;
void refreshGraphAsync(KisNodeSP root, const QRect &rc, const QRect &cropRect) override;
/**
* Triggers synchronous recomposition of the projection
*/
void refreshGraph(KisNodeSP root = KisNodeSP());
void refreshGraph(KisNodeSP root, const QRect& rc, const QRect &cropRect);
void initialRefreshGraph();
/**
* Initiate a stack regeneration skipping the recalculation of the
* filthy node's projection.
*
* Works exactly as pseudoFilthy->setDirty() with the only
* exception that pseudoFilthy::updateProjection() will not be
* called. That is used by KisRecalculateTransformMaskJob to avoid
* cyclic dependencies.
*/
void requestProjectionUpdateNoFilthy(KisNodeSP pseudoFilthy, const QRect &rc, const QRect &cropRect);
/**
* Adds a spontaneous job to the updates queue.
*
* A spontaneous job may do some trivial tasks in the background,
* like updating the outline of selection or purging unused tiles
* from the existing paint devices.
*/
void addSpontaneousJob(KisSpontaneousJob *spontaneousJob);
/**
* This method is called by the UI (*not* by the creator of the
* stroke) when it thinks the current stroke should undo its last
* action, for example, when the user presses Ctrl+Z while some
* stroke is active.
*
* If the creator of the stroke supports undoing of intermediate
* actions, it will be notified about this request and can undo
* its last action.
*/
void requestUndoDuringStroke();
/**
* This method is called by the UI (*not* by the creator of the
* stroke) when it thinks current stroke should be cancelled. If
* there is a running stroke that has already been detached from
* its creator (ended or cancelled), it will be forcefully
* cancelled and reverted. If there is an open stroke present, and
* if its creator supports cancelling, it will be notified about
* the request and the stroke will be cancelled
*/
void requestStrokeCancellation();
/**
* This method requests the last stroke executed on the image to become undone.
* If the stroke is not ended, or if all the Lod0 strokes are completed, the method
* returns UNDO_FAIL. If the last Lod0 is going to be finished soon, then UNDO_WAIT
* is returned and the caller should just wait for its completion and call global undo
* instead. UNDO_OK means one unfinished stroke has been undone.
*/
UndoResult tryUndoUnfinishedLod0Stroke();
/**
* This method is called when image or some other part of Krita
* (*not* the creator of the stroke) decides that the stroke
* should be ended. If the creator of the stroke supports it, it
* will be notified and the stroke will be cancelled
*/
void requestStrokeEnd();
/**
* Same as requestStrokeEnd() but is called by view manager when
* the current node is changed. Use to dintinguish
* sigStrokeEndRequested() and
* sigStrokeEndRequestedActiveNodeFiltered() which are used by
* KisNodeJugglerCompressed
*/
void requestStrokeEndActiveNode();
private:
KisImage(const KisImage& rhs, KisUndoStore *undoStore, bool exactCopy);
KisImage& operator=(const KisImage& rhs);
void emitSizeChanged();
void resizeImageImpl(const QRect& newRect, bool cropLayers);
void rotateImpl(const KUndo2MagicString &actionName, KisNodeSP rootNode,
bool resizeImage, double radians);
void shearImpl(const KUndo2MagicString &actionName, KisNodeSP rootNode,
bool resizeImage, double angleX, double angleY,
const QPointF &origin);
void safeRemoveTwoNodes(KisNodeSP node1, KisNodeSP node2);
void refreshHiddenArea(KisNodeSP rootNode, const QRect &preparedArea);
void requestProjectionUpdateImpl(KisNode *node,
const QVector &rects,
const QRect &cropRect);
friend class KisImageResizeCommand;
void setSize(const QSize& size);
friend class KisImageSetProjectionColorSpaceCommand;
void setProjectionColorSpace(const KoColorSpace * colorSpace);
friend class KisDeselectGlobalSelectionCommand;
friend class KisReselectGlobalSelectionCommand;
friend class KisSetGlobalSelectionCommand;
friend class KisImageTest;
friend class Document; // For libkis
/**
* Replaces the current global selection with globalSelection. If
* \p globalSelection is empty, removes the selection object, so that
* \ref globalSelection() will return 0 after that.
*/
void setGlobalSelection(KisSelectionSP globalSelection);
/**
* Deselects current global selection.
* \ref globalSelection() will return 0 after that.
*/
void deselectGlobalSelection();
/**
* Reselects current deselected selection
*
* \see deselectGlobalSelection()
*/
void reselectGlobalSelection();
private:
class KisImagePrivate;
KisImagePrivate * m_d;
};
#endif // KIS_IMAGE_H_
diff --git a/libs/image/kis_image_animation_interface.cpp b/libs/image/kis_image_animation_interface.cpp
index d2ab2857b2..cd97f3dbdf 100644
--- a/libs/image/kis_image_animation_interface.cpp
+++ b/libs/image/kis_image_animation_interface.cpp
@@ -1,431 +1,426 @@
/*
* Copyright (c) 2015 Dmitry Kazakov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_image_animation_interface.h"
#include
#include "kis_global.h"
#include "kis_image.h"
#include "kis_regenerate_frame_stroke_strategy.h"
#include "kis_switch_time_stroke_strategy.h"
#include "kis_keyframe_channel.h"
#include "kis_time_range.h"
#include "kis_post_execution_undo_adapter.h"
#include "commands_new/kis_switch_current_time_command.h"
#include "kis_layer_utils.h"
struct KisImageAnimationInterface::Private
{
Private()
: image(0),
externalFrameActive(false),
frameInvalidationBlocked(false),
cachedLastFrameValue(-1),
audioChannelMuted(false),
audioChannelVolume(0.5),
m_currentTime(0),
m_currentUITime(0)
{
}
Private(const Private &rhs, KisImage *newImage)
: image(newImage),
externalFrameActive(false),
frameInvalidationBlocked(false),
fullClipRange(rhs.fullClipRange),
playbackRange(rhs.playbackRange),
framerate(rhs.framerate),
cachedLastFrameValue(-1),
audioChannelFileName(rhs.audioChannelFileName),
audioChannelMuted(rhs.audioChannelMuted),
audioChannelVolume(rhs.audioChannelVolume),
m_currentTime(rhs.m_currentTime),
m_currentUITime(rhs.m_currentUITime)
{
}
KisImage *image;
bool externalFrameActive;
bool frameInvalidationBlocked;
KisTimeRange fullClipRange;
KisTimeRange playbackRange;
int framerate;
int cachedLastFrameValue;
QString audioChannelFileName;
bool audioChannelMuted;
qreal audioChannelVolume;
KisSwitchTimeStrokeStrategy::SharedTokenWSP switchToken;
inline int currentTime() const {
return m_currentTime;
}
inline int currentUITime() const {
return m_currentUITime;
}
inline void setCurrentTime(int value) {
m_currentTime = value;
}
inline void setCurrentUITime(int value) {
m_currentUITime = value;
}
private:
int m_currentTime;
int m_currentUITime;
};
KisImageAnimationInterface::KisImageAnimationInterface(KisImage *image)
: QObject(image),
m_d(new Private)
{
m_d->image = image;
m_d->framerate = 24;
m_d->fullClipRange = KisTimeRange::fromTime(0, 100);
connect(this, SIGNAL(sigInternalRequestTimeSwitch(int, bool)), SLOT(switchCurrentTimeAsync(int, bool)));
}
KisImageAnimationInterface::KisImageAnimationInterface(const KisImageAnimationInterface &rhs, KisImage *newImage)
: m_d(new Private(*rhs.m_d, newImage))
{
connect(this, SIGNAL(sigInternalRequestTimeSwitch(int, bool)), SLOT(switchCurrentTimeAsync(int, bool)));
}
KisImageAnimationInterface::~KisImageAnimationInterface()
{
}
bool KisImageAnimationInterface::hasAnimation() const
{
bool hasAnimation = false;
KisLayerUtils::recursiveApplyNodes(
m_d->image->root(),
[&hasAnimation](KisNodeSP node) {
hasAnimation |= node->isAnimated();
});
return hasAnimation;
}
int KisImageAnimationInterface::currentTime() const
{
return m_d->currentTime();
}
int KisImageAnimationInterface::currentUITime() const
{
return m_d->currentUITime();
}
const KisTimeRange& KisImageAnimationInterface::fullClipRange() const
{
return m_d->fullClipRange;
}
void KisImageAnimationInterface::setFullClipRange(const KisTimeRange range)
{
KIS_SAFE_ASSERT_RECOVER_RETURN(!range.isInfinite());
m_d->fullClipRange = range;
emit sigFullClipRangeChanged();
}
void KisImageAnimationInterface::setFullClipRangeStartTime(int column)
{
KisTimeRange newRange(column, m_d->fullClipRange.end(), false);
setFullClipRange(newRange);
}
void KisImageAnimationInterface::setFullClipRangeEndTime(int column)
{
KisTimeRange newRange(m_d->fullClipRange.start(), column, false);
setFullClipRange(newRange);
}
const KisTimeRange& KisImageAnimationInterface::playbackRange() const
{
return m_d->playbackRange.isValid() ? m_d->playbackRange : m_d->fullClipRange;
}
void KisImageAnimationInterface::setPlaybackRange(const KisTimeRange range)
{
KIS_SAFE_ASSERT_RECOVER_RETURN(!range.isInfinite());
m_d->playbackRange = range;
emit sigPlaybackRangeChanged();
}
int KisImageAnimationInterface::framerate() const
{
return m_d->framerate;
}
QString KisImageAnimationInterface::audioChannelFileName() const
{
return m_d->audioChannelFileName;
}
void KisImageAnimationInterface::setAudioChannelFileName(const QString &fileName)
{
QFileInfo info(fileName);
KIS_SAFE_ASSERT_RECOVER_NOOP(fileName.isEmpty() || info.isAbsolute());
m_d->audioChannelFileName = fileName.isEmpty() ? fileName : info.absoluteFilePath();
emit sigAudioChannelChanged();
}
bool KisImageAnimationInterface::isAudioMuted() const
{
return m_d->audioChannelMuted;
}
void KisImageAnimationInterface::setAudioMuted(bool value)
{
m_d->audioChannelMuted = value;
emit sigAudioChannelChanged();
}
qreal KisImageAnimationInterface::audioVolume() const
{
return m_d->audioChannelVolume;
}
void KisImageAnimationInterface::setAudioVolume(qreal value)
{
m_d->audioChannelVolume = value;
emit sigAudioVolumeChanged();
}
void KisImageAnimationInterface::setFramerate(int fps)
{
m_d->framerate = fps;
emit sigFramerateChanged();
}
KisImageWSP KisImageAnimationInterface::image() const
{
return m_d->image;
}
bool KisImageAnimationInterface::externalFrameActive() const
{
return m_d->externalFrameActive;
}
void KisImageAnimationInterface::requestTimeSwitchWithUndo(int time)
{
if (currentUITime() == time) return;
requestTimeSwitchNonGUI(time, true);
}
void KisImageAnimationInterface::setDefaultProjectionColor(const KoColor &color)
{
int savedTime = 0;
saveAndResetCurrentTime(currentTime(), &savedTime);
m_d->image->setDefaultProjectionColor(color);
restoreCurrentTime(&savedTime);
}
void KisImageAnimationInterface::requestTimeSwitchNonGUI(int time, bool useUndo)
{
emit sigInternalRequestTimeSwitch(time, useUndo);
}
void KisImageAnimationInterface::explicitlySetCurrentTime(int frameId)
{
m_d->setCurrentTime(frameId);
}
void KisImageAnimationInterface::switchCurrentTimeAsync(int frameId, bool useUndo)
{
if (currentUITime() == frameId) return;
KisTimeRange range = KisTimeRange::infinite(0);
KisTimeRange::calculateTimeRangeRecursive(m_d->image->root(), currentUITime(), range, true);
const bool needsRegeneration = !range.contains(frameId);
KisSwitchTimeStrokeStrategy::SharedTokenSP token =
m_d->switchToken.toStrongRef();
if (!token || !token->tryResetDestinationTime(frameId, needsRegeneration)) {
{
KisPostExecutionUndoAdapter *undoAdapter = useUndo ?
m_d->image->postExecutionUndoAdapter() : 0;
KisSwitchTimeStrokeStrategy *strategy =
new KisSwitchTimeStrokeStrategy(frameId, needsRegeneration,
this, undoAdapter);
m_d->switchToken = strategy->token();
KisStrokeId stroke = m_d->image->startStroke(strategy);
m_d->image->endStroke(stroke);
}
if (needsRegeneration) {
KisStrokeStrategy *strategy =
new KisRegenerateFrameStrokeStrategy(this);
KisStrokeId strokeId = m_d->image->startStroke(strategy);
m_d->image->endStroke(strokeId);
}
}
m_d->setCurrentUITime(frameId);
emit sigUiTimeChanged(frameId);
}
void KisImageAnimationInterface::requestFrameRegeneration(int frameId, const QRegion &dirtyRegion)
{
KisStrokeStrategy *strategy =
new KisRegenerateFrameStrokeStrategy(frameId,
dirtyRegion,
this);
QList jobs = KisRegenerateFrameStrokeStrategy::createJobsData(m_d->image);
KisStrokeId stroke = m_d->image->startStroke(strategy);
Q_FOREACH (KisStrokeJobData* job, jobs) {
m_d->image->addJob(stroke, job);
}
m_d->image->endStroke(stroke);
}
void KisImageAnimationInterface::saveAndResetCurrentTime(int frameId, int *savedValue)
{
m_d->externalFrameActive = true;
*savedValue = m_d->currentTime();
m_d->setCurrentTime(frameId);
}
void KisImageAnimationInterface::restoreCurrentTime(int *savedValue)
{
m_d->setCurrentTime(*savedValue);
m_d->externalFrameActive = false;
}
void KisImageAnimationInterface::notifyFrameReady()
{
emit sigFrameReady(m_d->currentTime());
}
void KisImageAnimationInterface::notifyFrameCancelled()
{
emit sigFrameCancelled();
}
KisUpdatesFacade* KisImageAnimationInterface::updatesFacade() const
{
return m_d->image;
}
void KisImageAnimationInterface::notifyNodeChanged(const KisNode *node,
const QRect &rect,
bool recursive)
{
notifyNodeChanged(node, QVector({rect}), recursive);
}
void KisImageAnimationInterface::notifyNodeChanged(const KisNode *node,
const QVector &rects,
bool recursive)
{
if (externalFrameActive() || m_d->frameInvalidationBlocked) return;
if (node->inherits("KisSelectionMask")) return;
- KisKeyframeChannel *channel =
- node->getKeyframeChannel(KisKeyframeChannel::Content.id());
+ const int currentTime = m_d->currentTime();
KisTimeRange invalidateRange;
if (recursive) {
- KisTimeRange::calculateTimeRangeRecursive(node, currentTime(), invalidateRange, false);
- } else if (channel) {
- const int currentTime = m_d->currentTime();
- invalidateRange = channel->affectedFrames(currentTime);
+ KisTimeRange::calculateTimeRangeRecursive(node, currentTime, invalidateRange, false);
} else {
- invalidateRange = KisTimeRange::infinite(0);
+ invalidateRange = KisTimeRange::calculateNodeAffectedFrames(node, currentTime);
}
-
// we compress the updated rect (atm, no one uses it anyway)
QRect unitedRect;
Q_FOREACH (const QRect &rc, rects) {
unitedRect |= rc;
}
invalidateFrames(invalidateRange, unitedRect);
}
void KisImageAnimationInterface::invalidateFrames(const KisTimeRange &range, const QRect &rect)
{
m_d->cachedLastFrameValue = -1;
emit sigFramesChanged(range, rect);
}
void KisImageAnimationInterface::blockFrameInvalidation(bool value)
{
m_d->frameInvalidationBlocked = value;
}
int findLastKeyframeTimeRecursive(KisNodeSP node)
{
int time = 0;
KisKeyframeChannel *channel;
Q_FOREACH (channel, node->keyframeChannels()) {
KisKeyframeSP keyframe = channel->lastKeyframe();
if (keyframe) {
time = std::max(time, keyframe->time());
}
}
KisNodeSP child = node->firstChild();
while (child) {
time = std::max(time, findLastKeyframeTimeRecursive(child));
child = child->nextSibling();
}
return time;
}
int KisImageAnimationInterface::totalLength()
{
if (m_d->cachedLastFrameValue < 0) {
m_d->cachedLastFrameValue = findLastKeyframeTimeRecursive(m_d->image->root());
}
int lastKey = m_d->cachedLastFrameValue;
lastKey = std::max(lastKey, m_d->fullClipRange.end());
lastKey = std::max(lastKey, m_d->currentUITime());
return lastKey + 1;
}
diff --git a/libs/image/recorder/kis_node_query_path.cc b/libs/image/kis_node_query_path.cc
similarity index 100%
rename from libs/image/recorder/kis_node_query_path.cc
rename to libs/image/kis_node_query_path.cc
diff --git a/libs/image/recorder/kis_node_query_path.h b/libs/image/kis_node_query_path.h
similarity index 100%
rename from libs/image/recorder/kis_node_query_path.h
rename to libs/image/kis_node_query_path.h
diff --git a/libs/image/kis_spontaneous_job.h b/libs/image/kis_spontaneous_job.h
index 6a4194062d..033eac24e6 100644
--- a/libs/image/kis_spontaneous_job.h
+++ b/libs/image/kis_spontaneous_job.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2013 Dmitry Kazakov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SPONTANEOUS_JOB_H
#define __KIS_SPONTANEOUS_JOB_H
#include "kis_runnable.h"
/**
* This class represents a simple update just that should be
* executed by the updates system from time to time, without
- * any recording or undo support. Just some useful update that
+ * any undo support. Just some useful update that
* can be run concurrently with other types updates.
*/
class KRITAIMAGE_EXPORT KisSpontaneousJob : public KisRunnable
{
public:
virtual bool overrides(const KisSpontaneousJob *otherJob) = 0;
virtual int levelOfDetail() const = 0;
bool isExclusive() const {
return m_isExclusive;
}
protected:
void setExclusive(bool value) {
m_isExclusive = value;
}
private:
bool m_isExclusive = false;
};
#endif /* __KIS_SPONTANEOUS_JOB_H */
diff --git a/libs/image/kis_time_range.cpp b/libs/image/kis_time_range.cpp
index 85c918e961..363e970bc4 100644
--- a/libs/image/kis_time_range.cpp
+++ b/libs/image/kis_time_range.cpp
@@ -1,100 +1,144 @@
/*
* Copyright (c) 2015 Dmitry Kazakov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_time_range.h"
#include
#include "kis_keyframe_channel.h"
#include "kis_node.h"
struct KisTimeRangeStaticRegistrar {
KisTimeRangeStaticRegistrar() {
qRegisterMetaType("KisTimeRange");
}
};
static KisTimeRangeStaticRegistrar __registrar;
QDebug operator<<(QDebug dbg, const KisTimeRange &r)
{
dbg.nospace() << "KisTimeRange(" << r.start() << ", " << r.end() << ")";
return dbg.space();
}
void KisTimeRange::calculateTimeRangeRecursive(const KisNode *node, int time, KisTimeRange &range, bool exclusive)
{
if (!node->visible()) return;
- Q_FOREACH (const KisKeyframeChannel *channel, node->keyframeChannels()) {
- if (exclusive) {
- // Intersection
- range &= channel->identicalFrames(time);
- } else {
- // Union
- range |= channel->affectedFrames(time);
- }
+
+ if (exclusive) {
+ // Intersection
+ range &= calculateNodeIdenticalFrames(node, time);
+ } else {
+ // Union
+ range |= calculateNodeAffectedFrames(node, time);
}
KisNodeSP child = node->firstChild();
while (child) {
calculateTimeRangeRecursive(child, time, range, exclusive);
child = child->nextSibling();
}
}
+KisTimeRange KisTimeRange::calculateNodeIdenticalFrames(const KisNode *node, int time)
+{
+ KisTimeRange range = KisTimeRange::infinite(0);
+
+ const QMap channels =
+ node->keyframeChannels();
+
+ if (channels.isEmpty() ||
+ !channels.contains(KisKeyframeChannel::Content.id())) {
+
+ return range;
+ }
+
+ Q_FOREACH (const KisKeyframeChannel *channel, channels) {
+ // Intersection
+ range &= channel->identicalFrames(time);
+ }
+
+ return range;
+}
+
+KisTimeRange KisTimeRange::calculateNodeAffectedFrames(const KisNode *node, int time)
+{
+ KisTimeRange range;
+
+ if (!node->visible()) return range;
+
+ const QMap channels =
+ node->keyframeChannels();
+
+ if (channels.isEmpty() ||
+ !channels.contains(KisKeyframeChannel::Content.id())) {
+
+ range = KisTimeRange::infinite(0);
+ return range;
+ }
+
+ Q_FOREACH (const KisKeyframeChannel *channel, channels) {
+ // Union
+ range |= channel->affectedFrames(time);
+ }
+
+ return range;
+}
+
namespace KisDomUtils {
void saveValue(QDomElement *parent, const QString &tag, const KisTimeRange &range)
{
QDomDocument doc = parent->ownerDocument();
QDomElement e = doc.createElement(tag);
parent->appendChild(e);
e.setAttribute("type", "timerange");
if (range.isValid()) {
e.setAttribute("from", toString(range.start()));
if (!range.isInfinite()) {
e.setAttribute("to", toString(range.end()));
}
}
}
bool loadValue(const QDomElement &parent, const QString &tag, KisTimeRange *range)
{
QDomElement e;
if (!findOnlyElement(parent, tag, &e)) return false;
if (!Private::checkType(e, "timerange")) return false;
int start = toInt(e.attribute("from", "-1"));
int end = toInt(e.attribute("to", "-1"));
if (start == -1) {
range = new KisTimeRange();
} else if (end == -1) {
*range = KisTimeRange::infinite(start);
} else {
*range = KisTimeRange::fromTime(start, end);
}
return true;
}
}
diff --git a/libs/image/kis_time_range.h b/libs/image/kis_time_range.h
index 0b1489d256..a6af4eab50 100644
--- a/libs/image/kis_time_range.h
+++ b/libs/image/kis_time_range.h
@@ -1,150 +1,152 @@
/*
* Copyright (c) 2015 Dmitry Kazakov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TIME_RANGE_H
#define __KIS_TIME_RANGE_H
#include "kritaimage_export.h"
#include
#include
#include
#include
#include "kis_types.h"
#include
class KRITAIMAGE_EXPORT KisTimeRange : public boost::equality_comparable
{
public:
inline KisTimeRange()
: m_start(0),
m_end(-1)
{
}
inline KisTimeRange(int start, int duration)
: m_start(start),
m_end(start + duration - 1)
{
}
inline KisTimeRange(int start, int end, bool)
: m_start(start),
m_end(end)
{
}
bool operator==(const KisTimeRange &rhs) const {
return rhs.m_start == m_start && rhs.m_end == m_end;
}
KisTimeRange& operator|=(const KisTimeRange &rhs) {
if (!isValid()) {
m_start = rhs.start();
} else if (rhs.isValid()) {
m_start = std::min(m_start, rhs.start());
}
if (rhs.isInfinite() || isInfinite()) {
m_end = std::numeric_limits::min();
} else if (!isValid()) {
m_end = rhs.m_end;
} else {
m_end = std::max(m_end, rhs.m_end);
}
return *this;
}
KisTimeRange& operator&=(const KisTimeRange &rhs) {
if (!isValid()) {
return *this;
} else if (!rhs.isValid()) {
m_start = rhs.start();
m_end = rhs.m_end;
return *this;
} else {
m_start = std::max(m_start, rhs.start());
}
if (isInfinite()) {
m_end = rhs.m_end;
} else if (!rhs.isInfinite()) {
m_end = std::min(m_end, rhs.m_end);
}
return *this;
}
inline int start() const {
return m_start;
}
inline int end() const {
return m_end;
}
inline int duration() const {
return m_end >= m_start ? m_end - m_start + 1 : 0;
}
inline bool isInfinite() const {
return m_end == std::numeric_limits::min();
}
inline bool isValid() const {
return (m_end >= m_start) || (m_end == std::numeric_limits::min() && m_start >= 0);
}
inline bool contains(int time) const {
if (m_end == std::numeric_limits::min()) {
return m_start <= time;
}
return m_start <= time && time <= m_end;
}
static inline KisTimeRange fromTime(int start, int end) {
return KisTimeRange(start, end, true);
}
static inline KisTimeRange infinite(int start) {
return KisTimeRange(start, std::numeric_limits::min(), true);
}
static void calculateTimeRangeRecursive(const KisNode *node, int time, KisTimeRange &range, bool exclusive);
+ static KisTimeRange calculateNodeIdenticalFrames(const KisNode *node, int time);
+ static KisTimeRange calculateNodeAffectedFrames(const KisNode *node, int time);
private:
int m_start;
int m_end;
};
namespace KisDomUtils {
void KRITAIMAGE_EXPORT saveValue(QDomElement *parent, const QString &tag, const KisTimeRange &range);
bool KRITAIMAGE_EXPORT loadValue(const QDomElement &parent, const QString &tag, KisTimeRange *range);
}
Q_DECLARE_METATYPE(KisTimeRange);
KRITAIMAGE_EXPORT QDebug operator<<(QDebug dbg, const KisTimeRange &r);
#endif /* __KIS_TIME_RANGE_H */
diff --git a/libs/image/kis_vec.h b/libs/image/kis_vec.h
index f7c34750a8..624e031ff8 100644
--- a/libs/image/kis_vec.h
+++ b/libs/image/kis_vec.h
@@ -1,61 +1,46 @@
/*
* kis_vec.h - part of KImageShop
*
* Copyright (c) 1999 Matthias Elter
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __kis_vec_h__
#define __kis_vec_h__
#include
#include
#include
typedef Eigen::Matrix KisVector2D;
-typedef Eigen::Matrix KisVector3D;
inline KisVector2D toKisVector2D(const QPointF& p)
{
return KisVector2D(p.x(), p.y());
}
inline KisVector2D toKisVector2D(const QPoint& p)
{
return KisVector2D(p.x(), p.y());
}
template
inline QPointF toQPointF(const ExpressionType& expr)
{
return QPointF(expr.x(), expr.y());
}
-template
-inline QVector2D toQVector2D(const ExpressionType& expr){
- return QVector2D(expr.x(), expr.y());
-}
-
-inline KisVector2D nullKisVector2D()
-{
- KisVector2D v;
- v(0) = 0.0;
- v(1) = 0.0;
- return v;
-}
-
-
#endif
diff --git a/libs/image/recorder/kis_action_recorder.cc b/libs/image/recorder/kis_action_recorder.cc
deleted file mode 100644
index a0cf36bca3..0000000000
--- a/libs/image/recorder/kis_action_recorder.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2007 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "recorder/kis_action_recorder.h"
-
-#include "recorder/kis_recorded_action.h"
-
-KisActionRecorder::KisActionRecorder(QObject* parent)
- : QObject(parent)
-{
-
-}
-
-KisActionRecorder::~KisActionRecorder()
-{
-}
-
-void KisActionRecorder::addAction(const KisRecordedAction& action, const KisRecordedAction* before)
-{
- Q_UNUSED(before);
- emit(addedAction(action));
-}
-
diff --git a/libs/image/recorder/kis_action_recorder.h b/libs/image/recorder/kis_action_recorder.h
deleted file mode 100644
index c4fbba629f..0000000000
--- a/libs/image/recorder/kis_action_recorder.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2007 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_ACTION_RECORDER_H_
-#define _KIS_ACTION_RECORDER_H_
-
-#include
-#include "kritaimage_export.h"
-
-class KisRecordedAction;
-
-/**
- * This class allows other \ref KisMacro to connect to it
- * to get the action that are currently created.
- */
-class KRITAIMAGE_EXPORT KisActionRecorder : public QObject
-{
- Q_OBJECT
-public:
- KisActionRecorder(QObject* parent = 0);
- ~KisActionRecorder() override;
-
-public Q_SLOTS:
-
- void addAction(const KisRecordedAction& action, const KisRecordedAction* before = 0);
-
-Q_SIGNALS:
- /**
- * This signal is emitted each time an action is added to this recorder.
- */
- void addedAction(const KisRecordedAction& action);
-};
-
-#endif
diff --git a/libs/image/recorder/kis_macro.cc b/libs/image/recorder/kis_macro.cc
deleted file mode 100644
index 84e0ee3554..0000000000
--- a/libs/image/recorder/kis_macro.cc
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2007 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_macro.h"
-#include
-
-#include
-#include
-
-#include "kis_image.h"
-#include "recorder/kis_recorded_action.h"
-#include "recorder/kis_recorded_action_factory_registry.h"
-#include "kis_undo_adapter.h"
-#include "kis_play_info.h"
-#include "kis_node_query_path.h"
-#include
-
-struct Q_DECL_HIDDEN KisMacro::Private {
- QList actions;
-};
-
-KisMacro::KisMacro(QObject* parent) : QObject(parent), d(new Private)
-{
-}
-
-KisMacro::KisMacro(const QList& actions) : d(new Private)
-{
- appendActions(actions);
-}
-
-KisMacro::~KisMacro()
-{
- qDeleteAll(d->actions);
- delete d;
-}
-
-
-void KisMacro::appendActions(const QList& actions)
-{
- Q_FOREACH (KisRecordedAction* action, actions) {
- addAction(*action);
- }
-}
-
-void KisMacro::removeActions(const QList& actions)
-{
- Q_FOREACH (KisRecordedAction* action, actions) {
- d->actions.removeAll(action);
- }
- qDeleteAll(actions);
-}
-
-void KisMacro::addAction(const KisRecordedAction& action, const KisRecordedAction* before)
-{
- if (before == 0) {
- KisRecordedAction* a = action.clone();
- Q_ASSERT(a);
- d->actions.append(a);
- } else {
- d->actions.insert(d->actions.indexOf(const_cast(before)), action.clone());
- }
-}
-
-void KisMacro::moveAction(const KisRecordedAction* action, const KisRecordedAction* before)
-{
- KisRecordedAction* _action = d->actions.takeAt(d->actions.indexOf(const_cast(action)));
- if (before == 0) {
- Q_ASSERT(_action);
- d->actions.append(_action);
- } else {
- d->actions.insert(d->actions.indexOf(const_cast(before)), _action);
- }
-}
-
-void KisMacro::fromXML(const QDomElement& docElem, const KisRecordedActionLoadContext* loadContext)
-{
- d->actions.clear();
- QDomNode node = docElem.firstChild();
- while (!node.isNull()) {
- QDomElement elt = node.toElement(); // try to convert the node to an element.
- if (!elt.isNull() && elt.tagName() == "RecordedAction") {
- QString id = elt.attribute("id", "");
- if (!id.isNull()) {
- dbgImage << "Reconstruct : " << id << endl; // the node really is an element.
- KisRecordedActionFactory* raf = KisRecordedActionFactoryRegistry::instance()->get(id);
- if (raf) {
- KisRecordedAction* a = raf->fromXML(elt, loadContext);
- Q_ASSERT(a);
- d->actions.append(a); // TODO should use addAction
- } else {
- dbgImage << "Unknown action : " << id << endl;
- }
- } else {
- dbgImage << "Invalid recorded action: null id";
- }
- } else {
- dbgImage << "Unknown element " << elt.tagName() << (elt.tagName() == "RecordedAction");
- }
- node = node.nextSibling();
- }
-}
-
-void KisMacro::toXML(QDomDocument& doc, QDomElement& e, KisRecordedActionSaveContext* saveContext) const
-{
- for (QList::iterator it = d->actions.begin();
- it != d->actions.end(); ++it) {
- QDomElement eAct = doc.createElement("RecordedAction");
- (*it)->toXML(doc, eAct, saveContext);
- e.appendChild(eAct);
- }
-}
-
-const QList& KisMacro::actions() const
-{
- return d->actions;
-}
-
diff --git a/libs/image/recorder/kis_macro.h b/libs/image/recorder/kis_macro.h
deleted file mode 100644
index 3f904abd4c..0000000000
--- a/libs/image/recorder/kis_macro.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2007 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_MACRO_H_
-#define _KIS_MACRO_H_
-
-#include
-#include
-#include
-
-#include "kis_serializable_configuration.h"
-#include "kis_types.h"
-
-class KisRecordedAction;
-class KisRecordedActionLoadContext;
-class KisRecordedActionSaveContext;
-
-/**
- * This is the base class for macro in Krita. It's basically a list of recorded action,KisRecordedAction
- * that can be stored as XML, played, and edited.
- */
-class KRITAIMAGE_EXPORT KisMacro : public QObject
-{
- Q_OBJECT
-public:
- KisMacro(QObject* parent = 0);
- KisMacro(const QList& _actions);
- ~KisMacro() override;
-public:
- /**
- * Append a list of actions, and make clone of them.
- */
- void appendActions(const QList& actions);
- /**
- * Remove the list of actions. Actions are deleted.
- */
- void removeActions(const QList& actions);
- /**
- * Move the action before an other one.
- * @param before if null, the action is moved to the end
- */
- void moveAction(const KisRecordedAction* action, const KisRecordedAction* before);
-public: // serialization functions
-
- virtual void fromXML(const QDomElement&, const KisRecordedActionLoadContext* loadContext);
- virtual void toXML(QDomDocument& doc, QDomElement& e, KisRecordedActionSaveContext* saveContext) const;
- const QList& actions() const;
-public Q_SLOTS:
- /**
- * add a single action, and make a clone of it.
- * @param before if non null, the action will be added before that action,
- * otherwise, if null, the action will be added at the end.
- */
- virtual void addAction(const KisRecordedAction& action, const KisRecordedAction* before = 0);
-private:
- struct Private;
- Private* const d;
-};
-
-#endif
diff --git a/libs/image/recorder/kis_macro_player.cc b/libs/image/recorder/kis_macro_player.cc
deleted file mode 100644
index 7490b93e8d..0000000000
--- a/libs/image/recorder/kis_macro_player.cc
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2007,2011 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_macro_player.h"
-
-#include
-
-#include
-#include
-
-#include "kis_image.h"
-#include "kis_debug.h"
-#include "kis_macro.h"
-#include "kis_node_query_path.h"
-#include "kis_play_info.h"
-#include "kis_recorded_action.h"
-#include "kis_undo_adapter.h"
-#include "kundo2magicstring.h"
-
-
-struct Q_DECL_HIDDEN KisMacroPlayer::Private
-{
- Private(const KisPlayInfo& _info) : info(_info), updater(0) {}
- bool paused;
- KisMacro* macro;
- KisPlayInfo info;
- KoUpdater* updater;
-};
-
-KisMacroPlayer::KisMacroPlayer(KisMacro* _macro, const KisPlayInfo& info, KoUpdater * updater, QObject* _parent ) : QThread(_parent), d(new Private(info))
-{
- d->macro = _macro;
- d->updater = updater;
-}
-
-KisMacroPlayer::~KisMacroPlayer()
-{
- delete d;
-}
-
-void KisMacroPlayer::pause()
-{
- d->paused = true;
-}
-
-void KisMacroPlayer::resume()
-{
- d->paused = false;
-}
-
-void KisMacroPlayer::run()
-{
- d->paused = false;
- QList actions = d->macro->actions();
-
- if (actions.size() < 1) {
- return;
- }
-
- dbgImage << "Start playing macro with " << actions.size() << " actions";
- if (d->info.undoAdapter()) {
- d->info.undoAdapter()->beginMacro(kundo2_i18n("Play macro"));
- }
-
- KoProgressUpdater* progressUpdater = 0;
- if(d->updater) {
- progressUpdater = new KoProgressUpdater(d->updater);
- progressUpdater->start(actions.size(), i18n("Playing back macro"));
- }
-
- for (QList::iterator it = actions.begin(); it != actions.end(); ++it) {
- if (*it) {
- dbgImage << "Play action : " << (*it)->name();
- KoUpdater* updater = 0;
- if(progressUpdater) {
- updater = progressUpdater->startSubtask();
- }
- (*it)->play(d->info, updater);
- }
- if(progressUpdater && progressUpdater->interrupted()) {
- break;
- }
- }
-
- if (d->info.undoAdapter()) {
- d->info.undoAdapter()->endMacro();
- if(progressUpdater && progressUpdater->interrupted()) {
- d->info.undoAdapter()->undoLastCommand();
- }
- }
-
-}
-
diff --git a/libs/image/recorder/kis_macro_player.h b/libs/image/recorder/kis_macro_player.h
deleted file mode 100644
index c58cafc064..0000000000
--- a/libs/image/recorder/kis_macro_player.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2011 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_MACRO_PLAYER_H_
-#define _KIS_MACRO_PLAYER_H_
-
-#include
-
-#include
-#include
-
-class KisMacro;
-class KisPlayInfo;
-class KoUpdater;
-
-/**
- * This class play a macro inside a thread.
- */
-class KRITAIMAGE_EXPORT KisMacroPlayer : public QThread {
- Q_OBJECT
-public:
- KisMacroPlayer(KisMacro* _macro, const KisPlayInfo& info, KoUpdater * updater = 0, QObject* _parent = 0);
- ~KisMacroPlayer() override;
-public Q_SLOTS:
- void pause();
- void resume();
-protected:
- void run() override;
-private:
- struct Private;
- Private* const d;
-};
-
-#endif
diff --git a/libs/image/recorder/kis_play_info.cc b/libs/image/recorder/kis_play_info.cc
deleted file mode 100644
index a0d40d8aad..0000000000
--- a/libs/image/recorder/kis_play_info.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2009,2011 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_play_info.h"
-
-#include "kis_image.h"
-#include "kis_node.h"
-#include
-
-struct Q_DECL_HIDDEN KisPlayInfo::Private {
- KisImageWSP image;
- KisNodeSP currentNode;
-};
-
-KisPlayInfo::KisPlayInfo(KisImageWSP image, KisNodeSP currentNode)
- : d(new Private)
-{
- d->image = image;
- d->currentNode = currentNode;
-}
-
-KisPlayInfo::KisPlayInfo(const KisPlayInfo& _rhs) : d(new Private(*_rhs.d))
-{
-}
-
-KisPlayInfo& KisPlayInfo::operator=(const KisPlayInfo& _rhs)
-{
- *d = *_rhs.d;
- return *this;
-}
-
-KisPlayInfo::~KisPlayInfo()
-{
- delete d;
-}
-
-KisUndoAdapter* KisPlayInfo::undoAdapter() const
-{
- return d->image->undoAdapter();
-}
-
-KisImageWSP KisPlayInfo::image() const
-{
- return d->image;
-}
-
-KisNodeSP KisPlayInfo::currentNode() const
-{
- return d->currentNode;
-}
diff --git a/libs/image/recorder/kis_play_info.h b/libs/image/recorder/kis_play_info.h
deleted file mode 100644
index 9f54df938e..0000000000
--- a/libs/image/recorder/kis_play_info.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2009 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_PLAY_INFO_H_
-#define _KIS_PLAY_INFO_H_
-
-#include
-#include
-
-class KisUndoAdapter;
-
-class KRITAIMAGE_EXPORT KisPlayInfo
-{
-public:
- KisPlayInfo(KisImageWSP image, KisNodeSP currentNodes);
- KisPlayInfo(const KisPlayInfo& _rhs);
- KisPlayInfo& operator=(const KisPlayInfo& _rhs);
- ~KisPlayInfo();
- KisUndoAdapter* undoAdapter() const;
- KisImageWSP image() const;
- KisNodeSP currentNode() const;
-private:
- struct Private;
- Private* const d;
-};
-
-#endif
diff --git a/libs/image/recorder/kis_recorded_action.cc b/libs/image/recorder/kis_recorded_action.cc
deleted file mode 100644
index 5b5ae388c5..0000000000
--- a/libs/image/recorder/kis_recorded_action.cc
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2007 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_recorded_action.h"
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-struct Q_DECL_HIDDEN KisRecordedAction::Private {
- QString name;
- QString id;
-};
-
-KisRecordedAction::KisRecordedAction(const QString& id, const QString& name) : d(new Private())
-{
- d->name = name;
- d->id = id;
-}
-
-KisRecordedAction::KisRecordedAction(const KisRecordedAction& rhs) : d(new Private(*rhs.d))
-{
-
-}
-
-KisRecordedAction::~KisRecordedAction()
-{
- delete d;
-}
-
-const QString& KisRecordedAction::id() const
-{
- return d->id;
-}
-
-const QString& KisRecordedAction::name() const
-{
- return d->name;
-}
-
-void KisRecordedAction::setName(const QString& name)
-{
- d->name = name;
-}
-
-void KisRecordedAction::toXML(QDomDocument& , QDomElement& elt, KisRecordedActionSaveContext* ) const
-{
- elt.setAttribute("name", name());
- elt.setAttribute("id", id());
-}
-
-struct Q_DECL_HIDDEN KisRecordedActionFactory::Private {
- QString id;
-};
-
-KisRecordedActionFactory::KisRecordedActionFactory(QString id) : d(new Private)
-{
- d->id = id;
-}
-
-KisRecordedActionFactory::~KisRecordedActionFactory()
-{
- delete d;
-}
-
-QString KisRecordedActionFactory::id() const
-{
- return d->id;
-}
-
-QString KisRecordedActionFactory::name() const
-{
- return QString();
-}
diff --git a/libs/image/recorder/kis_recorded_action.h b/libs/image/recorder/kis_recorded_action.h
deleted file mode 100644
index 6285be090b..0000000000
--- a/libs/image/recorder/kis_recorded_action.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2007 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_RECORDED_ACTION_H_
-#define _KIS_RECORDED_ACTION_H_
-
-class QDomDocument;
-class QDomElement;
-class QString;
-class KisPlayInfo;
-class KisRecordedActionLoadContext;
-class KisRecordedActionSaveContext;
-class KoUpdater;
-
-#include
-#include
-#include
-
-/**
- * This class represent an action.
- */
-class KRITAIMAGE_EXPORT KisRecordedAction
-{
-public:
- KisRecordedAction(const QString& id, const QString& name);
- KisRecordedAction(const KisRecordedAction&);
- virtual ~KisRecordedAction();
- /**
- * Play the action.
- */
- virtual void play(const KisPlayInfo& _info, KoUpdater* _updater = 0) const = 0;
- /**
- * Clone this action.
- */
- virtual KisRecordedAction* clone() const = 0;
- virtual void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const;
-public:
- const QString& id() const;
- const QString& name() const;
- void setName(const QString& name);
-private:
- struct Private;
- Private* const d;
-};
-
-/**
- * This class is used to create recorded action.
- */
-class KRITAIMAGE_EXPORT KisRecordedActionFactory
-{
-public:
- KisRecordedActionFactory(QString id);
- virtual ~KisRecordedActionFactory();
- virtual KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*) = 0;
- QString id() const;
- QString name() const;
-private:
- struct Private;
- Private* const d;
-};
-
-#endif
diff --git a/libs/image/recorder/kis_recorded_action_factory_registry.cc b/libs/image/recorder/kis_recorded_action_factory_registry.cc
deleted file mode 100644
index b1d17cc41c..0000000000
--- a/libs/image/recorder/kis_recorded_action_factory_registry.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2007 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_recorded_action_factory_registry.h"
-#include "kis_recorded_filter_action.h"
-#include "kis_recorded_path_paint_action.h"
-#include "kis_recorded_shape_paint_action.h"
-#include "kis_recorded_fill_paint_action.h"
-
-#include
-#include
-
-Q_GLOBAL_STATIC(KisRecordedActionFactoryRegistry, s_instance)
-
-
-KisRecordedActionFactoryRegistry* KisRecordedActionFactoryRegistry::instance()
-{
- return s_instance;
-}
-
-
-KisRecordedActionFactoryRegistry::KisRecordedActionFactoryRegistry()
-{
- add(new KisRecordedFilterActionFactory);
- add(new KisRecordedPathPaintActionFactory);
- add(new KisRecordedShapePaintActionFactory);
- add(new KisRecordedFillPaintActionFactory);
-}
-
-KisRecordedActionFactoryRegistry::~KisRecordedActionFactoryRegistry()
-{
- Q_FOREACH (const QString &id, keys()) {
- delete get(id);
- }
- dbgRegistry << "deleting KisRecordedActionFactoryRegistry";
-}
diff --git a/libs/image/recorder/kis_recorded_action_factory_registry.h b/libs/image/recorder/kis_recorded_action_factory_registry.h
deleted file mode 100644
index b678417220..0000000000
--- a/libs/image/recorder/kis_recorded_action_factory_registry.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2007 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_RECORDED_ACTION_FACTORY_REGISTRY_H_
-#define _KIS_RECORDED_ACTION_FACTORY_REGISTRY_H_
-
-#include
-
-class KisRecordedActionFactory;
-
-#include
-
-class KRITAIMAGE_EXPORT KisRecordedActionFactoryRegistry : public KoGenericRegistry
-{
-public:
- KisRecordedActionFactoryRegistry();
- ~KisRecordedActionFactoryRegistry() override;
- static KisRecordedActionFactoryRegistry* instance();
-};
-
-#endif
diff --git a/libs/image/recorder/kis_recorded_action_load_context.cpp b/libs/image/recorder/kis_recorded_action_load_context.cpp
deleted file mode 100644
index cb1dc1f43d..0000000000
--- a/libs/image/recorder/kis_recorded_action_load_context.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2010 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_recorded_action_load_context.h"
-
-
-KisRecordedActionLoadContext::~KisRecordedActionLoadContext()
-{
-}
diff --git a/libs/image/recorder/kis_recorded_action_load_context.h b/libs/image/recorder/kis_recorded_action_load_context.h
deleted file mode 100644
index 940fc3123b..0000000000
--- a/libs/image/recorder/kis_recorded_action_load_context.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2010 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_RECORDED_ACTION_LOAD_CONTEXT_H_
-#define _KIS_RECORDED_ACTION_LOAD_CONTEXT_H_
-
-#include "kritaimage_export.h"
-
-class KoAbstractGradient;
-class KoPattern;
-class QString;
-
-class KRITAIMAGE_EXPORT KisRecordedActionLoadContext {
- public:
- virtual ~KisRecordedActionLoadContext();
- virtual KoAbstractGradient* gradient(const QString& name) const = 0;
- virtual KoPattern* pattern(const QString& name) const = 0;
-};
-
-#endif
diff --git a/libs/image/recorder/kis_recorded_action_save_context.cpp b/libs/image/recorder/kis_recorded_action_save_context.cpp
deleted file mode 100644
index 9230072cc7..0000000000
--- a/libs/image/recorder/kis_recorded_action_save_context.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2010 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_recorded_action_save_context.h"
-
-KisRecordedActionSaveContext::~KisRecordedActionSaveContext()
-{
-}
diff --git a/libs/image/recorder/kis_recorded_action_save_context.h b/libs/image/recorder/kis_recorded_action_save_context.h
deleted file mode 100644
index c52ecf5ce3..0000000000
--- a/libs/image/recorder/kis_recorded_action_save_context.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2010 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_RECORDED_ACTION_SAVE_CONTEXT_H_
-#define _KIS_RECORDED_ACTION_SAVE_CONTEXT_H_
-
-#include "kritaimage_export.h"
-
-class KoAbstractGradient;
-class KoPattern;
-
-class KRITAIMAGE_EXPORT KisRecordedActionSaveContext {
- public:
- virtual ~KisRecordedActionSaveContext();
- virtual void saveGradient(const KoAbstractGradient* gradient) = 0;
- virtual void savePattern(const KoPattern* pattern) = 0;
-};
-
-#endif
diff --git a/libs/image/recorder/kis_recorded_fill_paint_action.cpp b/libs/image/recorder/kis_recorded_fill_paint_action.cpp
deleted file mode 100644
index 5a26bad2a4..0000000000
--- a/libs/image/recorder/kis_recorded_fill_paint_action.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2010 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_recorded_fill_paint_action.h"
-
-#include
-
-#include
-
-#include "kis_image.h"
-#include
-#include "kis_node.h"
-#include "kis_node_query_path.h"
-#include
-#include "kis_play_info.h"
-
-struct Q_DECL_HIDDEN KisRecordedFillPaintAction::Private {
- Private(const KisNodeQueryPath& _projectionPath) : projectionPath(_projectionPath) {}
- QPoint pt;
- KisNodeQueryPath projectionPath;
-};
-
-KisRecordedFillPaintAction::KisRecordedFillPaintAction(
- const KisNodeQueryPath& path,
- const QPoint& pt,
- const KisNodeQueryPath& projectionPath)
- : KisRecordedPaintAction("FillPaintAction", i18n("Fill"), path, 0)
- , d(new Private(projectionPath))
-{
- d->pt = pt;
-}
-
-KisRecordedFillPaintAction::KisRecordedFillPaintAction(const KisRecordedFillPaintAction& rhs) : KisRecordedPaintAction(rhs), d(new Private(*rhs.d))
-{
-
-}
-
-KisRecordedFillPaintAction::~KisRecordedFillPaintAction()
-{
- delete d;
-}
-
-void KisRecordedFillPaintAction::toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* context) const
-{
- KisRecordedPaintAction::toXML(doc, elt, context);
- elt.setAttribute("x", d->pt.x());
- elt.setAttribute("y", d->pt.y());
- elt.setAttribute("projectionPath", d->projectionPath.toString());
-}
-
-KisRecordedAction* KisRecordedFillPaintAction::clone() const
-{
- return new KisRecordedFillPaintAction(*this);
-}
-
-KisPainter* KisRecordedFillPaintAction::createPainter(KisPaintDeviceSP device) const
-{
- return new KisFillPainter(device);
-}
-
-void KisRecordedFillPaintAction::playPaint(const KisPlayInfo& info, KisPainter* _painter) const
-{
- QList nodes = d->projectionPath.queryNodes(info.image(), info.currentNode());
- KisPaintDeviceSP projection = 0;
- if (!nodes.isEmpty())
- {
- projection = nodes[0]->projection();
- }
- KisFillPainter* painter = static_cast(_painter);
- painter->setWidth(info.image()->width());
- painter->setHeight(info.image()->height());
- if (fillStyle() == KisPainter::FillStylePattern)
- {
- painter->fillPattern(d->pt.x(), d->pt.y(), projection);
- } else {
- painter->fillColor(d->pt.x(), d->pt.y(), projection);
- }
-}
-
-KisRecordedFillPaintActionFactory::KisRecordedFillPaintActionFactory() :
- KisRecordedPaintActionFactory("FillPaintAction")
-{
-}
-
-KisRecordedFillPaintActionFactory::~KisRecordedFillPaintActionFactory()
-{
-
-}
-
-KisRecordedAction* KisRecordedFillPaintActionFactory::fromXML(const QDomElement& elt, const KisRecordedActionLoadContext* context)
-{
- KisNodeQueryPath pathnode = nodeQueryPathFromXML(elt);
- KisNodeQueryPath projectionPathnode = KisNodeQueryPath::fromString(elt.attribute("projectionPath"));
-
- int x = elt.attribute("x", "0").toInt();
- int y = elt.attribute("y", "0").toInt();
-
- KisRecordedFillPaintAction* rplpa = new KisRecordedFillPaintAction(pathnode, QPoint(x,y), projectionPathnode);
-
- setupPaintAction(rplpa, elt, context);
- return rplpa;
-}
diff --git a/libs/image/recorder/kis_recorded_fill_paint_action.h b/libs/image/recorder/kis_recorded_fill_paint_action.h
deleted file mode 100644
index 4a7fd3f00d..0000000000
--- a/libs/image/recorder/kis_recorded_fill_paint_action.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2010 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_RECORDED_FILL_PAINT_ACTION_H_
-#define _KIS_RECORDED_FILL_PAINT_ACTION_H_
-
-#include "recorder/kis_recorded_action.h"
-#include "recorder/kis_recorded_paint_action.h"
-#include "kis_types.h"
-
-#include
-
-/**
- * This class will record the painting of a bezier curve.
- */
-class KRITAIMAGE_EXPORT KisRecordedFillPaintAction : public KisRecordedPaintAction
-{
-public:
-
- KisRecordedFillPaintAction(const KisNodeQueryPath& path, const QPoint& pt, const KisNodeQueryPath& projectionPath);
-
- KisRecordedFillPaintAction(const KisRecordedFillPaintAction&);
-
- ~KisRecordedFillPaintAction() override;
-
- void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const override;
-
- KisRecordedAction* clone() const override;
-
-protected:
-
- KisPainter* createPainter(KisPaintDeviceSP device) const override;
- void playPaint(const KisPlayInfo& info, KisPainter* painter) const override;
-
-private:
-
- struct Private;
- Private* const d;
-};
-
-
-class KisRecordedFillPaintActionFactory : public KisRecordedPaintActionFactory
-{
-public:
- KisRecordedFillPaintActionFactory();
- ~KisRecordedFillPaintActionFactory() override;
- KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*) override;
-};
-
-#endif
diff --git a/libs/image/recorder/kis_recorded_filter_action.cpp b/libs/image/recorder/kis_recorded_filter_action.cpp
deleted file mode 100644
index 5052a43f11..0000000000
--- a/libs/image/recorder/kis_recorded_filter_action.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2007 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "recorder/kis_recorded_filter_action.h"
-#include
-#include
-
-
-#include "kis_image.h"
-#include "filter/kis_filter.h"
-#include "filter/kis_filter_configuration.h"
-#include "filter/kis_filter_registry.h"
-#include "kis_layer.h"
-#include "kis_node.h"
-#include "kis_selection.h"
-#include "kis_transaction.h"
-#include "kis_undo_adapter.h"
-#include "kis_selection_mask.h"
-#include "kis_config_widget.h"
-#include "kis_node_query_path.h"
-#include "kis_play_info.h"
-
-struct Q_DECL_HIDDEN KisRecordedFilterAction::Private {
- Private()
- : filterConfiguration(0)
- {
-
- }
-
- const KisFilter* filter;
- QRect rect;
-
- KisFilterConfigurationSP configuration() {
- if (!filterConfiguration) {
- filterConfiguration = filter->defaultConfiguration();
- if (filterConfiguration) {
- filterConfiguration->fromXML(configstr);
- }
- }
- return filterConfiguration;
- }
-
- void setConfiguration(KisFilterConfigurationSP conf) {
- filterConfiguration = conf;
- configstr = conf->toXML();
- }
-
- void setConfig(const QString& cfg) {
- filterConfiguration = 0;
- configstr = cfg;
- }
-
- const QString& config() {
- return configstr;
- }
-
-private:
- QString configstr;
- KisFilterConfigurationSP filterConfiguration;
-};
-
-KisRecordedFilterAction::KisRecordedFilterAction(QString name, const KisNodeQueryPath& path, const KisFilter* filter, const KisFilterConfigurationSP fc) : KisRecordedNodeAction("FilterAction", name, path), d(new Private)
-{
- Q_ASSERT(filter);
- d->filter = filter;
- if (fc) {
- d->setConfig(fc->toXML());
- }
-}
-
-KisRecordedFilterAction::KisRecordedFilterAction(const KisRecordedFilterAction& rhs) : KisRecordedNodeAction(rhs), d(new Private(*rhs.d))
-{
-}
-
-KisRecordedFilterAction::~KisRecordedFilterAction()
-{
- delete d;
-}
-
-void KisRecordedFilterAction::play(KisNodeSP node, const KisPlayInfo& _info, KoUpdater* _updater) const
-{
- KisFilterConfigurationSP kfc = d->configuration();
- KisPaintDeviceSP dev = node->paintDevice();
- KisLayerSP layer = qobject_cast(node.data());
- QRect r1 = dev->extent();
- KisTransaction transaction(kundo2_i18n("Filter: \"%1\"", d->filter->name()), dev);
-
- KisImageWSP image = _info.image();
- r1 = r1.intersected(image->bounds());
- if (layer && layer->selection()) {
- r1 = r1.intersected(layer->selection()->selectedExactRect());
- }
-
- d->filter->process(dev, dev, layer->selection(), r1, kfc, _updater);
- node->setDirty(r1);
-
- transaction.commit(_info.undoAdapter());
-}
-
-void KisRecordedFilterAction::toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* context) const
-{
- KisRecordedAction::toXML(doc, elt, context);
- elt.setAttribute("filter", d->filter->id());
- // Save configuration
- KisFilterConfigurationSP kfc = d->configuration();
- if (kfc) {
- QDomElement filterConfigElt = doc.createElement("Params");
- kfc->toXML(doc, filterConfigElt);
- elt.appendChild(filterConfigElt);
- }
-}
-
-KisRecordedAction* KisRecordedFilterAction::clone() const
-{
- return new KisRecordedFilterAction(*this);
-}
-
-const KisFilter* KisRecordedFilterAction::filter() const
-{
- return d->filter;
-}
-
-const KisFilterConfigurationSP KisRecordedFilterAction::filterConfiguration() const
-{
- return d->configuration();
-}
-
-void KisRecordedFilterAction::setFilterConfiguration(KisFilterConfigurationSP config)
-{
- d->setConfiguration(config);
-}
-
-
-KisRecordedFilterActionFactory::KisRecordedFilterActionFactory() :
- KisRecordedActionFactory("FilterAction")
-{
-}
-
-KisRecordedFilterActionFactory::~KisRecordedFilterActionFactory()
-{
-
-}
-
-KisRecordedAction* KisRecordedFilterActionFactory::fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*)
-{
- QString name = elt.attribute("name");
- KisNodeQueryPath pathnode = KisNodeQueryPath::fromString(elt.attribute("path"));
- const KisFilterSP filter = KisFilterRegistry::instance()->get(elt.attribute("filter"));
- if (filter) {
- KisFilterConfigurationSP config = filter->defaultConfiguration();
- QDomElement paramsElt = elt.firstChildElement("Params");
- if (config && !paramsElt.isNull()) {
- config->fromXML(paramsElt);
- }
- KisRecordedFilterAction* rfa = new KisRecordedFilterAction(name, pathnode, filter, config);
- return rfa;
- } else {
- return 0;
- }
-}
diff --git a/libs/image/recorder/kis_recorded_filter_action.h b/libs/image/recorder/kis_recorded_filter_action.h
deleted file mode 100644
index c568117ace..0000000000
--- a/libs/image/recorder/kis_recorded_filter_action.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2007 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_RECORDED_FILTER_ACTION_H_
-#define _KIS_RECORDED_FILTER_ACTION_H_
-
-#include "recorder/kis_recorded_node_action.h"
-
-#include
-
-class QString;
-class KisFilterConfiguration;
-
-/**
- * Action representing a filter.
- */
-class KRITAIMAGE_EXPORT KisRecordedFilterAction : public KisRecordedNodeAction
-{
-public:
- /**
- * @param config the filter configuration, the ownership of config remains in the caller.
- */
- KisRecordedFilterAction(QString name, const KisNodeQueryPath& path, const KisFilter* filter, const KisFilterConfigurationSP config);
- KisRecordedFilterAction(const KisRecordedFilterAction&);
- ~KisRecordedFilterAction() override;
- using KisRecordedNodeAction::play;
- void play(KisNodeSP node, const KisPlayInfo& _info, KoUpdater* _updater = 0) const override;
- void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const override;
- KisRecordedAction* clone() const override;
- const KisFilter* filter() const;
- const KisFilterConfigurationSP filterConfiguration() const;
- /**
- * Set the configuration, and takes the ownership of the config object.
- */
- void setFilterConfiguration(KisFilterConfigurationSP config);
-private:
- struct Private;
- Private* const d;
-};
-
-class KisRecordedFilterActionFactory : public KisRecordedActionFactory
-{
-public:
- KisRecordedFilterActionFactory();
- ~KisRecordedFilterActionFactory() override;
- KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*) override;
-};
-
-#endif
diff --git a/libs/image/recorder/kis_recorded_node_action.cc b/libs/image/recorder/kis_recorded_node_action.cc
deleted file mode 100644
index 2529cc519c..0000000000
--- a/libs/image/recorder/kis_recorded_node_action.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2011 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_recorded_node_action.h"
-
-#include
-#include
-#include
-
-#include "kis_node_query_path.h"
-#include "kis_play_info.h"
-#include "kis_image.h"
-#include "kis_paint_device.h"
-#include
-
-struct Q_DECL_HIDDEN KisRecordedNodeAction::Private
-{
- Private(const KisNodeQueryPath& _path) : path(_path) {}
- KisNodeQueryPath path;
-};
-
-KisRecordedNodeAction::KisRecordedNodeAction(const QString& id, const QString& name, const KisNodeQueryPath& path) : KisRecordedAction(id, name), d(new Private(path))
-{
-}
-
-KisRecordedNodeAction::KisRecordedNodeAction(const KisRecordedNodeAction& _rhs) : KisRecordedAction(_rhs), d(new Private(*_rhs.d))
-{
-}
-
-KisRecordedNodeAction::~KisRecordedNodeAction()
-{
- delete d;
-}
-
-void KisRecordedNodeAction::play(const KisPlayInfo& _info, KoUpdater* _updater) const
-{
- QList nodes = nodeQueryPath().queryNodes(_info.image(), _info.currentNode());
- KoProgressUpdater updater(_updater);
- updater.start(nodes.size(), i18n("Applying action to all selected nodes"));
- Q_FOREACH (KisNodeSP node, nodes)
- {
- play(node, _info, updater.startSubtask());
- }
-}
-
-const KisNodeQueryPath& KisRecordedNodeAction::nodeQueryPath() const
-{
- return d->path;
-}
-
-void KisRecordedNodeAction::setNodeQueryPath(const KisNodeQueryPath& nqp)
-{
- d->path = nqp;
-}
-
-void KisRecordedNodeAction::toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const
-{
- Q_UNUSED(doc)
- elt.setAttribute("path", d->path.toString());
-}
diff --git a/libs/image/recorder/kis_recorded_node_action.h b/libs/image/recorder/kis_recorded_node_action.h
deleted file mode 100644
index e9a4884b0d..0000000000
--- a/libs/image/recorder/kis_recorded_node_action.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2011 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_RECORDED_NODE_ACTION_H_
-#define _KIS_RECORDED_NODE_ACTION_H_
-
-#include "kis_recorded_action.h"
-class KisNodeQueryPath;
-
-/**
- * Used for action that applys on nodes that are
- */
-class KRITAIMAGE_EXPORT KisRecordedNodeAction : public KisRecordedAction
-{
-public:
- KisRecordedNodeAction(const QString& id, const QString& name, const KisNodeQueryPath& path);
- KisRecordedNodeAction(const KisRecordedNodeAction& _rhs);
- ~KisRecordedNodeAction() override;
- /**
- * Play the action on one node
- */
- virtual void play(KisNodeSP node, const KisPlayInfo&, KoUpdater* _updater) const = 0;
- /**
- * Play the action on all the nodes returned by the nodeQueryPath
- */
- void play(const KisPlayInfo& _info, KoUpdater* _updater) const override;
- void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const override;
-public:
- const KisNodeQueryPath& nodeQueryPath() const;
- void setNodeQueryPath(const KisNodeQueryPath&);
-private:
- struct Private;
- Private* const d;
-};
-
-#endif
diff --git a/libs/image/recorder/kis_recorded_paint_action.cpp b/libs/image/recorder/kis_recorded_paint_action.cpp
deleted file mode 100644
index 5f04f12294..0000000000
--- a/libs/image/recorder/kis_recorded_paint_action.cpp
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * Copyright (c) 2007,2010 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include //MSVC requires that Vc come first
-#include "recorder/kis_recorded_paint_action.h"
-
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#include "kis_node.h"
-#include "kis_mask_generator.h"
-#include "kis_painter.h"
-#include
-#include "kis_paintop_registry.h"
-#include "kis_transaction.h"
-#include "kis_undo_adapter.h"
-#include
-#include
-#include "kis_paint_device.h"
-#include "kis_image.h"
-#include "kis_layer.h"
-#include "kis_play_info.h"
-#include "kis_node_query_path.h"
-#include
-// Recorder
-#include "kis_recorded_action_factory_registry.h"
-#include "kis_recorded_action_load_context.h"
-#include "kis_recorded_action_save_context.h"
-#include
-#include
-#include
-#include
-#include
-
-
-struct Q_DECL_HIDDEN KisRecordedPaintAction::Private {
- KisPaintOpPresetSP paintOpPreset;
- KoColor foregroundColor;
- KoColor backgroundColor;
- qreal opacity; ///< opacity in the range 0.0 -> 100.0
- bool paintIncremental;
- QString compositeOp;
- KisPainter::StrokeStyle strokeStyle;
- KisPainter::FillStyle fillStyle;
- const KoPattern* pattern;
- const KoAbstractGradient* gradient;
- KisFilterConfigurationSP generator;
-};
-
-KisRecordedPaintAction::KisRecordedPaintAction(const QString & id,
- const QString & name,
- const KisNodeQueryPath& path,
- const KisPaintOpPresetSP paintOpPreset)
- : KisRecordedNodeAction(id, name, path)
- , d(new Private)
-{
- if (paintOpPreset)
- {
- d->paintOpPreset = paintOpPreset;
- }
- d->opacity = 1.0;
- d->paintIncremental = true;
- d->compositeOp = COMPOSITE_OVER;
- d->strokeStyle = KisPainter::StrokeStyleBrush;
- d->fillStyle = KisPainter::FillStyleNone;
- d->pattern = 0;
- d->gradient = 0;
-}
-
-KisRecordedPaintAction::KisRecordedPaintAction(const KisRecordedPaintAction& rhs) : KisRecordedNodeAction(rhs), d(new Private(*rhs.d))
-{
-
-}
-
-KisRecordedPaintAction::~KisRecordedPaintAction()
-{
- delete d;
-}
-
-void KisRecordedPaintAction::toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* context) const
-{
- KisRecordedAction::toXML(doc, elt, context);
-
- // Paint op presset
- if (d->paintOpPreset)
- {
- QDomElement paintopPressetElt = doc.createElement("PaintopPreset");
- d->paintOpPreset->toXML(doc, paintopPressetElt);
- elt.appendChild(paintopPressetElt);
- }
-
- // ForegroundColor
- QDomElement foregroundColorElt = doc.createElement("ForegroundColor");
- d->foregroundColor.toXML(doc, foregroundColorElt);
- elt.appendChild(foregroundColorElt);
-
- // BackgroundColor
- QDomElement backgroundColorElt = doc.createElement("BackgroundColor");
- d->backgroundColor.toXML(doc, backgroundColorElt);
- elt.appendChild(backgroundColorElt);
-
- // Opacity
- elt.setAttribute("opacity", KisDomUtils::toString(d->opacity));
-
- // paintIncremental
- elt.setAttribute("paintIncremental", d->paintIncremental);
-
- // compositeOp
- elt.setAttribute("compositeOp", d->compositeOp);
-
- // Save stroke style
- switch(d->strokeStyle)
- {
- case KisPainter::StrokeStyleNone:
- elt.setAttribute("strokeStyle", "None");
- break;
- case KisPainter::StrokeStyleBrush:
- elt.setAttribute("strokeStyle", "Brush");
- break;
- }
- // Save fill style
- switch(d->fillStyle)
- {
- case KisPainter::FillStyleNone:
- elt.setAttribute("fillStyle", "None");
- break;
- case KisPainter::FillStyleForegroundColor:
- elt.setAttribute("fillStyle", "PaintColor");
- break;
- case KisPainter::FillStyleBackgroundColor:
- elt.setAttribute("fillStyle", "AlternativeColor");
- break;
- case KisPainter::FillStylePattern:
- elt.setAttribute("fillStyle", "Pattern");
- context->savePattern(d->pattern);
- elt.setAttribute("pattern", d->pattern->name());
- break;
- case KisPainter::FillStyleGradient:
- elt.setAttribute("fillStyle", "Gradient");
- context->saveGradient(d->gradient);
- elt.setAttribute("gradient", d->gradient->name());
- break;
- case KisPainter::FillStyleStrokes:
- elt.setAttribute("fillStyle", "Strokes");
- break;
- case KisPainter::FillStyleGenerator:
- elt.setAttribute("fillStyle", "Generator");
- if (d->generator)
- {
- elt.setAttribute("generator", d->generator->name());
- QDomElement filterConfigElt = doc.createElement("Generator");
- d->generator->toXML(doc, filterConfigElt);
- elt.appendChild(filterConfigElt);
- }
- break;
- }
-}
-
-KisPaintOpPresetSP KisRecordedPaintAction::paintOpPreset() const
-{
- return d->paintOpPreset;
-}
-
-void KisRecordedPaintAction::setPaintOpPreset(KisPaintOpPresetSP preset)
-{
- d->paintOpPreset = preset;
-}
-
-qreal KisRecordedPaintAction::opacity() const
-{
- return d->opacity;
-}
-
-void KisRecordedPaintAction::setOpacity(qreal opacity)
-{
- d->opacity = opacity;
-}
-
-KoColor KisRecordedPaintAction::paintColor() const
-{
- return d->foregroundColor;
-}
-
-void KisRecordedPaintAction::setPaintColor(const KoColor& color)
-{
- d->foregroundColor = color;
-}
-
-KoColor KisRecordedPaintAction::backgroundColor() const
-{
- return d->backgroundColor;
-}
-
-void KisRecordedPaintAction::setBackgroundColor(const KoColor& color)
-{
- d->backgroundColor = color;
-}
-
-QString KisRecordedPaintAction::compositeOp()
-{
- return d->compositeOp;
-}
-
-void KisRecordedPaintAction::setCompositeOp(const QString& id)
-{
- d->compositeOp = id;
-}
-
-void KisRecordedPaintAction::setPaintIncremental(bool v)
-{
- d->paintIncremental = v;
-}
-
-void KisRecordedPaintAction::setStrokeStyle(KisPainter::StrokeStyle strokeStyle)
-{
- d->strokeStyle = strokeStyle;
-}
-
-void KisRecordedPaintAction::setFillStyle(KisPainter::FillStyle fillStyle)
-{
- d->fillStyle = fillStyle;
-}
-
-KisPainter::FillStyle KisRecordedPaintAction::fillStyle() const
-{
- return d->fillStyle;
-}
-
-void KisRecordedPaintAction::setPattern(const KoPattern* pattern)
-{
- d->pattern = pattern;
-}
-
-void KisRecordedPaintAction::setGradient(const KoAbstractGradient* gradient)
-{
- d->gradient = gradient;
-}
-
-void KisRecordedPaintAction::setGenerator(const KisFilterConfigurationSP generator)
-{
- d->generator = generator;
-}
-
-void KisRecordedPaintAction::play(KisNodeSP node, const KisPlayInfo& info, KoUpdater* _updater) const
-{
- dbgUI << "Play recorded paint action on node : " << node->name() ;
- KisTransaction transaction(node->paintDevice());
-
- KisPaintDeviceSP target = 0;
- if (d->paintIncremental) {
- target = node->paintDevice();
- } else {
- target = node->paintDevice()->createCompositionSourceDevice();
- }
-
- KisPainter* painter = createPainter(target);
- painter->setProgress(_updater);
-
- if (d->paintIncremental) {
- painter->setCompositeOp(d->compositeOp);
- painter->setOpacity(d->opacity * 255);
- } else {
- painter->setCompositeOp(node->paintDevice()->colorSpace()->compositeOp(COMPOSITE_ALPHA_DARKEN));
- painter->setOpacity(OPACITY_OPAQUE_U8);
-
- }
-
- painter->setPaintColor(d->foregroundColor);
- painter->setBackgroundColor(d->backgroundColor);
-
- painter->setStrokeStyle(d->strokeStyle);
- painter->setFillStyle(d->fillStyle);
- painter->setPattern(d->pattern);
- painter->setGradient(d->gradient);
- painter->setGenerator(d->generator);
-
- if (d->paintOpPreset) {
- painter->setPaintOpPreset(d->paintOpPreset, node, info.image());
- }
-
- playPaint(info, painter);
-
- if (!d->paintIncremental) {
- KisPainter painter2(node->paintDevice());
- painter2.setCompositeOp(d->compositeOp);
- painter2.setOpacity(d->opacity * 255);
-
- QVector dirtyRects = painter->takeDirtyRegion();
- Q_FOREACH (const QRect &rc, dirtyRects) {
- painter2.bitBlt(rc.topLeft(), target, rc);
- }
-
- node->setDirty(painter2.takeDirtyRegion());
- } else {
- node->setDirty(painter->takeDirtyRegion());
- }
- delete painter;
-
- transaction.commit(info.undoAdapter());
-}
-
-KisPainter* KisRecordedPaintAction::createPainter(KisPaintDeviceSP device) const
-{
- return new KisPainter(device);
-}
-
-void KisRecordedPaintActionFactory::setupPaintAction(KisRecordedPaintAction* action, const QDomElement& elt, const KisRecordedActionLoadContext* context)
-{
- QString name = elt.attribute("name");
-
- qreal opacity = opacityFromXML(elt);
- dbgKrita << ppVar(opacity);
- bool paintIncremental = paintIncrementalFromXML(elt);
-
- QString compositeOp = compositeOpFromXML(elt);
- // Decode colors
-
- KoColor bC = backgroundColorFromXML(elt);
- KoColor fC = paintColorFromXML(elt);
-
- action->setName(name);
- action->setBackgroundColor(bC);
- action->setPaintColor(fC);
- action->setOpacity(opacity);
- action->setPaintIncremental(paintIncremental);
- action->setCompositeOp(compositeOp);
-
-
- // Load stroke style
- QString strokeAttr = elt.attribute("strokeStyle", "None");
- if (strokeAttr == "Brush" )
- {
- action->setStrokeStyle(KisPainter::StrokeStyleBrush);
- } else { // "None"
- action->setStrokeStyle(KisPainter::StrokeStyleNone);
- }
- // Save fill style
- QString fillAttr = elt.attribute("fillStyle", "None");
- if (fillAttr == "PaintColor")
- {
- action->setFillStyle(KisPainter::FillStyleForegroundColor);
- } else if(fillAttr == "AlternativeColor")
- {
- action->setFillStyle(KisPainter::FillStyleBackgroundColor);
- } else if(fillAttr == "Pattern")
- {
- const KoPattern* pattern = context->pattern(elt.attribute("pattern"));
- if (pattern)
- {
- action->setFillStyle(KisPainter::FillStylePattern);
- action->setPattern(pattern);
- } else {
- action->setFillStyle(KisPainter::FillStyleNone);
- }
- } else if(fillAttr == "Gradient")
- {
- const KoAbstractGradient* gradient = context->gradient(elt.attribute("gradient"));
- if (gradient)
- {
- action->setFillStyle(KisPainter::FillStyleGradient);
- action->setGradient(gradient);
- } else {
- action->setFillStyle(KisPainter::FillStyleNone);
- }
- } else if(fillAttr == "Strokes")
- {
- action->setFillStyle(KisPainter::FillStyleStrokes);
- } else if(fillAttr == "Generator")
- {
- KisGeneratorSP g = KisGeneratorRegistry::instance()->value(elt.attribute("generator"));
- KisFilterConfigurationSP config = 0;
- if (g)
- {
- config = g->defaultConfiguration();
- QDomElement paramsElt = elt.firstChildElement("Generator");
- if (config && !paramsElt.isNull()) {
- config->fromXML(paramsElt);
- }
- }
- if(config)
- {
- action->setFillStyle(KisPainter::FillStyleGenerator);
- action->setGenerator(config);
- } else {
- action->setFillStyle(KisPainter::FillStyleNone);
- }
- }
-}
-
-KisPaintOpPresetSP KisRecordedPaintActionFactory::paintOpPresetFromXML(const QDomElement& elt)
-{
-
- QDomElement settingsElt = elt.firstChildElement("PaintopPreset");
- if (!settingsElt.isNull()) {
- KisPaintOpPresetSP settings = new KisPaintOpPreset;
- settings->fromXML(settingsElt);
- return settings;
- } else {
- errImage << "No found";
- return 0;
- }
-}
-
-KoColor KisRecordedPaintActionFactory::paintColorFromXML(const QDomElement& elt)
-{
- return colorFromXML(elt, "ForegroundColor");
-}
-
-KoColor KisRecordedPaintActionFactory::backgroundColorFromXML(const QDomElement& elt)
-{
- return colorFromXML(elt, "BackgroundColor");
-}
-
-KoColor KisRecordedPaintActionFactory::colorFromXML(const QDomElement& elt, const QString& elementName)
-{
- QDomElement colorElt = elt.firstChildElement(elementName);
- KoColor bC;
-
- if (!colorElt.isNull()) {
- bC = KoColor::fromXML(colorElt.firstChildElement(), Integer8BitsColorDepthID.id());
- bC.setOpacity(quint8(255));
- dbgImage << elementName << " color : " << bC.toQColor();
- } else {
- dbgImage << "Warning: no <" << elementName << " /> found";
- }
- return bC;
-}
-
-qreal KisRecordedPaintActionFactory::opacityFromXML(const QDomElement& elt)
-{
- return KisDomUtils::toDouble(elt.attribute("opacity", "1.0"));
-}
-
-bool KisRecordedPaintActionFactory::paintIncrementalFromXML(const QDomElement& elt)
-{
- return KisDomUtils::toInt(elt.attribute("paintIncremental", "1"));
-}
-
-QString KisRecordedPaintActionFactory::compositeOpFromXML(const QDomElement& elt)
-{
- return elt.attribute("compositeOp", COMPOSITE_OVER);
-}
-
-KisNodeQueryPath KisRecordedPaintActionFactory::nodeQueryPathFromXML(const QDomElement& elt)
-{
- return KisNodeQueryPath::fromString(elt.attribute("path"));
-}
diff --git a/libs/image/recorder/kis_recorded_paint_action.h b/libs/image/recorder/kis_recorded_paint_action.h
deleted file mode 100644
index 68b33119bb..0000000000
--- a/libs/image/recorder/kis_recorded_paint_action.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2007,2010 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_RECORDED_PAINT_ACTION_H_
-#define _KIS_RECORDED_PAINT_ACTION_H_
-
-#include "recorder/kis_recorded_node_action.h"
-#include "kis_types.h"
-#include "kis_painter.h"
-
-class KisPainter;
-class KoColor;
-
-#include
-
-/**
- * Base class for paint action.
- */
-class KRITAIMAGE_EXPORT KisRecordedPaintAction : public KisRecordedNodeAction
-{
-public:
-
- KisRecordedPaintAction(const QString & id,
- const QString & name,
- const KisNodeQueryPath& path,
- KisPaintOpPresetSP paintOpPreset);
-
- KisRecordedPaintAction(const KisRecordedPaintAction&);
-
- ~KisRecordedPaintAction() override;
-
- void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const override;
-
- using KisRecordedNodeAction::play;
- void play(KisNodeSP node, const KisPlayInfo& info, KoUpdater* _updater = 0) const override;
-
-protected:
- /**
- * This function will create a painter for the given device. The default
- * implementation creates a KisPainter, subclass can reimplement it if
- * they want to use one of the subclass of KisPainter.
- */
- virtual KisPainter* createPainter(KisPaintDeviceSP device) const;
- /**
- * Reimplement this function in a subclass to play the painting.
- */
- virtual void playPaint(const KisPlayInfo&, KisPainter* painter) const = 0;
-
-public:
- KisPaintOpPresetSP paintOpPreset() const;
- void setPaintOpPreset(KisPaintOpPresetSP preset);
- /**
- * @return the opacity in the range 0.0->1.0
- */
- qreal opacity() const;
- void setOpacity(qreal );
- KoColor paintColor() const;
- void setPaintColor(const KoColor& color);
- KoColor backgroundColor() const;
- void setBackgroundColor(const KoColor& color);
- QString compositeOp();
- void setCompositeOp(const QString& );
- void setPaintIncremental(bool );
- void setStrokeStyle(KisPainter::StrokeStyle );
- void setFillStyle(KisPainter::FillStyle );
- KisPainter::FillStyle fillStyle() const;
- void setPattern(const KoPattern* );
- void setGradient(const KoAbstractGradient* gradient);
- void setGenerator(const KisFilterConfigurationSP generator);
-private:
-
- struct Private;
- Private* const d;
-};
-
-class KisRecordedPaintActionFactory : public KisRecordedActionFactory
-{
-public:
- KisRecordedPaintActionFactory(const QString & id) : KisRecordedActionFactory(id) {}
- ~KisRecordedPaintActionFactory() override {}
-protected:
-
- void setupPaintAction(KisRecordedPaintAction* action, const QDomElement& elt, const KisRecordedActionLoadContext*);
- KisPaintOpPresetSP paintOpPresetFromXML(const QDomElement& elt);
- KoColor paintColorFromXML(const QDomElement& elt);
- KoColor backgroundColorFromXML(const QDomElement& elt);
- KoColor colorFromXML(const QDomElement& elt, const QString& elementName);
- qreal opacityFromXML(const QDomElement& elt);
- bool paintIncrementalFromXML(const QDomElement& elt);
- QString compositeOpFromXML(const QDomElement& elt);
- KisNodeQueryPath nodeQueryPathFromXML(const QDomElement& elt);
-};
-
-
-#endif
diff --git a/libs/image/recorder/kis_recorded_path_paint_action.cpp b/libs/image/recorder/kis_recorded_path_paint_action.cpp
deleted file mode 100644
index a4951a5194..0000000000
--- a/libs/image/recorder/kis_recorded_path_paint_action.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright (c) 2007 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include //MSVC requires that Vc come first
-#include "recorder/kis_recorded_path_paint_action.h"
-#include
-#include
-
-#include
-#include
-#include
-#include "kis_node.h"
-#include "kis_mask_generator.h"
-#include "kis_painter.h"
-#include
-#include "kis_paintop_registry.h"
-#include "recorder/kis_recorded_action_factory_registry.h"
-#include "kis_transaction.h"
-#include "kis_undo_adapter.h"
-#include
-#include
-#include "kis_paint_device.h"
-#include "kis_image.h"
-#include "kis_layer.h"
-#include "kis_node_query_path.h"
-#include
-
-struct Q_DECL_HIDDEN KisRecordedPathPaintAction::Private {
- struct BezierCurveSlice {
- enum Type {
- Point,
- Line,
- Curve
- };
- Type type;
- KisPaintInformation point1;
- QPointF control1;
- QPointF control2;
- KisPaintInformation point2;
- };
-
- Private(const KisDistanceInitInfo &startDistInfo) :
- startDistInfo(startDistInfo) {}
-
- QList curveSlices;
-
- // Information about distance and spacing at the start of the action.
- KisDistanceInitInfo startDistInfo;
-};
-
-KisRecordedPathPaintAction::KisRecordedPathPaintAction(
- const KisNodeQueryPath& path,
- const KisPaintOpPresetSP preset,
- const KisDistanceInitInfo& startDistInfo)
- : KisRecordedPaintAction("PathPaintAction", i18n("Path"), path, preset)
- , d(new Private(startDistInfo))
-{
-}
-
-KisRecordedPathPaintAction::KisRecordedPathPaintAction(const KisRecordedPathPaintAction& rhs) : KisRecordedPaintAction(rhs), d(new Private(*rhs.d))
-{
-
-}
-
-KisRecordedPathPaintAction::~KisRecordedPathPaintAction()
-{
- delete d;
-}
-
-KisDistanceInitInfo KisRecordedPathPaintAction::getInitDistInfo() const
-{
- return d->startDistInfo;
-}
-
-void KisRecordedPathPaintAction::setInitDistInfo(const KisDistanceInitInfo &startDistInfo)
-{
- d->startDistInfo = startDistInfo;
-}
-
-void KisRecordedPathPaintAction::addPoint(const KisPaintInformation& info)
-{
- Private::BezierCurveSlice slice;
- slice.type = Private::BezierCurveSlice::Point;
- slice.point1 = info;
- d->curveSlices.append(slice);
-}
-
-void KisRecordedPathPaintAction::addLine(const KisPaintInformation& point1, const KisPaintInformation& point2)
-{
- Private::BezierCurveSlice slice;
- slice.type = Private::BezierCurveSlice::Line;
- slice.point1 = point1;
- slice.point2 = point2;
- d->curveSlices.append(slice);
-}
-
-void KisRecordedPathPaintAction::addPolyLine(const QList& points)
-{
- QPointF previousPoint = points[0];
- for(int i = 1; i < points.size(); ++i) {
- QPointF pt = points[i];
- addLine(KisPaintInformation(previousPoint), KisPaintInformation(pt));
- previousPoint = pt;
- }
-}
-
-
-void KisRecordedPathPaintAction::addCurve(const KisPaintInformation& point1,
- const QPointF& control1,
- const QPointF& control2,
- const KisPaintInformation& point2)
-{
- Private::BezierCurveSlice slice;
- slice.type = Private::BezierCurveSlice::Curve;
- slice.point1 = point1;
- slice.control1 = control1;
- slice.control2 = control2;
- slice.point2 = point2;
- d->curveSlices.append(slice);
-}
-
-void KisRecordedPathPaintAction::playPaint(const KisPlayInfo&, KisPainter* painter) const
-{
- dbgImage << "play path paint action with " << d->curveSlices.size() << " slices";
- if (d->curveSlices.size() <= 0) return;
-
- KisDistanceInformation savedDist = d->startDistInfo.makeDistInfo();
-
- Q_FOREACH (const Private::BezierCurveSlice &slice, d->curveSlices)
- {
- switch(slice.type)
- {
- case Private::BezierCurveSlice::Point:
- painter->paintAt(slice.point1, &savedDist);
- break;
- case Private::BezierCurveSlice::Line:
- painter->paintLine(slice.point1, slice.point2, &savedDist);
- break;
- case Private::BezierCurveSlice::Curve:
- painter->paintBezierCurve(slice.point1, slice.control1, slice.control2, slice.point2, &savedDist);
- break;
- }
- }
-}
-
-void KisRecordedPathPaintAction::toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* context) const
-{
- KisRecordedPaintAction::toXML(doc, elt, context);
- QDomElement waypointsElt = doc.createElement("Slices");
- Q_FOREACH (const Private::BezierCurveSlice & slice, d->curveSlices) {
- switch(slice.type)
- {
- case Private::BezierCurveSlice::Point:
- {
- QDomElement infoElt = doc.createElement("Point");
- slice.point1.toXML(doc, infoElt);
-
- waypointsElt.appendChild(infoElt);
- break;
- }
- case Private::BezierCurveSlice::Line:
- {
- QDomElement infoElt = doc.createElement("Line");
- // Point1
- QDomElement point1Elt = doc.createElement("Point1");
- slice.point1.toXML(doc, point1Elt);
- infoElt.appendChild(point1Elt);
- // Point2
- QDomElement point2Elt = doc.createElement("Point2");
- slice.point2.toXML(doc, point2Elt);
- infoElt.appendChild(point2Elt);
-
- waypointsElt.appendChild(infoElt);
- break;
- }
- case Private::BezierCurveSlice::Curve:
- {
- QDomElement infoElt = doc.createElement("Curve");
- // Point1
- QDomElement point1Elt = doc.createElement("Point1");
- slice.point1.toXML(doc, point1Elt);
- infoElt.appendChild(point1Elt);
- // Control1
- QDomElement control1Elt = doc.createElement("Control1");
- control1Elt.setAttribute("x", KisDomUtils::toString(slice.control1.x()));
- control1Elt.setAttribute("y", KisDomUtils::toString(slice.control1.y()));
- infoElt.appendChild(control1Elt);
- // Control2
- QDomElement control2Elt = doc.createElement("Control2");
- control2Elt.setAttribute("x", KisDomUtils::toString(slice.control2.x()));
- control2Elt.setAttribute("y", KisDomUtils::toString(slice.control2.y()));
- infoElt.appendChild(control2Elt);
- // Point2
- QDomElement point2Elt = doc.createElement("Point2");
- slice.point2.toXML(doc, point2Elt);
- infoElt.appendChild(point2Elt);
-
- waypointsElt.appendChild(infoElt);
- }
- }
- }
- elt.appendChild(waypointsElt);
-
- QDomElement initDistElt = doc.createElement("StartDistInfo");
- d->startDistInfo.toXML(doc, initDistElt);
- elt.appendChild(initDistElt);
-}
-
-KisRecordedAction* KisRecordedPathPaintAction::clone() const
-{
- return new KisRecordedPathPaintAction(*this);
-}
-
-
-KisRecordedPathPaintActionFactory::KisRecordedPathPaintActionFactory() :
- KisRecordedPaintActionFactory("PathPaintAction")
-{
-}
-
-KisRecordedPathPaintActionFactory::~KisRecordedPathPaintActionFactory()
-{
-
-}
-
-KisRecordedAction* KisRecordedPathPaintActionFactory::fromXML(const QDomElement& elt, const KisRecordedActionLoadContext* context)
-{
- KisNodeQueryPath pathnode = nodeQueryPathFromXML(elt);
-
- // Decode pressets
- KisPaintOpPresetSP paintOpPreset = paintOpPresetFromXML(elt);
-
- KisRecordedPathPaintAction* rplpa = new KisRecordedPathPaintAction(pathnode, paintOpPreset,
- KisDistanceInitInfo());
-
- setupPaintAction(rplpa, elt, context);
-
- QDomElement wpElt = elt.firstChildElement("Slices");
- if (!wpElt.isNull()) {
- QDomNode nWp = wpElt.firstChild();
- while (!nWp.isNull()) {
- QDomElement eWp = nWp.toElement();
- if (!eWp.isNull()) {
- if( eWp.tagName() == "Point") {
- rplpa->addPoint(KisPaintInformation::fromXML(eWp));
- } else if(eWp.tagName() == "Line") {
- rplpa->addLine(KisPaintInformation::fromXML(eWp.firstChildElement("Point1")),
- KisPaintInformation::fromXML(eWp.firstChildElement("Point2")));
- } else if( eWp.tagName() == "Curve") {
- QDomElement control1Elt = eWp.firstChildElement("Control1");
- QDomElement control2Elt = eWp.firstChildElement("Control2");
- rplpa->addCurve(KisPaintInformation::fromXML(eWp.firstChildElement("Point1")),
- QPointF(KisDomUtils::toDouble(control1Elt.attribute("x", "0.0")),
- KisDomUtils::toDouble(control1Elt.attribute("y", "0.0"))),
- QPointF(KisDomUtils::toDouble(control2Elt.attribute("x", "0.0")),
- KisDomUtils::toDouble(control2Elt.attribute("y", "0.0"))),
- KisPaintInformation::fromXML(eWp.firstChildElement("Point2")));
- } else {
- dbgImage << "Unsupported <" << eWp.tagName() << " /> element";
- }
- }
- nWp = nWp.nextSibling();
- }
- } else {
- dbgImage << "Warning: no found";
- }
-
- QDomElement initDistInfoElt = elt.firstChildElement("StartDistInfo");
- if (!initDistInfoElt.isNull()) {
- rplpa->setInitDistInfo(KisDistanceInitInfo::fromXML(initDistInfoElt));
- } else {
- dbgImage << "Warning: no found";
- }
-
- return rplpa;
-}
-
-
diff --git a/libs/image/recorder/kis_recorded_path_paint_action.h b/libs/image/recorder/kis_recorded_path_paint_action.h
deleted file mode 100644
index 607eb47ccc..0000000000
--- a/libs/image/recorder/kis_recorded_path_paint_action.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2007 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_RECORDED_PATH_PAINT_ACTIONS_H_
-#define _KIS_RECORDED_PATH_PAINT_ACTIONS_H_
-
-#include "recorder/kis_recorded_action.h"
-#include "recorder/kis_recorded_paint_action.h"
-#include "kis_types.h"
-
-class KisPaintInformation;
-class KisPainter;
-class KisDistanceInitInfo;
-
-#include
-
-/**
- * This class will record the painting of a bezier curve.
- */
-class KRITAIMAGE_EXPORT KisRecordedPathPaintAction : public KisRecordedPaintAction
-{
-
-public:
-
- /**
- * @param startDist - Provides initial information related to distance and spacing, which can
- * have an effect on how the path is painted.
- */
- KisRecordedPathPaintAction(const KisNodeQueryPath& path,
- const KisPaintOpPresetSP paintOpPreset,
- const KisDistanceInitInfo& startDistInfo);
-
- KisRecordedPathPaintAction(const KisRecordedPathPaintAction&);
-
- ~KisRecordedPathPaintAction() override;
-
- KisDistanceInitInfo getInitDistInfo() const;
-
- void setInitDistInfo(const KisDistanceInitInfo &startDistInfo);
-
- void addPoint(const KisPaintInformation& info);
- void addLine(const KisPaintInformation& point1, const KisPaintInformation& point2);
- void addPolyLine(const QList& points);
- void addCurve(const KisPaintInformation& point1,
- const QPointF& control1,
- const QPointF& control2,
- const KisPaintInformation& point2);
-
- void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const override;
-
- KisRecordedAction* clone() const override;
-
-protected:
-
- void playPaint(const KisPlayInfo& info, KisPainter* painter) const override;
-
-private:
-
- struct Private;
- Private* const d;
-};
-
-
-class KisRecordedPathPaintActionFactory : public KisRecordedPaintActionFactory
-{
-public:
- KisRecordedPathPaintActionFactory();
- ~KisRecordedPathPaintActionFactory() override;
- KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*) override;
-};
-
-#endif
diff --git a/libs/image/recorder/kis_recorded_shape_paint_action.cpp b/libs/image/recorder/kis_recorded_shape_paint_action.cpp
deleted file mode 100644
index ea48b426d8..0000000000
--- a/libs/image/recorder/kis_recorded_shape_paint_action.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2010 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include //MSVC requires that Vc come first
-
-#include "recorder/kis_recorded_shape_paint_action.h"
-
-#include
-#include
-
-#include
-#include
-#include
-#include "kis_node.h"
-#include "kis_mask_generator.h"
-#include "kis_painter.h"
-#include
-#include "kis_paintop_registry.h"
-#include "recorder/kis_recorded_action_factory_registry.h"
-#include "kis_transaction.h"
-#include "kis_undo_adapter.h"
-#include
-#include
-#include "kis_paint_device.h"
-#include "kis_image.h"
-#include "kis_layer.h"
-#include "kis_node_query_path.h"
-#include
-
-struct Q_DECL_HIDDEN KisRecordedShapePaintAction::Private {
- Shape shape;
- QRectF rectangle;
-};
-
-QString selectName(KisRecordedShapePaintAction::Shape s)
-{
- switch(s)
- {
- case KisRecordedShapePaintAction::Ellipse:
- return i18n("Ellipse");
- case KisRecordedShapePaintAction::Rectangle:
- return i18n("Rectangle");
- }
- return QString();
-}
-
-KisRecordedShapePaintAction::KisRecordedShapePaintAction(
- const KisNodeQueryPath& path,
- const KisPaintOpPresetSP preset,
- Shape shape,
- const QRectF& rect)
- : KisRecordedPaintAction("ShapePaintAction", selectName(shape), path, preset)
- , d(new Private)
-{
- d->shape = shape;
- d->rectangle = rect;
-}
-
-KisRecordedShapePaintAction::KisRecordedShapePaintAction(const KisRecordedShapePaintAction& rhs) : KisRecordedPaintAction(rhs), d(new Private(*rhs.d))
-{
-
-}
-
-KisRecordedShapePaintAction::~KisRecordedShapePaintAction()
-{
- delete d;
-}
-
-void KisRecordedShapePaintAction::playPaint(const KisPlayInfo&, KisPainter* painter) const
-{
- switch(d->shape)
- {
- case Ellipse:
- painter->paintEllipse(d->rectangle);
- break;
- case Rectangle:
- painter->paintRect(d->rectangle);
- break;
- }
-}
-
-void KisRecordedShapePaintAction::toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* context) const
-{
- KisRecordedPaintAction::toXML(doc, elt, context);
- QDomElement rectangleElt = doc.createElement("Rectangle");
- rectangleElt.setAttribute("x", KisDomUtils::toString(d->rectangle.x()));
- rectangleElt.setAttribute("y", KisDomUtils::toString(d->rectangle.y()));
- rectangleElt.setAttribute("width", KisDomUtils::toString(d->rectangle.width()));
- rectangleElt.setAttribute("height", KisDomUtils::toString(d->rectangle.height()));
- elt.appendChild(rectangleElt);
- switch(d->shape)
- {
- case Ellipse:
- elt.setAttribute("shape", "Ellipse");
- break;
- case Rectangle:
- elt.setAttribute("shape", "Rectangle");
- break;
- }
-}
-
-KisRecordedAction* KisRecordedShapePaintAction::clone() const
-{
- return new KisRecordedShapePaintAction(*this);
-}
-
-
-KisRecordedShapePaintActionFactory::KisRecordedShapePaintActionFactory() :
- KisRecordedPaintActionFactory("ShapePaintAction")
-{
-}
-
-KisRecordedShapePaintActionFactory::~KisRecordedShapePaintActionFactory()
-{
-
-}
-
-KisRecordedAction* KisRecordedShapePaintActionFactory::fromXML(const QDomElement& elt, const KisRecordedActionLoadContext* context)
-{
- KisNodeQueryPath pathnode = nodeQueryPathFromXML(elt);
-
- // Decode pressets
- KisPaintOpPresetSP paintOpPreset = paintOpPresetFromXML(elt);
-
- QDomElement ellipseElt = elt.firstChildElement("Rectangle");
- qreal x, y, width, height;
- if (!ellipseElt.isNull()) {
- x = KisDomUtils::toDouble(ellipseElt.attribute("x", "0.0"));
- y = KisDomUtils::toDouble(ellipseElt.attribute("y", "0.0"));
- width = KisDomUtils::toDouble(ellipseElt.attribute("width", "0.0"));
- height = KisDomUtils::toDouble(ellipseElt.attribute("height", "0.0"));
- }
- else {
- x = 0;
- y = 0;
- width = 0;
- height = 0;
- dbgImage << "Warning: no found";
- }
-
- KisRecordedShapePaintAction::Shape shape = KisRecordedShapePaintAction::Ellipse;
- QString shapeStr = elt.attribute("shape", "Ellipse");
- if (shapeStr == "Ellipse")
- {
- shape = KisRecordedShapePaintAction::Ellipse;
- } else { // shapeStr == "Rectangle"
- shape = KisRecordedShapePaintAction::Rectangle;
- }
-
- KisRecordedShapePaintAction* rplpa = new KisRecordedShapePaintAction(pathnode, paintOpPreset, shape, QRectF(x, y, width, height));
-
- setupPaintAction(rplpa, elt, context);
- return rplpa;
-}
diff --git a/libs/image/recorder/kis_recorded_shape_paint_action.h b/libs/image/recorder/kis_recorded_shape_paint_action.h
deleted file mode 100644
index cc190ed8d0..0000000000
--- a/libs/image/recorder/kis_recorded_shape_paint_action.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2010 Cyrille Berger
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _KIS_RECORDED_ELLIPSE_PAINT_ACTION_H_
-#define _KIS_RECORDED_ELLIPSE_PAINT_ACTION_H_
-
-#include "recorder/kis_recorded_action.h"
-#include "recorder/kis_recorded_paint_action.h"
-#include "kis_types.h"
-
-#include
-
-/**
- * This class will record the painting of a bezier curve.
- */
-class KRITAIMAGE_EXPORT KisRecordedShapePaintAction : public KisRecordedPaintAction
-{
-public:
- enum Shape {
- Ellipse,
- Rectangle
- };
-public:
-
- KisRecordedShapePaintAction(const KisNodeQueryPath& path,
- const KisPaintOpPresetSP paintOpPreset,
- Shape shape,
- const QRectF& rect);
-
- KisRecordedShapePaintAction(const KisRecordedShapePaintAction&);
-
- ~KisRecordedShapePaintAction() override;
-
- void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const override;
-
- KisRecordedAction* clone() const override;
-
-protected:
-
- void playPaint(const KisPlayInfo& info, KisPainter* painter) const override;
-
-private:
-
- struct Private;
- Private* const d;
-};
-
-
-class KisRecordedShapePaintActionFactory : public KisRecordedPaintActionFactory
-{
-public:
- KisRecordedShapePaintActionFactory();
- ~KisRecordedShapePaintActionFactory() override;
- KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*) override;
-};
-
-#endif
diff --git a/libs/image/tests/CMakeLists.txt b/libs/image/tests/CMakeLists.txt
index 979f93f1dd..aff2df122c 100644
--- a/libs/image/tests/CMakeLists.txt
+++ b/libs/image/tests/CMakeLists.txt
@@ -1,248 +1,244 @@
# cmake in some versions for some not yet known reasons fails to run automoc
# on random targets (changing target names already has an effect)
# As temporary workaround skipping build of tests on these versions for now
# See https://mail.kde.org/pipermail/kde-buildsystem/2015-June/010819.html
# extend range of affected cmake versions as needed
if(NOT ${CMAKE_VERSION} VERSION_LESS 3.1.3 AND
NOT ${CMAKE_VERSION} VERSION_GREATER 3.2.3)
message(WARNING "Skipping krita/image/tests, CMake in at least versions 3.1.3 - 3.2.3 seems to have a problem with automoc. \n(FRIENDLY REMINDER: PLEASE DON'T BREAK THE TESTS!)")
set (HAVE_FAILING_CMAKE TRUE)
else()
set (HAVE_FAILING_CMAKE FALSE)
endif()
include_directories(
${CMAKE_SOURCE_DIR}/libs/image/metadata
${CMAKE_BINARY_DIR}/libs/image/
${CMAKE_SOURCE_DIR}/libs/image/
${CMAKE_SOURCE_DIR}/libs/image/brushengine
${CMAKE_SOURCE_DIR}/libs/image/tiles3
${CMAKE_SOURCE_DIR}/libs/image/tiles3/swap
${CMAKE_SOURCE_DIR}/sdk/tests
)
include_Directories(SYSTEM
${EIGEN3_INCLUDE_DIR}
)
if(HAVE_VC)
include_directories(${Vc_INCLUDE_DIR})
endif()
include(ECMAddTests)
include(KritaAddBrokenUnitTest)
macro_add_unittest_definitions()
set(KisRandomGeneratorDemoSources kis_random_generator_demo.cpp kimageframe.cpp)
ki18n_wrap_ui(KisRandomGeneratorDemoSources kis_random_generator_demo.ui)
add_executable(KisRandomGeneratorDemo ${KisRandomGeneratorDemoSources})
target_link_libraries(KisRandomGeneratorDemo kritaimage)
ecm_mark_as_test(KisRandomGeneratorDemo)
ecm_add_tests(
kis_base_node_test.cpp
kis_fast_math_test.cpp
kis_node_test.cpp
kis_node_facade_test.cpp
kis_fixed_paint_device_test.cpp
kis_layer_test.cpp
kis_effect_mask_test.cpp
kis_iterator_test.cpp
kis_painter_test.cpp
kis_selection_test.cpp
kis_count_visitor_test.cpp
kis_projection_test.cpp
kis_properties_configuration_test.cpp
kis_transaction_test.cpp
kis_pixel_selection_test.cpp
kis_group_layer_test.cpp
kis_paint_layer_test.cpp
kis_adjustment_layer_test.cpp
kis_annotation_test.cpp
kis_change_profile_visitor_test.cpp
kis_clone_layer_test.cpp
kis_colorspace_convert_visitor_test.cpp
kis_convolution_painter_test.cpp
kis_crop_processing_visitor_test.cpp
kis_processing_applicator_test.cpp
kis_datamanager_test.cpp
kis_fill_painter_test.cpp
kis_filter_configuration_test.cpp
kis_filter_test.cpp
kis_filter_processing_information_test.cpp
kis_filter_registry_test.cpp
kis_filter_strategy_test.cpp
kis_gradient_painter_test.cpp
kis_image_commands_test.cpp
kis_image_test.cpp
kis_image_signal_router_test.cpp
kis_iterators_ng_test.cpp
kis_iterator_benchmark.cpp
kis_updater_context_test.cpp
kis_simple_update_queue_test.cpp
kis_stroke_test.cpp
kis_simple_stroke_strategy_test.cpp
kis_stroke_strategy_undo_command_based_test.cpp
kis_strokes_queue_test.cpp
- kis_macro_test.cpp
kis_mask_test.cpp
kis_math_toolbox_test.cpp
kis_name_server_test.cpp
kis_node_commands_test.cpp
kis_node_graph_listener_test.cpp
kis_node_visitor_test.cpp
kis_paint_information_test.cpp
kis_distance_information_test.cpp
kis_paintop_test.cpp
kis_pattern_test.cpp
- kis_recorded_action_factory_registry_test.cpp
- kis_recorded_action_test.cpp
- kis_recorded_filter_action_test.cpp
kis_selection_mask_test.cpp
kis_shared_ptr_test.cpp
kis_bsplines_test.cpp
kis_warp_transform_worker_test.cpp
kis_liquify_transform_worker_test.cpp
kis_transparency_mask_test.cpp
kis_types_test.cpp
kis_vec_test.cpp
kis_filter_config_widget_test.cpp
kis_mask_generator_test.cpp
kis_cubic_curve_test.cpp
- kis_node_query_path_test.cpp
kis_fixed_point_maths_test.cpp
+ kis_node_query_path_test.cpp
kis_filter_weights_buffer_test.cpp
kis_filter_weights_applicator_test.cpp
kis_fill_interval_test.cpp
kis_fill_interval_map_test.cpp
kis_scanline_fill_test.cpp
kis_psd_layer_style_test.cpp
kis_layer_style_projection_plane_test.cpp
kis_lod_capable_layer_offset_test.cpp
kis_algebra_2d_test.cpp
kis_marker_painter_test.cpp
kis_lazy_brush_test.cpp
kis_colorize_mask_test.cpp
kis_mask_similarity_test.cpp
KisMaskGeneratorBenchmark.cpp
NAME_PREFIX "krita-image-"
LINK_LIBRARIES kritaimage Qt5::Test)
ecm_add_test(kis_layer_style_filter_environment_test.cpp
TEST_NAME kritaimage-layer_style_filter_environment_test
LINK_LIBRARIES ${KDE4_KDEUI_LIBS} kritaimage Qt5::Test)
ecm_add_test(kis_asl_parser_test.cpp
TEST_NAME kritalibpsd-asl_parser_test
LINK_LIBRARIES kritapsd kritapigment kritawidgetutils kritacommand Qt5::Xml Qt5::Test)
ecm_add_test(KisPerStrokeRandomSourceTest.cpp
TEST_NAME KisPerStrokeRandomSourceTest
LINK_LIBRARIES kritaimage Qt5::Test)
ecm_add_test(KisWatershedWorkerTest.cpp
TEST_NAME KisWatershedWorkerTest
LINK_LIBRARIES kritaimage Qt5::Test)
# ecm_add_test(kis_dom_utils_test.cpp
# TEST_NAME krita-image-DomUtils-Test
# LINK_LIBRARIES kritaimage Qt5::Test)
# kisdoc dep
# kis_transform_worker_test.cpp
# TEST_NAME krita-image-KisTransformWorkerTest
#LINK_LIBRARIES kritaimage Qt5::Test)
# kisdoc
# kis_perspective_transform_worker_test.cpp
# TEST_NAME krita-image-KisPerspectiveTransformWorkerTest
#LINK_LIBRARIES kritaimage Qt5::Test)
# kis_cs_conversion_test.cpp
# TEST_NAME krita-image-KisCsConversionTest
# LINK_LIBRARIES kritaimage Qt5::Test)
# kisdoc
# kis_processings_test.cpp
# TEST_NAME krita-image-KisProcessingsTest
#LINK_LIBRARIES kritaimage Qt5::Test)
# image/tests cannot use stuff that needs kisdocument
# kis_projection_leaf_test.cpp
# TEST_NAME kritaimage-projection_leaf_test
# LINK_LIBRARIES kritaimage Qt5::Test)
if (NOT HAVE_FAILING_CMAKE)
krita_add_broken_unit_test(kis_paint_device_test.cpp
TEST_NAME krita-image-KisPaintDeviceTest
LINK_LIBRARIES kritaimage kritaodf Qt5::Test)
else()
message(WARNING "Skipping KisPaintDeviceTest!!!!!!!!!!!!!!")
endif()
if (NOT HAVE_FAILING_CMAKE)
krita_add_broken_unit_test(kis_filter_mask_test.cpp
TEST_NAME krita-image-KisFilterMaskTest
LINK_LIBRARIES kritaimage Qt5::Test)
else()
message(WARNING "Skipping KisFilterMaskTest!!!!!!!!!!!!!!")
endif()
krita_add_broken_unit_test(kis_transform_mask_test.cpp
TEST_NAME krita-image-KisTransformMaskTest
LINK_LIBRARIES kritaimage Qt5::Test)
krita_add_broken_unit_test(kis_histogram_test.cpp
TEST_NAME krita-image-KisHistogramTest
LINK_LIBRARIES kritaimage Qt5::Test)
krita_add_broken_unit_test(kis_walkers_test.cpp
TEST_NAME krita-image-KisWalkersTest
LINK_LIBRARIES kritaimage Qt5::Test)
#krita_add_broken_unit_test(kis_async_merger_test.cpp
# TEST_NAME krita-image-KisAsyncMergerTest
# LINK_LIBRARIES kritaimage Qt5::Test)
krita_add_broken_unit_test(kis_update_scheduler_test.cpp
TEST_NAME krita-image-KisUpdateSchedulerTest
LINK_LIBRARIES kritaimage Qt5::Test)
krita_add_broken_unit_test(kis_queues_progress_updater_test.cpp
TEST_NAME krita-image-KisQueuesProgressUpdaterTest
LINK_LIBRARIES kritaimage Qt5::Test)
krita_add_broken_unit_test(kis_cage_transform_worker_test.cpp
TEST_NAME krita-image-KisCageTransformWorkerTest
LINK_LIBRARIES kritaimage Qt5::Test)
krita_add_broken_unit_test(kis_meta_data_test.cpp
TEST_NAME krita-image-KisMetaDataTest
LINK_LIBRARIES kritaimage Qt5::Test)
krita_add_broken_unit_test(kis_random_generator_test.cpp
TEST_NAME krita-image-KisRandomGeneratorTest
LINK_LIBRARIES kritaimage Qt5::Test)
krita_add_broken_unit_test(kis_keyframing_test.cpp
TEST_NAME krita-image-Keyframing-Test
LINK_LIBRARIES kritaimage Qt5::Test)
krita_add_broken_unit_test(kis_image_animation_interface_test.cpp
TEST_NAME krita-image-ImageAnimationInterface-Test
LINK_LIBRARIES ${KDE4_KDEUI_LIBS} kritaimage Qt5::Test)
krita_add_broken_unit_test(kis_onion_skin_compositor_test.cpp
TEST_NAME krita-image-OnionSkinCompositor-Test
LINK_LIBRARIES ${KDE4_KDEUI_LIBS} kritaimage Qt5::Test)
krita_add_broken_unit_test(kis_layer_styles_test.cpp
TEST_NAME krita-image-LayerStylesTest
LINK_LIBRARIES kritaimage Qt5::Test)
diff --git a/libs/image/tests/kis_macro_test.cpp b/libs/image/tests/kis_macro_test.cpp
deleted file mode 100644
index b921304a09..0000000000
--- a/libs/image/tests/kis_macro_test.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_macro_test.h"
-
-#include
-#include "recorder/kis_macro.h"
-#include
-#include
-#include "kis_image.h"
-
-#include "recorder/kis_recorded_action.h"
-#include
-
-class TestAction : public KisRecordedAction
-{
-public:
-
- TestAction(const QString & id, const QString & name)
- : KisRecordedAction(id, name) {
- }
-
- void play(const KisPlayInfo&, KoUpdater*) const override {
- }
-
- KisRecordedAction* clone() const override {
- return new TestAction(id(), name());
- }
-
-};
-
-
-void KisMacroTest::testCreation()
-{
- QList actions;
- TestAction tc("bla", "bla");
- actions << &tc;
-
- const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
- KisImageSP image = new KisImage(0, 512, 512, cs, "test");
-
- KisMacro a;
- KisMacro b(actions);
-}
-
-
-QTEST_MAIN(KisMacroTest)
diff --git a/libs/image/tests/kis_macro_test.h b/libs/image/tests/kis_macro_test.h
deleted file mode 100644
index 8c8099195d..0000000000
--- a/libs/image/tests/kis_macro_test.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef KIS_MACRO_TEST_H
-#define KIS_MACRO_TEST_H
-
-#include
-
-class KisMacroTest : public QObject
-{
- Q_OBJECT
-private Q_SLOTS:
-
- void testCreation();
-
-};
-
-#endif
diff --git a/libs/image/tests/kis_node_query_path_test.cpp b/libs/image/tests/kis_node_query_path_test.cpp
index 6a77305b28..a694526048 100644
--- a/libs/image/tests/kis_node_query_path_test.cpp
+++ b/libs/image/tests/kis_node_query_path_test.cpp
@@ -1,100 +1,100 @@
/*
* Copyright (c) 2010 Cyrille Berger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_node_query_path_test.h"
#include
-#include "recorder/kis_node_query_path.h"
+#include "kis_node_query_path.h"
#include
#include
#include
#include
#include
KisNodeQueryPathTest::KisNodeQueryPathTest()
{
image = new KisImage(0, 100, 100, KoColorSpaceRegistry::instance()->rgb8(), "");
current = new KisGroupLayer(image, "", OPACITY_OPAQUE_U8);
child1 = new KisPaintLayer(image, "", OPACITY_OPAQUE_U8);
child2 = new KisPaintLayer(image, "", OPACITY_OPAQUE_U8);
image->addNode(child1, current);
image->addNode(child2, current);
parent = new KisGroupLayer(image, "", OPACITY_OPAQUE_U8);
brother1 = new KisPaintLayer(image, "", OPACITY_OPAQUE_U8);
brother2 = new KisPaintLayer(image, "", OPACITY_OPAQUE_U8);
image->addNode(brother1, parent);
image->addNode(current, parent);
image->addNode(brother2, parent);
image->addNode(parent, image->rootLayer());
}
#define TESTS(name, relativeStr, absoluteStr1, absoluteStr2, node) \
void KisNodeQueryPathTest::test##name##LayerFromRelativeString() \
{ \
KisNodeQueryPath path = KisNodeQueryPath::fromString(relativeStr); \
QCOMPARE(path.toString(), QString(relativeStr)); \
QList nodes = path.queryNodes(image, current); \
QCOMPARE(nodes.size(), 1); \
QCOMPARE(nodes[0], node); \
} \
\
void KisNodeQueryPathTest::test##name##LayerFromAbsoluteString() \
{ \
{ \
KisNodeQueryPath path = KisNodeQueryPath::fromString(absoluteStr1); \
QCOMPARE(path.toString(), QString(absoluteStr1)); \
QList nodes = path.queryNodes(image, current); \
QCOMPARE(nodes.size(), 1); \
QCOMPARE(nodes[0], node); \
} \
{ \
KisNodeQueryPath path = KisNodeQueryPath::fromString(absoluteStr2); \
QCOMPARE(path.toString(), QString(absoluteStr2)); \
QList nodes = path.queryNodes(image, current); \
QCOMPARE(nodes.size(), 1); \
QCOMPARE(nodes[0], node); \
} \
} \
\
void KisNodeQueryPathTest::test##name##LayerFromAbsolutePath() \
{ \
KisNodeQueryPath path = KisNodeQueryPath::absolutePath(node); \
QCOMPARE(path.toString(), QString(absoluteStr1)); \
QList nodes = path.queryNodes(image, current); \
QCOMPARE(nodes.size(), 1); \
QCOMPARE(nodes[0], node); \
}
TESTS(Current, ".", "/0/1", "/*/1", current)
TESTS(Child1, "0", "/0/1/0", "/*/1/0", child1)
TESTS(Child2, "1", "/0/1/1", "/*/1/1", child2)
TESTS(Brother1, "../0", "/0/0", "/*/0", brother1)
TESTS(Brother2, "../2", "/0/2", "/*/2", brother2)
TESTS(Parent, "..", "/0", "/*", parent)
TESTS(Root, "../..", "/", "/", KisNodeSP(image->rootLayer()))
void KisNodeQueryPathTest::testPathCompression()
{
KisNodeQueryPath path = KisNodeQueryPath::fromString("1/../3/../5");
QCOMPARE(path.toString(), QString("5"));
KisNodeQueryPath path2 = KisNodeQueryPath::fromString("/*/..");
QCOMPARE(path2.toString(), QString("/"));
}
QTEST_MAIN(KisNodeQueryPathTest)
diff --git a/libs/image/tests/kis_recorded_action_factory_registry_test.cpp b/libs/image/tests/kis_recorded_action_factory_registry_test.cpp
deleted file mode 100644
index b6192ef6e2..0000000000
--- a/libs/image/tests/kis_recorded_action_factory_registry_test.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_recorded_action_factory_registry_test.h"
-
-#include
-#include "recorder/kis_recorded_action_factory_registry.h"
-
-void KisRecordedActionFactoryRegistryTest::testCreation()
-{
- KisRecordedActionFactoryRegistry test;
-}
-
-
-QTEST_MAIN(KisRecordedActionFactoryRegistryTest)
diff --git a/libs/image/tests/kis_recorded_action_factory_registry_test.h b/libs/image/tests/kis_recorded_action_factory_registry_test.h
deleted file mode 100644
index 1f76a93212..0000000000
--- a/libs/image/tests/kis_recorded_action_factory_registry_test.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef KIS_RECORDED_ACTION_FACTORY_REGISTRY_TEST_H
-#define KIS_RECORDED_ACTION_FACTORY_REGISTRY_TEST_H
-
-#include
-
-class KisRecordedActionFactoryRegistryTest : public QObject
-{
- Q_OBJECT
-private Q_SLOTS:
-
- void testCreation();
-
-};
-
-#endif
diff --git a/libs/image/tests/kis_recorded_action_test.cpp b/libs/image/tests/kis_recorded_action_test.cpp
deleted file mode 100644
index 5481427f56..0000000000
--- a/libs/image/tests/kis_recorded_action_test.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_recorded_action_test.h"
-
-#include
-#include
-#include "recorder/kis_recorded_action.h"
-#include
-
-class TestAction : public KisRecordedAction
-{
-public:
-
- TestAction(const QString & id, const QString & name)
- : KisRecordedAction(id, name) {
- }
-
- void play(const KisPlayInfo&, KoUpdater*) const override {
- }
-
- KisRecordedAction* clone() const override {
- return new TestAction(id(), name());
- }
-
-};
-
-
-void KisRecordedActionTest::testCreation()
-{
- TestAction tc("bla", "bla");
-}
-
-
-QTEST_MAIN(KisRecordedActionTest)
diff --git a/libs/image/tests/kis_recorded_action_test.h b/libs/image/tests/kis_recorded_action_test.h
deleted file mode 100644
index cc20fa40f4..0000000000
--- a/libs/image/tests/kis_recorded_action_test.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef KIS_RECORDED_ACTION_TEST_H
-#define KIS_RECORDED_ACTION_TEST_H
-
-#include
-
-class KisRecordedActionTest : public QObject
-{
- Q_OBJECT
-private Q_SLOTS:
-
- void testCreation();
-
-};
-
-#endif
diff --git a/libs/image/tests/kis_recorded_filter_action_test.cpp b/libs/image/tests/kis_recorded_filter_action_test.cpp
deleted file mode 100644
index 94677fcb8b..0000000000
--- a/libs/image/tests/kis_recorded_filter_action_test.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_recorded_filter_action_test.h"
-
-#include
-#include "recorder/kis_recorded_filter_action.h"
-#include
-#include
-#include "kis_paint_layer.h"
-#include "filter/kis_filter.h"
-#include "filter/kis_filter_configuration.h"
-#include "filter/kis_filter_registry.h"
-#include "kis_image.h"
-#include "kis_paint_device.h"
-#include
-
-void KisRecordedFilterActionTest::testCreation()
-{
- const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
- KisFilterSP f = KisFilterRegistry::instance()->value("invert");
- KisFilterConfigurationSP kfc = f->defaultConfiguration();
- KisImageSP image = new KisImage(0, 10, 10, cs, "merge test");
- KisPaintLayerSP layer = new KisPaintLayer(image, "test", OPACITY_OPAQUE_U8);
-
- KisRecordedFilterAction test("invert", KisNodeQueryPath::absolutePath(layer), f, kfc);
-}
-
-
-QTEST_MAIN(KisRecordedFilterActionTest)
diff --git a/libs/image/tests/kis_recorded_filter_action_test.h b/libs/image/tests/kis_recorded_filter_action_test.h
deleted file mode 100644
index f517964e67..0000000000
--- a/libs/image/tests/kis_recorded_filter_action_test.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef KIS_RECORDED_FILTER_ACTION_TEST_H
-#define KIS_RECORDED_FILTER_ACTION_TEST_H
-
-#include