diff --git a/krita/image/CMakeLists.txt b/krita/image/CMakeLists.txt index 6cc171d9221..9f6a13d34a0 100644 --- a/krita/image/CMakeLists.txt +++ b/krita/image/CMakeLists.txt @@ -1,390 +1,390 @@ add_subdirectory( tests ) ########### next target ############### add_definitions(${KDE4_ENABLE_EXCEPTIONS}) # Chose a tiles backend # 1 - image/tiles # 3 - image/tiles3 set(USE_TILESYSTEM 3) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-tiles.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/../config-tiles.h) ### WRONG PLACE??? if(USE_TILESYSTEM EQUAL 3) set(libkritatile_SRCS ${CMAKE_SOURCE_DIR}/krita/image/tiles3/kis_tile.cc ${CMAKE_SOURCE_DIR}/krita/image/tiles3/kis_tile_data.cc ${CMAKE_SOURCE_DIR}/krita/image/tiles3/kis_tile_data_store.cc ${CMAKE_SOURCE_DIR}/krita/image/tiles3/kis_tile_data_pooler.cc ${CMAKE_SOURCE_DIR}/krita/image/tiles3/kis_tiled_data_manager.cc ${CMAKE_SOURCE_DIR}/krita/image/tiles3/kis_memento_manager.cc ${CMAKE_SOURCE_DIR}/krita/image/tiles3/kis_hline_iterator.cpp ${CMAKE_SOURCE_DIR}/krita/image/tiles3/kis_vline_iterator.cpp ${CMAKE_SOURCE_DIR}/krita/image/tiles3/kis_random_accessor.cc ${CMAKE_SOURCE_DIR}/krita/image/tiles3/swap/kis_abstract_compression.cpp ${CMAKE_SOURCE_DIR}/krita/image/tiles3/swap/kis_lzf_compression.cpp ${CMAKE_SOURCE_DIR}/krita/image/tiles3/swap/kis_abstract_tile_compressor.cpp ${CMAKE_SOURCE_DIR}/krita/image/tiles3/swap/kis_legacy_tile_compressor.cpp ${CMAKE_SOURCE_DIR}/krita/image/tiles3/swap/kis_tile_compressor_2.cpp ${CMAKE_SOURCE_DIR}/krita/image/tiles3/swap/kis_chunk_allocator.cpp ${CMAKE_SOURCE_DIR}/krita/image/tiles3/swap/kis_memory_window.cpp ${CMAKE_SOURCE_DIR}/krita/image/tiles3/swap/kis_swapped_data_store.cpp ${CMAKE_SOURCE_DIR}/krita/image/tiles3/swap/kis_tile_data_swapper.cpp ) add_subdirectory( tiles3 ) endif() option(HAVE_MEMORY_LEAK_TRACKER "Enable memory leak tracker (always disabled in release build)" OFF) option(HAVE_BACKTRACE_SUPPORT "Enable recording of backtrace in memory leak tracker" OFF) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-memory-leak-tracker.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-memory-leak-tracker.h) ### WRONG PLACE??? include_directories( ${CMAKE_SOURCE_DIR}/krita/image/metadata 3rdparty ) if(FFTW3_FOUND) include_directories(${FFTW3_INCLUDE_DIR}) endif() if(HAVE_VC) include_directories(${Vc_INCLUDE_DIR}) 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 ${libkritatile_SRCS} kis_debug.cpp kis_distance_information.cpp kis_painter.cc kis_progress_updater.cpp brushengine/kis_paint_information.cc 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_locked_properties.cc brushengine/kis_locked_properties_proxy.cpp brushengine/kis_locked_properties_server.cpp commands/kis_deselect_global_selection_command.cpp commands/kis_image_change_layers_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_node_lower_command.cpp commands/kis_image_node_raise_command.cpp commands/kis_image_node_to_bottom_command.cpp commands/kis_image_node_to_top_command.cpp commands/kis_image_lock_command.cpp commands/kis_layer_command.cpp commands/kis_layer_props_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 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 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_basic_math_toolbox.cpp kis_bookmarked_configuration_manager.cc kis_clone_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_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 kis_stroke_job_strategy.cpp kis_stroke_strategy.cpp kis_stroke.cpp kis_strokes_queue.cpp kis_simple_update_queue.cpp kis_update_scheduler.cpp kis_queues_progress_updater.cpp kis_composite_progress_proxy.cpp kis_update_time_monitor.cpp kis_group_layer.cc kis_count_visitor.cpp kis_histogram.cc kis_image_interfaces.cpp kis_node_graph_listener.cpp kis_image.cc kis_image_signal_router.cpp kis_image_config.cpp kis_crop_saved_extra_data.cpp kis_signal_compressor.cpp kis_signal_compressor_with_param.cpp kis_thread_safe_signal_compressor.cpp kis_acyclic_signal_connector.cpp kis_layer.cc kis_indirect_painting_support.cpp kis_abstract_projection_plane.cpp kis_layer_projection_plane.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_leak_tracker.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_fixed_paint_device.cpp kis_paint_layer.cc kis_perspective_grid.cpp 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_shared.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_algebra_2d.cpp kis_dom_utils.cpp kis_transparency_mask.cc kis_undo_store.cpp kis_undo_stores.cpp kis_undo_adapter.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 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_psd_layer_style.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 ) 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 ) kde4_add_library(kritaimage SHARED ${kritaimage_LIB_SRCS} ${einspline_SRCS}) target_link_libraries(kritaimage ${KDE4_KDEUI_LIBS} kritaglobal kritapsd koodf pigmentcms kundo2 kowidgetutils) target_link_libraries(kritaimage LINK_INTERFACE_LIBRARIES kritaglobal kritapsd koodf pigmentcms kundo2 kowidgetutils) target_link_libraries(kritaimage ${Boost_SYSTEM_LIBRARY}) message("DEBUG_BOOST_LIBRARIES = " ${Boost_LIBRARIES}) message("DEBUG_BOOST_SYSTEM_FOUND = " ${Boost_SYSTEM_FOUND}) message("DEBUG_BOOST_SYSTEM_LIBRARY = " ${Boost_SYSTEM_LIBRARY}) if(OPENEXR_FOUND) target_link_libraries(kritaimage ${OPENEXR_LIBRARIES}) endif() if(FFTW3_FOUND) target_link_libraries(kritaimage ${FFTW3_LIBRARIES}) endif() if(HAVE_VC) target_link_libraries(kritaimage ${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 ${GSL_LIBRARIES} ${GSL_CBLAS_LIBRARIES}) endif () set_target_properties(kritaimage PROPERTIES VERSION ${GENERIC_CALLIGRA_LIB_VERSION} SOVERSION ${GENERIC_CALLIGRA_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) ########### install files ############### install( FILES kis_base_node.h kis_base_processor.h kis_config_widget.h kis_convolution_kernel.h kis_convolution_painter.h kis_convolution_worker.h kis_cubic_curve.h kis_debug.h kis_default_bounds.h kis_distance_information.h filter/kis_filter.h filter/kis_filter_registry.h kis_filter_strategy.h kis_global.h kis_image.h kis_mask.h kis_node.h kis_node_facade.h kis_node_graph_listener.h kis_painter.h kis_paint_device.h kis_properties_configuration.h kis_processing_information.h kis_transform_worker.h kis_perspectivetransform_worker.h kis_warptransform_worker.h kis_serializable_configuration.h kis_selection.h kis_shared.h kis_shared_ptr.h kis_transaction.h kis_types.h - krita_export.h + kritaimage_export.h filter/kis_filter_configuration.h generator/kis_generator.h generator/kis_generator_registry.h brushengine/kis_locked_properties.h brushengine/kis_locked_properties_proxy.h brushengine/kis_locked_properties_server.h DESTINATION ${INCLUDE_INSTALL_DIR}/krita) diff --git a/krita/image/brushengine/kis_paint_information.h b/krita/image/brushengine/kis_paint_information.h index 3501ed349bf..2544c75dcb3 100644 --- a/krita/image/brushengine/kis_paint_information.h +++ b/krita/image/brushengine/kis_paint_information.h @@ -1,252 +1,252 @@ /* * Copyright (c) 2004 Cyrille Berger * Copyright (c) 2006 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_PAINT_INFORMATION_ #define _KIS_PAINT_INFORMATION_ #include #include #include "kis_global.h" #include "kis_vec.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_distance_information.h" class QDomDocument; class QDomElement; class KisDistanceInformation; /** * KisPaintInformation contains information about the input event that * causes the brush action to happen to the brush engine's paint * methods. * * XXX: we directly pass the KoPointerEvent x and y tilt to * KisPaintInformation, and their range is -60 to +60! * * @param pos: the position of the paint event in subpixel accuracy * @param pressure: the pressure of the stylus * @param xTilt: the angle between the device (a pen, for example) and * the perpendicular in the direction of the x axis. Positive values * are towards the bottom of the tablet. The angle is within the range * 0 to 1 * @param yTilt: the angle between the device (a pen, for example) and * the perpendicular in the direction of the y axis. Positive values * are towards the bottom of the tablet. The angle is within the range * 0 to . * @param movement: current position minus the last position of the call to paintAt * @param rotation * @param tangentialPressure * @param perspective **/ class KRITAIMAGE_EXPORT KisPaintInformation { public: /** * Note, that this class is relied on the compiler optimization * of the return value. So if it doesn't work for some reason, * please implement a proper copy c-tor */ class KRITAIMAGE_EXPORT DistanceInformationRegistrar { public: DistanceInformationRegistrar(KisPaintInformation *_p, KisDistanceInformation *distanceInfo); ~DistanceInformationRegistrar(); private: KisPaintInformation *p; }; public: /** * Create a new KisPaintInformation object. */ KisPaintInformation(const QPointF & pos, qreal pressure, qreal xTilt, qreal yTilt, qreal rotation, qreal tangentialPressure, qreal perspective, qreal time, qreal speed); KisPaintInformation(const QPointF & pos, qreal pressure, qreal xTilt, qreal yTilt, qreal rotation); KisPaintInformation(const QPointF & pos = QPointF(), qreal pressure = PRESSURE_DEFAULT); KisPaintInformation(const KisPaintInformation& rhs); void operator=(const KisPaintInformation& rhs); ~KisPaintInformation(); template void paintAt(PaintOp &op, KisDistanceInformation *distanceInfo) { KisSpacingInformation spacingInfo; { DistanceInformationRegistrar r = registerDistanceInformation(distanceInfo); spacingInfo = op.paintAt(*this); } distanceInfo->registerPaintedDab(*this, spacingInfo); } const QPointF& pos() const; void setPos(const QPointF& p); /// The pressure of the value (from 0.0 to 1.0) qreal pressure() const; /// Set the pressure void setPressure(qreal p); /// The tilt of the pen on the horizontal axis (from 0.0 to 1.0) qreal xTilt() const; /// The tilt of the pen on the vertical axis (from 0.0 to 1.0) qreal yTilt() const; /// XXX !!! :-| Please add dox! void overrideDrawingAngle(qreal angle); /// XXX !!! :-| Please add dox! qreal drawingAngleSafe(const KisDistanceInformation &distance) const; /// XXX !!! :-| Please add dox! DistanceInformationRegistrar registerDistanceInformation(KisDistanceInformation *distance); /** * Current brush direction computed from the cursor movement * * WARNING: this method is available *only* inside paintAt() call, * that is when the distance information is registered. */ qreal drawingAngle() const; /** * Current brush direction vector computed from the cursor movement * * WARNING: this method is available *only* inside paintAt() call, * that is when the distance information is registered. */ QPointF drawingDirectionVector() const; /** * Current brush speed computed from the cursor movement * * WARNING: this method is available *only* inside paintAt() call, * that is when the distance information is registered. */ qreal drawingSpeed() const; /** * Current distance from the previous dab * * WARNING: this method is available *only* inside paintAt() call, * that is when the distance information is registered. */ qreal drawingDistance() const; /// rotation as given by the tablet event qreal rotation() const; /// tangential pressure (i.e., rate for an airbrush device) qreal tangentialPressure() const; /// reciprocal of distance on the perspective grid qreal perspective() const; /// Number of ms since the beginning of the stroke qreal currentTime() const; /** * The paint information may be generated not only during real * stroke when the actual painting is happening, but also when the * cursor is hovering the canvas. In this mode some of the sensors * work a bit differently. The most outstanding example is Fuzzy * sensor, which returns unit value in this mode, otherwise it is * too irritating for a user. * * This value is true only for paint information objects created with * createHoveringModeInfo() constructor. * * \see createHoveringModeInfo() */ bool isHoveringMode() const; /** * Create a fake info object with isHoveringMode() property set to * true. * * \see isHoveringMode() */ static KisPaintInformation createHoveringModeInfo(const QPointF &pos, qreal pressure = PRESSURE_DEFAULT, qreal xTilt = 0.0, qreal yTilt = 0.0, qreal rotation = 0.0, qreal tangentialPressure = 0.0, qreal perspective = 1.0, qreal speed = 0.0, int canvasrotation = 0, bool canvasMirroredH = false); /** *Returns the canvas rotation if that has been given to the kispaintinformation. */ int canvasRotation() const; /** *set the canvas rotation. */ void setCanvasRotation(int rotation); /* *Whether the canvas is mirrored for the paint-operation. */ bool canvasMirroredH() const; /* *Set whether the canvas is mirrored for the paint-operation. */ void setCanvasHorizontalMirrorState(bool mir); void toXML(QDomDocument&, QDomElement&) const; static KisPaintInformation fromXML(const QDomElement&); /// (1-t) * p1 + t * p2 static KisPaintInformation mixOnlyPosition(qreal t, const KisPaintInformation& mixedPi, const KisPaintInformation& basePi); static KisPaintInformation mix(const QPointF& p, qreal t, const KisPaintInformation& p1, const KisPaintInformation& p2); static KisPaintInformation mix(qreal t, const KisPaintInformation& pi1, const KisPaintInformation& pi2); static qreal tiltDirection(const KisPaintInformation& info, bool normalize = true); static qreal tiltElevation(const KisPaintInformation& info, qreal maxTiltX = 60.0, qreal maxTiltY = 60.0, bool normalize = true); private: struct Private; Private* const d; }; KRITAIMAGE_EXPORT QDebug operator<<(QDebug debug, const KisPaintInformation& info); #endif diff --git a/krita/image/brushengine/kis_paintop.h b/krita/image/brushengine/kis_paintop.h index c7a9ce801aa..a17755e3947 100644 --- a/krita/image/brushengine/kis_paintop.h +++ b/krita/image/brushengine/kis_paintop.h @@ -1,144 +1,144 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2004 Boudewijn Rempt * Copyright (c) 2004 Clarence Dang * Copyright (c) 2004 Adrian Page * Copyright (c) 2004,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_PAINTOP_H_ #define KIS_PAINTOP_H_ #include "kis_distance_information.h" #include "kis_shared.h" #include "kis_types.h" #include "kis_paintop_settings.h" -#include +#include class QPointF; class KoColorSpace; class KisPainter; class KisPaintInformation; /** * KisPaintOp are use by tools to draw on a paint device. A paintop takes settings * and input information, like pressure, tilt or motion and uses that to draw pixels */ class KRITAIMAGE_EXPORT KisPaintOp : public KisShared { struct Private; public: KisPaintOp(KisPainter * painter); virtual ~KisPaintOp(); /** * Paint at the subpixel point pos using the specified paint * information.. * * The distance between two calls of the paintAt is always * specified by spacing, which is automatically saved into the * current distance information object */ void paintAt(const KisPaintInformation& info, KisDistanceInformation *currentDistance); /** * Draw a line between pos1 and pos2 using the currently set brush and color. * If savedDist is less than zero, the brush is painted at pos1 before being * painted along the line using the spacing setting. * * @return the drag distance, that is the remains of the distance * between p1 and p2 not covered because the currenlty set brush * has a spacing greater than that distance. */ virtual void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance); /** * Draw a Bezier curve between pos1 and pos2 using control points 1 and 2. * If savedDist is less than zero, the brush is painted at pos1 before being * painted along the curve using the spacing setting. * @return the drag distance, that is the remains of the distance between p1 and p2 not covered * because the currenlty set brush has a spacing greater than that distance. */ virtual void paintBezierCurve(const KisPaintInformation &pi1, const QPointF &control1, const QPointF &control2, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance); /** * Whether this paintop can paint. Can be false in case that some setting isn't read correctly. * @return if paintop is ready for painting, default is true */ virtual bool canPaint() const { return true; } /** * Split the coordinate into whole + fraction, where fraction is always >= 0. */ static void splitCoordinate(qreal coordinate, qint32 *whole, qreal *fraction); /** * returns the scale and rotation dynamically computed for the single dab * rotation is in radians * This is used e.g. for dynamic brush outline */ qreal currentScale() const; qreal currentRotation() const; protected: friend class KisPaintInformation; /** * The implementation of painting of a dab */ virtual KisSpacingInformation paintAt(const KisPaintInformation& info) = 0; void setCurrentScale(qreal scale); /** * Set rotation in radians */ void setCurrentRotation(qreal rotation); KisFixedPaintDeviceSP cachedDab(); KisFixedPaintDeviceSP cachedDab(const KoColorSpace *cs); /** * Return the painter this paintop is owned by */ KisPainter* painter() const; /** * Return the paintdevice the painter this paintop is owned by */ KisPaintDeviceSP source() const; private: friend class KisPressureRotationOption; void setFanCornersInfo(bool fanCornersEnabled, qreal fanCornersStep); private: Private* const d; }; #endif // KIS_PAINTOP_H_ diff --git a/krita/image/brushengine/kis_paintop_config_widget.h b/krita/image/brushengine/kis_paintop_config_widget.h index 4af2c2853cf..e59a5bdc690 100644 --- a/krita/image/brushengine/kis_paintop_config_widget.h +++ b/krita/image/brushengine/kis_paintop_config_widget.h @@ -1,93 +1,93 @@ /* * Copyright (c) 2008 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_CONFIG_WIDGET_H_ #define KIS_PAINTOP_CONFIG_WIDGET_H_ -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_config_widget.h" #include "kis_image.h" #include /** * Base class for widgets that are used to edit and display paintop settings. */ class KRITAIMAGE_EXPORT KisPaintOpConfigWidget : public KisConfigWidget { public: KisPaintOpConfigWidget(QWidget * parent = 0, Qt::WFlags f = 0) : KisConfigWidget(parent, f, 10) { } virtual ~KisPaintOpConfigWidget() { } /** * Write the settings in this widget to the given properties * configuration, which is cleared first. */ virtual void writeConfiguration(KisPropertiesConfiguration *config) const = 0; virtual void setImage(KisImageWSP image) { m_image = image; } virtual void setNode(KisNodeWSP node) { m_node = node; } /** * @see KisPaintOpSettings::changePaintOpSize(qreal x, qreal y) */ virtual void changePaintOpSize(qreal x, qreal y) { Q_UNUSED(x); Q_UNUSED(y); } /** * @see KisPaintOpSettings::paintOpSize() */ virtual QSizeF paintOpSize() const { return QSizeF(1.0, 1.0); }; /** * This is true for all of the paintop widget except for the Custom brush tab in the Brush tip dialog */ virtual bool presetIsValid() { return true; } /** * Some paintops are more complicated and require full canvas with layers, projections and KisImage etc. * Example is duplicate paintop. In this case simple canvas like scratchbox does not work. * Every paintop supports the scratchbox by default, override and return false if paintop does not. */ virtual bool supportScratchBox() { return true; } protected: KisImageWSP m_image; KisNodeWSP m_node; }; #endif diff --git a/krita/image/brushengine/kis_paintop_factory.h b/krita/image/brushengine/kis_paintop_factory.h index 831b8d42d1f..a44dd707cb8 100644 --- a/krita/image/brushengine/kis_paintop_factory.h +++ b/krita/image/brushengine/kis_paintop_factory.h @@ -1,115 +1,115 @@ /* * Copyright (c) 2008 Boudewijn Rempt * Copyright (c) 2010 Lukáš Tvrdý * 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_FACTORY_H_ #define KIS_PAINTOP_FACTORY_H_ #include "kis_types.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include #include #include #include class KisPainter; class KisPaintOp; class QWidget; class KisPaintOpConfigWidget; /** * The paintop factory is responsible for creating paintops of the specified class. * If there is an optionWidget, the derived paintop itself must support settings, * and it's up to the factory to do that. */ class KRITAIMAGE_EXPORT KisPaintOpFactory : public QObject { Q_OBJECT public: enum PaintopVisibility { AUTO, ALWAYS, NEVER }; /** * @param whiteListedCompositeOps list of compositeops that don't work with this paintop */ KisPaintOpFactory(const QStringList & whiteListedCompositeOps = QStringList()); virtual ~KisPaintOpFactory() {} static QString categoryStable(); #ifdef HAVE_THREADED_TEXT_RENDERING_WORKAROUND virtual void preinitializePaintOpIfNeeded(const KisPaintOpSettingsSP settings); #endif /* HAVE_THREADED_TEXT_RENDERING_WORKAROUND */ /** * Create a KisPaintOp with the given settings and painter. * @param settings the settings associated with the input device * @param painter the painter used to draw */ virtual KisPaintOp * createOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image) = 0; virtual QString id() const = 0; virtual QString name() const = 0; virtual QString category() const = 0; /** * List of usually hidden compositeops that are useful for this paintop. */ QStringList whiteListedCompositeOps() const; /** * The filename of the pixmap we can use to represent this paintop in the ui. */ virtual QString pixmap(); /** * Create and return an settings object for this paintop. */ virtual KisPaintOpSettingsSP settings() = 0; /** * create a widget that can display paintop settings */ virtual KisPaintOpConfigWidget* createConfigWidget(QWidget* parent) = 0; /** * Set the priority of this paintop, as it is shown in the UI; lower number means * it will be show more to the front of the list. * @param newPriority the priority */ void setPriority(int newPriority); int priority() const; /** * This method will be called by the registry after all paintops are loaded * Overwrite to let the factory do something. */ virtual void processAfterLoading() {} private: QStringList m_whiteListedCompositeOps; int m_priority; PaintopVisibility m_visibility; }; #endif diff --git a/krita/image/brushengine/kis_paintop_preset.h b/krita/image/brushengine/kis_paintop_preset.h index 2cb31817792..a87c4fc5569 100644 --- a/krita/image/brushengine/kis_paintop_preset.h +++ b/krita/image/brushengine/kis_paintop_preset.h @@ -1,114 +1,114 @@ /* This file is part of the KDE project * Copyright (C) Boudewijn Rempt , (C) 2008 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KIS_PAINTOP_PRESET_H #define KIS_PAINTOP_PRESET_H #include "KoResource.h" #include "KoID.h" #include "kis_types.h" #include "kis_shared.h" -#include "krita_export.h" +#include "kritaimage_export.h" /** * A KisPaintOpPreset contains a particular set of settings * associated with a paintop, like brush, paintopsettings. * A new property in this class is to make it dirty. That means the * user can now temporarily save any tweaks in the Preset throughout * the session. The Dirty Preset setting/unsetting is handled by KisPaintOpPresetSettings */ class KRITAIMAGE_EXPORT KisPaintOpPreset : public KoResource, public KisShared { public: KisPaintOpPreset(); KisPaintOpPreset(const QString& filename); ~KisPaintOpPreset(); KisPaintOpPresetSP clone() const; /// set the id of the paintop plugin void setPaintOp(const KoID & paintOp); /// return the id of the paintop plugin KoID paintOp() const; /// replace the current settings object with the specified settings void setSettings(KisPaintOpSettingsSP settings); void setOriginalSettings(KisPaintOpSettingsSP originalSettings); /// return the settings that define this paintop preset KisPaintOpSettingsSP settings() const; KisPaintOpSettingsSP originalSettings() const; bool load(); bool loadFromDevice(QIODevice *dev); bool save(); bool saveToDevice(QIODevice* dev) const; void toXML(QDomDocument& doc, QDomElement& elt) const; void fromXML(const QDomElement& elt); bool removable() const { return true; } QString defaultFileExtension() const { return ".kpp"; } void setPresetDirty(bool value); bool isPresetDirty() const; /** * Never use manual save/restore calls to * isPresetDirty()/setPresetDirty()! They will lead to * hard-to-tack-down bugs when the dirty state will not be * restored on jumps like 'return', 'break' or exception. */ class DirtyStateSaver { public: DirtyStateSaver(KisPaintOpPreset *preset) : m_preset(preset), m_isDirty(preset->isPresetDirty()) { } ~DirtyStateSaver() { m_preset->setPresetDirty(m_isDirty); } private: KisPaintOpPreset *m_preset; bool m_isDirty; }; private: struct Private; Private * const m_d; }; Q_DECLARE_METATYPE(KisPaintOpPresetSP) #endif diff --git a/krita/image/brushengine/kis_paintop_registry.h b/krita/image/brushengine/kis_paintop_registry.h index 9c24922a8b2..dae973daafe 100644 --- a/krita/image/brushengine/kis_paintop_registry.h +++ b/krita/image/brushengine/kis_paintop_registry.h @@ -1,104 +1,104 @@ /* * Copyright (c) 2004 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_REGISTRY_H_ #define KIS_PAINTOP_REGISTRY_H_ #include #include "KoGenericRegistry.h" #include "kis_paintop.h" #include "kis_paintop_factory.h" #include "kis_types.h" #include "kis_paintop_settings.h" #include "kis_paintop_preset.h" #include -#include +#include class KisPaintOp; class KisPainter; /** * Manages the loading and creating of all paintop plugins. */ class KRITAIMAGE_EXPORT KisPaintOpRegistry : public QObject, public KoGenericRegistry { Q_OBJECT public: virtual ~KisPaintOpRegistry(); #ifdef HAVE_THREADED_TEXT_RENDERING_WORKAROUND void preinitializePaintOpIfNeeded(const KisPaintOpPresetSP preset); #endif /* HAVE_THREADED_TEXT_RENDERING_WORKAROUND */ /** * Create and return a paintop based on the given preset. A preset defines * a paintop, a settings object and possible a brush tip. */ KisPaintOp* paintOp(const KisPaintOpPresetSP preset, KisPainter * painter, KisNodeSP node, KisImageSP image) const; /** * Create and return an (abstracted) configuration widget * for using the specified paintop with the specified input device, * with the specified parent as widget parent. Returns 0 if there * are no settings available for the given device. */ KisPaintOpSettingsSP settings(const KoID& id) const; /** * @return a default preset for the given paintop. */ KisPaintOpPresetSP defaultPreset(const KoID& id) const; // Get the name of the icon to show in the toolchest QString pixmap(const KoID & id) const; /** * This function return a list of all the keys in KoID format by using the name() method * on the objects stored in the registry. */ QList listKeys() const; public: static KisPaintOpRegistry* instance(); private: KisPaintOpRegistry(); KisPaintOpRegistry(const KisPaintOpRegistry&); KisPaintOpRegistry operator=(const KisPaintOpRegistry&); // So the settings can get a paintop to render their sample image friend class KisPaintOpSettings; /** * Return a newly created paintop. You are responsible for deleting */ KisPaintOp * paintOp(const QString& id, const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image) const; }; #endif // KIS_PAINTOP_REGISTRY_H_ diff --git a/krita/image/brushengine/kis_paintop_settings.h b/krita/image/brushengine/kis_paintop_settings.h index cbc95fbe745..4a3ecfe90b6 100644 --- a/krita/image/brushengine/kis_paintop_settings.h +++ b/krita/image/brushengine/kis_paintop_settings.h @@ -1,254 +1,254 @@ /* * 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 "krita_export.h" +#include "kritaimage_export.h" #include #include #include "kis_shared.h" #include "kis_properties_configuration.h" #include "kis_paint_information.h" class KisPaintOpConfigWidget; /** * 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 * 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 KisShared { public: KisPaintOpSettings(); virtual ~KisPaintOpSettings(); /** * */ virtual 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 &pos, Qt::KeyboardModifiers modifiers); /** * 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(); /** * Clone the current settings object. Override this if your settings instance doesn't * store everything as properties. */ virtual KisPaintOpSettingsSP clone() const; /** * @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. */ virtual bool isAirbrushing() const { return false; } /** * If this paintop deposit the paint even when not moving, the tool needs to know the rate of it in miliseconds */ virtual int rate() const { return 100; } /** * This enum defines the current mode for painting an outline. */ enum OutlineMode { CursorIsOutline = 1, ///< When this mode is set, an outline is painted around the cursor CursorIsCircleOutline, CursorNoOutline, CursorTiltOutline, CursorColorOutline }; /** * 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, OutlineMode mode) const; /** * Useful for simple elliptical brush outline. */ QPainterPath ellipseOutline(qreal width, qreal height, qreal scale, qreal rotation) const; /** * The behaviour might be different per paintop. Most of the time * the brush diameter is increased by x pixels, y ignored * * @param x is add to the diameter or radius (according the paintop) * It might be also negative, to decrease the value of the brush diameter/radius. * x is in pixels * @param y is unused, it supposed to be used to change some different attribute * of the brush like softness or density */ virtual void changePaintOpSize(qreal x, qreal y); /** * @return The width and the height of the brush mask/dab in pixels */ virtual QSizeF paintOpSize() const; /** * 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() const; /** * @return flow saved in the properties */ qreal paintOpFlow() const; /** * @return composite mode saved in the properties */ QString paintOpCompositeOp() const; 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); protected: /** * @return the option widget of the paintop (can be 0 is no option widgets is set) */ KisPaintOpConfigWidget* optionsWidget() const; /** * The callback is called every time when a property changes */ virtual void onPropertyChanged(); private: struct Private; const QScopedPointer d; }; #endif diff --git a/krita/image/bsplines/kis_bspline_1d.h b/krita/image/bsplines/kis_bspline_1d.h index 9b8d424b5d2..61c4799677a 100644 --- a/krita/image/bsplines/kis_bspline_1d.h +++ b/krita/image/bsplines/kis_bspline_1d.h @@ -1,83 +1,83 @@ /* * Copyright (c) 2014 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_BSPLINE_1D_H #define __KIS_BSPLINE_1D_H -#include +#include #include #include #include "kis_bspline.h" namespace KisBSplines { class KRITAIMAGE_EXPORT KisBSpline1D { public: KisBSpline1D(float gridStart, float gridEnd, int numSamples, BorderCondition bc); ~KisBSpline1D(); template inline void initializeSpline() { FunctionOp op; float step = (m_gridEnd - m_gridStart) / (m_numSamples - 1); QVector values(m_numSamples); for (int i = 0; i < m_numSamples; i++) { float x = m_gridStart + i * step; float y = op(x); values[i] = y; } initializeSplineImpl(values); } float value(float x) const; inline float gridStart() const { return m_gridStart; } inline float gridEnd() const { return m_gridEnd; } private: void initializeSplineImpl(const QVector &values); private: struct Private; const QScopedPointer m_d; /** * We need to store them separately, because they should * be accessible from the templated part */ float m_gridStart; float m_gridEnd; int m_numSamples; }; } #endif /* __KIS_BSPLINE_1D_H */ diff --git a/krita/image/bsplines/kis_bspline_2d.h b/krita/image/bsplines/kis_bspline_2d.h index 56c778cfa43..8965a2ad939 100644 --- a/krita/image/bsplines/kis_bspline_2d.h +++ b/krita/image/bsplines/kis_bspline_2d.h @@ -1,124 +1,124 @@ /* * Copyright (c) 2014 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_BSPLINE_2D_H #define __KIS_BSPLINE_2D_H -#include +#include #include #include #include #include #include "kis_bspline.h" namespace KisBSplines { template struct ConvertSplineOp { ConvertSplineOp(const Spline &spline) : m_spline(spline) {} float operator() (float x, float y) const { return m_spline.value(x, y); } const Spline &m_spline; }; class KRITAIMAGE_EXPORT KisBSpline2D { public: KisBSpline2D(float xStart, float xEnd, int numSamplesX, BorderCondition bcX, float yStart, float yEnd, int numSamplesY, BorderCondition bcY); ~KisBSpline2D(); template static inline KisBSpline2D* createResampledSpline(const Spline &other, int xSamples, int ySamples) { QPointF tl = other.topLeft(); QPointF br = other.bottomRight(); KisBSpline2D *newSpline = new KisBSpline2D(tl.x(), br.x(), xSamples, other.borderConditionX(), tl.y(), br.y(), ySamples, other.borderConditionY()); ConvertSplineOp op(other); newSpline->initializeSpline(op); return newSpline; } template inline void initializeSpline(const FunctionOp &op) { float xStep = (m_xEnd - m_xStart) / (m_numSamplesX - 1); float yStep = (m_yEnd - m_yStart) / (m_numSamplesY - 1); QVector values(m_numSamplesX * m_numSamplesY); for (int x = 0; x < m_numSamplesX; x++) { float fx = m_xStart + xStep * x; for (int y = 0; y < m_numSamplesY; y++) { float fy = m_yStart + yStep * y; float v = op(fx, fy); values[x * m_numSamplesY + y] = v; } } initializeSplineImpl(values); } float value(float x, float y) const; inline QPointF topLeft() const { return QPointF(m_xStart, m_yStart); } inline QPointF bottomRight() const { return QPointF(m_xEnd, m_yEnd); } BorderCondition borderConditionX() const; BorderCondition borderConditionY() const; private: void initializeSplineImpl(const QVector &values); private: struct Private; const QScopedPointer m_d; /** * We need to store them separately, because they should * be accessible from the templated part */ float m_xStart; float m_xEnd; int m_numSamplesX; float m_yStart; float m_yEnd; int m_numSamplesY; }; } #endif /* __KIS_BSPLINE_2D_H */ diff --git a/krita/image/bsplines/kis_nu_bspline_2d.h b/krita/image/bsplines/kis_nu_bspline_2d.h index 71c5cd50d64..eac80771cb4 100644 --- a/krita/image/bsplines/kis_nu_bspline_2d.h +++ b/krita/image/bsplines/kis_nu_bspline_2d.h @@ -1,88 +1,88 @@ /* * Copyright (c) 2014 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_NU_BSPLINE_2D_H #define __KIS_NU_BSPLINE_2D_H -#include +#include #include #include #include #include #include "kis_bspline.h" namespace KisBSplines { class KRITAIMAGE_EXPORT KisNUBSpline2D { public: KisNUBSpline2D(const QVector &xSamples, BorderCondition bcX, const QVector &ySamples, BorderCondition bcY); ~KisNUBSpline2D(); template inline void initializeSpline(const FunctionOp &op) { const int xSize = m_xSamples.size(); const int ySize = m_ySamples.size(); QVector values(xSize * ySize); for (int x = 0; x < xSize; x++) { double fx = m_xSamples[x]; for (int y = 0; y < ySize; y++) { double fy = m_ySamples[y]; float v = op(fx, fy); values[x * ySize + y] = v; } } initializeSplineImpl(values); } float value(float x, float y) const; QPointF topLeft() const; QPointF bottomRight() const; BorderCondition borderConditionX() const; BorderCondition borderConditionY() const; private: void initializeSplineImpl(const QVector &values); private: struct Private; const QScopedPointer m_d; /** * We need to store them separately, because they should * be accessible from the templated part */ const QVector m_xSamples; const QVector m_ySamples; }; } #endif /* __KIS_NU_BSPLINE_2D_H */ diff --git a/krita/image/commands/kis_change_filter_command.h b/krita/image/commands/kis_change_filter_command.h index aadd164931c..ed06a946313 100644 --- a/krita/image/commands/kis_change_filter_command.h +++ b/krita/image/commands/kis_change_filter_command.h @@ -1,99 +1,98 @@ /* * Copyright (c) 2008 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_CHANGE_FILTER_COMMAND_H #define KIS_CHANGE_FILTER_COMMAND_H -#include #include #include #include "kis_types.h" #include #include "filter/kis_filter_configuration.h" #include "kis_node.h" #include "kis_node_filter_interface.h" #include "filter/kis_filter_registry.h" #include "filter/kis_filter.h" #include "generator/kis_generator_registry.h" #include "generator/kis_generator.h" class KisNode; class KisChangeFilterCmd : public KUndo2Command { public: KisChangeFilterCmd(KisNodeSP node, const QString &filterNameBefore, const QString &xmlBefore, const QString &filterNameAfter, const QString &xmlAfter, bool useGeneratorRegistry) : KUndo2Command(kundo2_i18n("Change Filter")) { m_node = node; m_filterInterface = dynamic_cast(node.data()); Q_ASSERT(m_filterInterface); m_useGeneratorRegistry = useGeneratorRegistry; m_xmlBefore = xmlBefore; m_xmlAfter = xmlAfter; m_filterNameBefore = filterNameBefore; m_filterNameAfter = filterNameAfter; } public: virtual void redo() { m_filterInterface->setFilter(createConfiguration(m_filterNameAfter, m_xmlAfter)); m_node->setDirty(); } virtual void undo() { m_filterInterface->setFilter(createConfiguration(m_filterNameBefore, m_xmlBefore)); m_node->setDirty(); } private: KisFilterConfiguration* createConfiguration(const QString &name, const QString &data) { KisFilterConfiguration *config; if (m_useGeneratorRegistry) { KisGeneratorSP generator = KisGeneratorRegistry::instance()->value(name); config = generator->defaultConfiguration(0); } else { KisFilterSP filter = KisFilterRegistry::instance()->value(name); config = filter->defaultConfiguration(0); } config->fromXML(data); return config; } private: KisNodeSP m_node; KisNodeFilterInterface *m_filterInterface; bool m_useGeneratorRegistry; QString m_xmlBefore; QString m_xmlAfter; QString m_filterNameBefore; QString m_filterNameAfter; }; #endif diff --git a/krita/image/commands/kis_deselect_global_selection_command.h b/krita/image/commands/kis_deselect_global_selection_command.h index 644beb7d308..dcb5fa3aec6 100644 --- a/krita/image/commands/kis_deselect_global_selection_command.h +++ b/krita/image/commands/kis_deselect_global_selection_command.h @@ -1,47 +1,47 @@ /* * Copyright (c) 2007 Sven Langkamp * * 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_DESELECT_GLOBAL_SELECTION_COMMAND_H_ #define KIS_DESELECT_GLOBAL_SELECTION_COMMAND_H_ -#include +#include #include #include "kis_types.h" /// The command for deselection the global selection of KisImage class KRITAIMAGE_EXPORT KisDeselectGlobalSelectionCommand : public KUndo2Command { public: /** * Constructor * @param image the image * @param parent the parent command */ KisDeselectGlobalSelectionCommand(KisImageWSP image, KUndo2Command * parent = 0); virtual ~KisDeselectGlobalSelectionCommand(); virtual void redo(); virtual void undo(); private: KisImageWSP m_image; KisSelectionSP m_oldSelection; }; #endif diff --git a/krita/image/commands/kis_image_change_layers_command.h b/krita/image/commands/kis_image_change_layers_command.h index 6d7240e90eb..03d83495b74 100644 --- a/krita/image/commands/kis_image_change_layers_command.h +++ b/krita/image/commands/kis_image_change_layers_command.h @@ -1,42 +1,42 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2007 Sven Langkamp * * 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_CHANGE_LAYERS_COMMAND_H_ #define KIS_IMAGE_CHANGE_LAYERS_COMMAND_H_ -#include +#include #include "kis_types.h" #include "kis_image_command.h" class KisImageChangeLayersCommand : public KisImageCommand { public: KisImageChangeLayersCommand(KisImageWSP image, KisNodeSP oldRootLayer, KisNodeSP newRootLayer); virtual void redo(); virtual void undo(); private: KisNodeSP m_oldRootLayer; KisNodeSP m_newRootLayer; }; #endif diff --git a/krita/image/commands/kis_image_command.h b/krita/image/commands/kis_image_command.h index f6b990bddbc..e627996d0fa 100644 --- a/krita/image/commands/kis_image_command.h +++ b/krita/image/commands/kis_image_command.h @@ -1,71 +1,71 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2007 Sven Langkamp * * 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_COMMAND_H_ #define KIS_IMAGE_COMMAND_H_ -#include +#include #include #include #include #include "kis_types.h" #include "kis_paint_device.h" /// the base command for commands altering a KisImage class KRITAIMAGE_EXPORT KisImageCommand : public KUndo2Command { public: /** * Constructor * @param name The name that will be shown in the ui * @param image The image the command will be working on. */ KisImageCommand(const KUndo2MagicString& name, KisImageWSP image, KUndo2Command *parent = 0); virtual ~KisImageCommand(); protected: /** * Used for performing the smallest update * after a node has been removed from stack. * First tries to setDirty() node's siblings. * If it doesn't help, performs full refresh. */ class UpdateTarget { public: UpdateTarget(KisImageWSP image, KisNodeSP removedNode, const QRect &updateRect); void update(); private: KisImageWSP m_image; QRect m_updateRect; int m_removedNodeIndex; KisNodeSP m_removedNodeParent; }; protected: KisImageWSP m_image; }; #endif // KIS_IMAGE_COMMAND_H_ diff --git a/krita/image/commands/kis_image_layer_add_command.h b/krita/image/commands/kis_image_layer_add_command.h index f93215a4a29..a683caecffe 100644 --- a/krita/image/commands/kis_image_layer_add_command.h +++ b/krita/image/commands/kis_image_layer_add_command.h @@ -1,53 +1,53 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2007 Sven Langkamp * * 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_LAYER_ADD_COMMAND_H_ #define KIS_IMAGE_LAYER_ADD_COMMAND_H_ -#include +#include #include "kis_types.h" #include "kis_image_command.h" /// The command for adding a layer class KRITAIMAGE_EXPORT KisImageLayerAddCommand : public KisImageCommand { public: /** * Constructor * @param image The image the command will be working on. * @param layer the layer to add */ KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, KisNodeSP aboveThis, bool doRedoUpdates = true, bool doUndoUpdates = true); KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, quint32 index, bool doRedoUpdates = true, bool doUndoUpdates = true); virtual void redo(); virtual void undo(); private: KisNodeSP m_layer; KisNodeSP m_parent; KisNodeSP m_aboveThis; quint32 m_index; bool m_doRedoUpdates; bool m_doUndoUpdates; }; #endif diff --git a/krita/image/commands/kis_image_layer_move_command.h b/krita/image/commands/kis_image_layer_move_command.h index ae3a0068870..e72c388fd13 100644 --- a/krita/image/commands/kis_image_layer_move_command.h +++ b/krita/image/commands/kis_image_layer_move_command.h @@ -1,61 +1,61 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2007 Sven Langkamp * * 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_LAYER_MOVE_COMMAND_H_ #define KIS_IMAGE_LAYER_MOVE_COMMAND_H_ -#include +#include #include #include #include "kis_types.h" #include "kis_image_command.h" /// The command for layer moves inside the layer stack class KRITAIMAGE_EXPORT KisImageLayerMoveCommand : public KisImageCommand { public: /** * Command for layer moves inside the layer stack * * @param image the image * @param layer the moved layer * @param newParent the next parent of the layer * @param newAbove the layer that will be below the layer after the move */ KisImageLayerMoveCommand(KisImageWSP image, KisNodeSP node, KisNodeSP newParent, KisNodeSP newAbove); KisImageLayerMoveCommand(KisImageWSP image, KisNodeSP node, KisNodeSP newParent, quint32 index); virtual void redo(); virtual void undo(); private: KisNodeSP m_layer; KisNodeSP m_prevParent; KisNodeSP m_prevAbove; KisNodeSP m_newParent; KisNodeSP m_newAbove; quint32 m_index; bool m_useIndex; }; #endif diff --git a/krita/image/commands/kis_image_layer_remove_command.h b/krita/image/commands/kis_image_layer_remove_command.h index 31df225406f..f668031875e 100644 --- a/krita/image/commands/kis_image_layer_remove_command.h +++ b/krita/image/commands/kis_image_layer_remove_command.h @@ -1,43 +1,43 @@ /* * 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_IMAGE_LAYER_REMOVE_COMMAND_H #define __KIS_IMAGE_LAYER_REMOVE_COMMAND_H -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" #include "kis_image_command.h" class KRITAIMAGE_EXPORT KisImageLayerRemoveCommand : public KisImageCommand { public: KisImageLayerRemoveCommand(KisImageWSP image, KisNodeSP node); ~KisImageLayerRemoveCommand(); void redo(); void undo(); private: void addSubtree(KisImageWSP image, KisNodeSP node); private: KisNodeSP m_node; }; #endif /* __KIS_IMAGE_LAYER_REMOVE_COMMAND_H */ diff --git a/krita/image/commands/kis_image_layer_remove_command_impl.h b/krita/image/commands/kis_image_layer_remove_command_impl.h index a63fc974856..991471d47df 100644 --- a/krita/image/commands/kis_image_layer_remove_command_impl.h +++ b/krita/image/commands/kis_image_layer_remove_command_impl.h @@ -1,51 +1,51 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2007 Sven Langkamp * * 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_LAYER_REMOVE_COMMAND_IMPL_H_ #define KIS_IMAGE_LAYER_REMOVE_COMMAND_IMPL_H_ #include -#include +#include #include "kis_types.h" #include "kis_image_command.h" /// The command for removing a single node. It should be used inside /// KisImageLayerRemoveCommand only class KRITAIMAGE_EXPORT KisImageLayerRemoveCommandImpl : public KisImageCommand { public: /** * Constructor * @param image The image the command will be working on. * @param node the node to remove */ KisImageLayerRemoveCommandImpl(KisImageWSP image, KisNodeSP node, KUndo2Command *parent = 0); ~KisImageLayerRemoveCommandImpl(); virtual void redo(); virtual void undo(); private: struct Private; Private * const m_d; }; #endif diff --git a/krita/image/commands/kis_image_lock_command.h b/krita/image/commands/kis_image_lock_command.h index c477e1db2b0..62559aec9eb 100644 --- a/krita/image/commands/kis_image_lock_command.h +++ b/krita/image/commands/kis_image_lock_command.h @@ -1,50 +1,48 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2007 Sven Langkamp * * 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_LOCK_COMMAND_H_ #define KIS_IMAGE_LOCK_COMMAND_H_ -#include - #include "kis_types.h" #include "kis_image_command.h" /** * The command for image locking inside macro commands. * * It will ensurce that the image is properly locked during the execution * of macro commands. Place it at the start and end of the macro command. */ class KisImageLockCommand : public KisImageCommand { public: /** * Constructor * @param image The image the command will be working on. * @param lockImage Locking state of the image, while redo. */ KisImageLockCommand(KisImageWSP image, bool lockImage); virtual void redo(); virtual void undo(); }; #endif diff --git a/krita/image/commands/kis_image_node_lower_command.h b/krita/image/commands/kis_image_node_lower_command.h index 2567518e285..6cb1a64497d 100644 --- a/krita/image/commands/kis_image_node_lower_command.h +++ b/krita/image/commands/kis_image_node_lower_command.h @@ -1,46 +1,46 @@ /* * 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_IMAGE_NODE_LOWER_COMMAND_H_ #define KIS_IMAGE_NODE_LOWER_COMMAND_H_ -#include +#include #include "kis_types.h" #include "kis_image_command.h" /// The command for adding a layer class KRITAIMAGE_EXPORT KisImageNodeLowerCommand : public KisImageCommand { public: /** * Constructor * @param image The image the command will be working on. * @param layer the layer to add */ KisImageNodeLowerCommand(KisImageWSP image, KisNodeSP node); virtual void redo(); virtual void undo(); private: KisNodeSP m_node; }; #endif diff --git a/krita/image/commands/kis_image_node_raise_command.h b/krita/image/commands/kis_image_node_raise_command.h index 934b0d475f1..8de7b69f464 100644 --- a/krita/image/commands/kis_image_node_raise_command.h +++ b/krita/image/commands/kis_image_node_raise_command.h @@ -1,46 +1,46 @@ /* * 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_IMAGE_NODE_RAISE_COMMAND_H_ #define KIS_IMAGE_NODE_RAISE_COMMAND_H_ -#include +#include #include "kis_types.h" #include "kis_image_command.h" /// The command for adding a layer class KRITAIMAGE_EXPORT KisImageNodeRaiseCommand : public KisImageCommand { public: /** * Constructor * @param image The image the command will be working on. * @param layer the layer to add */ KisImageNodeRaiseCommand(KisImageWSP image, KisNodeSP node); virtual void redo(); virtual void undo(); private: KisNodeSP m_node; }; #endif diff --git a/krita/image/commands/kis_image_node_to_bottom_command.h b/krita/image/commands/kis_image_node_to_bottom_command.h index c381ef21495..8248ef386bf 100644 --- a/krita/image/commands/kis_image_node_to_bottom_command.h +++ b/krita/image/commands/kis_image_node_to_bottom_command.h @@ -1,49 +1,49 @@ /* * 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_IMAGE_NODE_TO_BOTTOM_COMMAND_H_ #define KIS_IMAGE_NODE_TO_BOTTOM_COMMAND_H_ -#include +#include #include "kis_types.h" #include "kis_image_command.h" #include "kis_paint_device.h" /// The command for adding a layer class KRITAIMAGE_EXPORT KisImageNodeToBottomCommand : public KisImageCommand { public: /** * Constructor * @param image The image the command will be working on. * @param layer the layer to add */ KisImageNodeToBottomCommand(KisImageWSP image, KisNodeSP node); virtual void redo(); virtual void undo(); private: KisNodeSP m_node; KisNodeSP m_prevParent; KisNodeSP m_prevAbove; }; #endif diff --git a/krita/image/commands/kis_image_node_to_top_command.h b/krita/image/commands/kis_image_node_to_top_command.h index 17420a563df..b296e91fa55 100644 --- a/krita/image/commands/kis_image_node_to_top_command.h +++ b/krita/image/commands/kis_image_node_to_top_command.h @@ -1,49 +1,49 @@ /* * 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_IMAGE_NODE_TO_TOP_COMMAND_H_ #define KIS_IMAGE_NODE_TO_TOP_COMMAND_H_ -#include +#include #include "kis_types.h" #include "kis_image_command.h" #include "kis_paint_device.h" /// The command for adding a layer class KRITAIMAGE_EXPORT KisImageNodeToTopCommand : public KisImageCommand { public: /** * Constructor * @param image The image the command will be working on. * @param layer the layer to add */ KisImageNodeToTopCommand(KisImageWSP image, KisNodeSP node); virtual void redo(); virtual void undo(); private: KisNodeSP m_node; KisNodeSP m_prevParent; KisNodeSP m_prevAbove; }; #endif diff --git a/krita/image/commands/kis_image_set_projection_color_space_command.h b/krita/image/commands/kis_image_set_projection_color_space_command.h index 617b92d6d9b..40c26b7a07a 100644 --- a/krita/image/commands/kis_image_set_projection_color_space_command.h +++ b/krita/image/commands/kis_image_set_projection_color_space_command.h @@ -1,42 +1,41 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2007 Sven Langkamp * * 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_SET_PROJECTION_COLOR_SPACE_COMMAND_H_ #define KIS_IMAGE_SET_PROJECTION_COLOR_SPACE_COMMAND_H_ -#include #include "kis_image_command.h" class KoColorSpace; class KisImageSetProjectionColorSpaceCommand : public KisImageCommand { public: KisImageSetProjectionColorSpaceCommand(KisImageWSP image, const KoColorSpace * afterColorSpace); virtual void redo(); virtual void undo(); private: const KoColorSpace * m_beforeColorSpace; const KoColorSpace * m_afterColorSpace; }; #endif /* KIS_IMAGE_SET_PROJECTION_COLOR_SPACE_COMMAND_H_ */ diff --git a/krita/image/commands/kis_layer_command.h b/krita/image/commands/kis_layer_command.h index 6185a8852f0..067a21a5c4e 100644 --- a/krita/image/commands/kis_layer_command.h +++ b/krita/image/commands/kis_layer_command.h @@ -1,44 +1,44 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2005 C. Boemann * * 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_LAYER_COMMAND_H_ #define KIS_LAYER_COMMAND_H_ #include -#include +#include #include "kis_types.h" class KisLayer; /// the base command for commands altering a layer class KRITAIMAGE_EXPORT KisLayerCommand : public KUndo2Command { public: /** * Constructor * @param name The name that will be shown in the ui * @param layer The layer the command will be working on. */ KisLayerCommand(const KUndo2MagicString& name, KisLayerSP layer); virtual ~KisLayerCommand(); protected: KisLayerSP m_layer; }; #endif diff --git a/krita/image/commands/kis_layer_props_command.h b/krita/image/commands/kis_layer_props_command.h index cc625a7b29b..d729f34ada5 100644 --- a/krita/image/commands/kis_layer_props_command.h +++ b/krita/image/commands/kis_layer_props_command.h @@ -1,75 +1,75 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2007 Sven Langkamp * * 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_LAYER_PROPS_COMMAND_H #define KIS_LAYER_PROPS_COMMAND_H -#include +#include #include #include #include #include "kis_types.h" #include "kis_layer_command.h" #include "kis_paint_device.h" /// The command for layer property changes class KRITAIMAGE_EXPORT KisLayerPropsCommand : public KisLayerCommand { public: /** * Command for layer property changes * * This command stores the current layer properties and set the new properties * * @param image the image * @param layer the layer whose propertys will be changed * @param opacity the new layer opacity * @param compositeOp the new layer composite op * @param name the new layer name * @param undoChannelFlags specifies if the channel flags should be undoable, normally they are not but they can be if e.g the channels change */ KisLayerPropsCommand(KisLayerSP layer, qint32 oldOpacity, qint32 newOpactiy, const QString& oldCompositeOp, const QString& newCompositeOp, const QString& oldName, const QString& newName, const QBitArray oldChannelFlags, const QBitArray newChannelFlags, bool undoChannelFlags = false); virtual ~KisLayerPropsCommand(); virtual void redo(); virtual void undo(); private: QString m_oldName; QString m_newName; qint32 m_oldOpacity; qint32 m_newOpacity; QString m_oldCompositeOp; QString m_newCompositeOp; QBitArray m_oldChannelFlags; QBitArray m_newChannelFlags; bool m_undoChannelFlags; }; #endif diff --git a/krita/image/commands/kis_node_command.h b/krita/image/commands/kis_node_command.h index 12a57745cc7..e19164891f0 100644 --- a/krita/image/commands/kis_node_command.h +++ b/krita/image/commands/kis_node_command.h @@ -1,45 +1,45 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2005 C. Boemann * * 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_NODE_COMMAND_H_ #define KIS_NODE_COMMAND_H_ -#include +#include #include #include "kis_types.h" class KisNode; /// the base command for commands altering a node class KRITAIMAGE_EXPORT KisNodeCommand : public KUndo2Command { public: /** * Constructor * @param name The name that will be shown in the ui * @param node The node the command will be working on. */ KisNodeCommand(const KUndo2MagicString& name, KisNodeSP node); virtual ~KisNodeCommand(); protected: KisNodeSP m_node; }; #endif /* KIS_NODE_COMMAND_H_*/ diff --git a/krita/image/commands/kis_paintdevice_convert_type_command.h b/krita/image/commands/kis_paintdevice_convert_type_command.h index e1b238e3c4a..416a0eca625 100644 --- a/krita/image/commands/kis_paintdevice_convert_type_command.h +++ b/krita/image/commands/kis_paintdevice_convert_type_command.h @@ -1,107 +1,105 @@ /* * Copyright (c) 2009 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_PAINTDEVICE_CONVERT_TYPE_COMMAND_H #define KIS_PAINTDEVICE_CONVERT_TYPE_COMMAND_H -#include - #include #include #include #include #include #include #include "kis_types.h" #include "kis_paint_device.h" class KisPaintDeviceConvertTypeCommand : public KUndo2Command { public: KisPaintDeviceConvertTypeCommand(KisPaintDeviceSP paintDevice, KisDataManagerSP beforeData, const KoColorSpace * beforeColorSpace, KisDataManagerSP afterData, const KoColorSpace * afterColorSpace) { m_firstRedo = true; Q_ASSERT(paintDevice); Q_ASSERT(beforeData); Q_ASSERT(afterData); Q_ASSERT(beforeData != afterData); m_paintDevice = paintDevice; m_beforeData = beforeData; m_beforeColorSpaceModelId = beforeColorSpace->colorModelId().id(); m_beforeColorSpaceDepthId = beforeColorSpace->colorDepthId().id(); if (beforeColorSpace->profile()) { m_beforeProfileName = beforeColorSpace->profile()->name(); } m_afterData = afterData; m_afterColorSpaceModelId = afterColorSpace->colorModelId().id(); m_afterColorSpaceDepthId = afterColorSpace->colorDepthId().id(); if (afterColorSpace->profile()) { m_afterProfileName = afterColorSpace->profile()->name(); } } virtual ~KisPaintDeviceConvertTypeCommand() { } public: virtual void redo() { //KUndo2QStack calls redo(), so the first call needs to be blocked if (m_firstRedo) { m_firstRedo = false; return; } dbgImage << m_paintDevice << m_beforeColorSpaceModelId << m_beforeColorSpaceDepthId << "to" << m_afterColorSpaceModelId << m_afterColorSpaceDepthId; const KoColorSpace* cs = KoColorSpaceRegistry::instance()->colorSpace(m_afterColorSpaceModelId, m_afterColorSpaceDepthId, m_afterProfileName); m_paintDevice->setDataManager(m_afterData, cs); m_paintDevice->setDirty(); } virtual void undo() { dbgImage << m_paintDevice << m_afterColorSpaceModelId << m_afterColorSpaceDepthId << "to" << m_beforeColorSpaceModelId << m_beforeColorSpaceDepthId ; const KoColorSpace* cs = KoColorSpaceRegistry::instance()->colorSpace(m_beforeColorSpaceModelId, m_beforeColorSpaceDepthId, m_beforeProfileName); m_paintDevice->setDataManager(m_beforeData, cs); m_paintDevice->setDirty(); } private: bool m_firstRedo; // there is a mismatch between the Qt undo system and what we need for krita... KisPaintDeviceSP m_paintDevice; KisDataManagerSP m_beforeData; QString m_beforeColorSpaceModelId; QString m_beforeColorSpaceDepthId; QString m_beforeProfileName; KisDataManagerSP m_afterData; QString m_afterColorSpaceModelId; QString m_afterColorSpaceDepthId; QString m_afterProfileName; }; #endif diff --git a/krita/image/commands/kis_reselect_global_selection_command.h b/krita/image/commands/kis_reselect_global_selection_command.h index a1a2856be84..f823b609f9d 100644 --- a/krita/image/commands/kis_reselect_global_selection_command.h +++ b/krita/image/commands/kis_reselect_global_selection_command.h @@ -1,47 +1,47 @@ /* * Copyright (c) 2007 Sven Langkamp * * 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_RESELECT_GLOBAL_SELECTION_COMMAND_H #define KIS_RESELECT_GLOBAL_SELECTION_COMMAND_H -#include +#include #include #include "kis_types.h" /// The command for deselection the global selection of KisImage class KRITAIMAGE_EXPORT KisReselectGlobalSelectionCommand : public KUndo2Command { public: /** * Constructor * @param image the image * @param parent the parent command */ KisReselectGlobalSelectionCommand(KisImageWSP image, KUndo2Command * parent = 0); virtual ~KisReselectGlobalSelectionCommand(); virtual void redo(); virtual void undo(); private: KisImageWSP m_image; bool m_canReselect; }; #endif diff --git a/krita/image/commands/kis_set_global_selection_command.h b/krita/image/commands/kis_set_global_selection_command.h index 7eb563c06de..2615157401b 100644 --- a/krita/image/commands/kis_set_global_selection_command.h +++ b/krita/image/commands/kis_set_global_selection_command.h @@ -1,60 +1,60 @@ /* * Copyright (c) 2007 Sven Langkamp * * 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_SET_GLOBAL_SELECTION_COMMAND_H #define KIS_SET_GLOBAL_SELECTION_COMMAND_H -#include +#include #include #include "kis_types.h" /** * This command sets the global selection of the image. No saving * of the previous selection for "Reselect" action happens */ class KRITAIMAGE_EXPORT KisSetGlobalSelectionCommand : public KUndo2Command { public: /** * Constructor * @param image the image to set the global selection on * @param selection the selection that will be set a global selection, * null selection will remove the selection */ KisSetGlobalSelectionCommand(KisImageWSP image, KisSelectionSP selection); virtual void redo(); virtual void undo(); private: KisImageWSP m_image; KisSelectionSP m_newSelection; KisSelectionSP m_oldSelection; }; /** * Sets initial selection for the image. Nothing is selected, * but the defaultBounds are set properly */ class KRITAIMAGE_EXPORT KisSetEmptyGlobalSelectionCommand : public KisSetGlobalSelectionCommand { public: KisSetEmptyGlobalSelectionCommand(KisImageWSP image); }; #endif //KIS_SET_GLOBAL_SELECTION_COMMAND_H diff --git a/krita/image/commands_new/kis_image_resize_command.h b/krita/image/commands_new/kis_image_resize_command.h index 8cefc8bfcde..992594a380b 100644 --- a/krita/image/commands_new/kis_image_resize_command.h +++ b/krita/image/commands_new/kis_image_resize_command.h @@ -1,44 +1,44 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2007 Sven Langkamp * * 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_RESIZE_COMMAND_H_ #define KIS_IMAGE_RESIZE_COMMAND_H_ -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" #include #include class KRITAIMAGE_EXPORT KisImageResizeCommand : public KUndo2Command { public: KisImageResizeCommand(KisImageWSP image, const QSize& newRect); void redo(); void undo(); private: QSize m_sizeBefore; QSize m_sizeAfter; KisImageWSP m_image; }; #endif diff --git a/krita/image/commands_new/kis_image_set_resolution_command.h b/krita/image/commands_new/kis_image_set_resolution_command.h index 621243ae2e6..41cdea9d8cd 100644 --- a/krita/image/commands_new/kis_image_set_resolution_command.h +++ b/krita/image/commands_new/kis_image_set_resolution_command.h @@ -1,69 +1,69 @@ /* * Copyright (c) 2010 Sven Langkamp * * 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_SET_RESOLUTION_COMMAND_H #define KIS_IMAGE_SET_RESOLUTION_COMMAND_H -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" #include class KRITAIMAGE_EXPORT KisImageSetResolutionCommand : public KUndo2Command { public: KisImageSetResolutionCommand(KisImageWSP image, qreal newXRes, qreal newYRes, KUndo2Command *parent = 0); void undo(); void redo(); private: KisImageWSP m_image; qreal m_newXRes; qreal m_newYRes; qreal m_oldXRes; qreal m_oldYRes; }; /** * A special workaround command for updating the shapes. It resets * shapes always (for both undo() and redo() actions) after all the * child commands are finished. Usually, it should have the only child * KisImageSetResolutionCommand. * * Usecase: When you change the resolution of the image, the * projection of the vector layer is still rendered in old * resolution. So you should reset it and render again. */ class KRITAIMAGE_EXPORT KisResetShapesCommand : public KUndo2Command { public: KisResetShapesCommand(KisNodeSP rootNode); void undo(); void redo(); private: void resetNode(KisNodeSP node); private: KisNodeSP m_rootNode; }; #endif // KIS_IMAGE_SET_RESOLUTION_COMMAND_H diff --git a/krita/image/commands_new/kis_move_command_common.h b/krita/image/commands_new/kis_move_command_common.h index d365b3acfe4..33f9f3090a6 100644 --- a/krita/image/commands_new/kis_move_command_common.h +++ b/krita/image/commands_new/kis_move_command_common.h @@ -1,75 +1,75 @@ /* * Copyright (c) 2007 Boudewijn Rempt * Copyright (c) 2011 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_MOVE_COMMAND_COMMON_H #define KIS_MOVE_COMMAND_COMMON_H #include #include #include "kundo2command.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" /** * KisMoveCommandCommon is a general template for a command that moves * entities capable of setX() and setY() actions. Generally in Krita * you should now move the device itself, only the node containing * that device. But the case of the selections is a bit special, so we * move them separately. */ template class KRITAIMAGE_EXPORT KisMoveCommandCommon : public KUndo2Command { public: KisMoveCommandCommon(ObjectSP object, const QPoint& oldPos, const QPoint& newPos, KUndo2Command *parent = 0) : KUndo2Command(kundo2_i18n("Move"), parent), m_oldPos(oldPos), m_newPos(newPos), m_object(object) { } void redo() { moveTo(m_newPos); } void undo() { moveTo(m_oldPos); } private: void moveTo(const QPoint& pos) { /** * FIXME: Hack alert: * Our iterators don't have guarantees on thread-safety * when the offset varies. When it is fixed, remove the locking. * see: KisIterator::stressTest(), KisToolMove::mousePressEvent() */ m_object->setX(pos.x()); m_object->setY(pos.y()); } private: QPoint m_oldPos; QPoint m_newPos; protected: ObjectSP m_object; }; #endif diff --git a/krita/image/commands_new/kis_saved_commands.h b/krita/image/commands_new/kis_saved_commands.h index c2229b5d7c9..dfb5c80a34f 100644 --- a/krita/image/commands_new/kis_saved_commands.h +++ b/krita/image/commands_new/kis_saved_commands.h @@ -1,94 +1,93 @@ /* * Copyright (c) 2011 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_SAVED_COMMANDS_H #define __KIS_SAVED_COMMANDS_H #include #include "kis_types.h" -#include "krita_export.h" #include "kis_stroke_job_strategy.h" class KisStrokesFacade; class KisSavedCommandBase : public KUndo2Command { public: KisSavedCommandBase(const KUndo2MagicString &name, KisStrokesFacade *strokesFacade); virtual ~KisSavedCommandBase(); void undo(); void redo(); protected: virtual void addCommands(KisStrokeId id, bool undo) = 0; KisStrokesFacade* strokesFacade(); private: void runStroke(bool undo); private: KisStrokesFacade *m_strokesFacade; bool m_skipOneRedo; }; class KisSavedCommand : public KisSavedCommandBase { public: KisSavedCommand(KUndo2CommandSP command, KisStrokesFacade *strokesFacade); virtual int timedId(); void setTimedID(int timedID); virtual bool timedMergeWith(KUndo2Command *other); virtual QVector mergeCommandsVector(); virtual void setTime(); virtual QTime time(); virtual void setEndTime(); virtual QTime endTime(); virtual bool isMerged(); protected: void addCommands(KisStrokeId id, bool undo); private: KUndo2CommandSP m_command; }; class KisSavedMacroCommand : public KisSavedCommandBase { public: KisSavedMacroCommand(const KUndo2MagicString &name, KisStrokesFacade *strokesFacade); ~KisSavedMacroCommand(); void addCommand(KUndo2CommandSP command, KisStrokeJobData::Sequentiality sequentiality, KisStrokeJobData::Exclusivity exclusivity); void performCancel(KisStrokeId id, bool strokeUndo); protected: void addCommands(KisStrokeId id, bool undo); private: struct Private; Private * const m_d; }; #endif /* __KIS_SAVED_COMMANDS_H */ diff --git a/krita/image/commands_new/kis_set_layer_style_command.h b/krita/image/commands_new/kis_set_layer_style_command.h index a68d2b4d473..0b0659538a0 100644 --- a/krita/image/commands_new/kis_set_layer_style_command.h +++ b/krita/image/commands_new/kis_set_layer_style_command.h @@ -1,44 +1,44 @@ /* * Copyright (c) 2007 Boudewijn Rempt * Copyright (c) 2011 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_SET_LAYER_STYLE_COMMAND_H #define KIS_SET_LAYER_STYLE_COMMAND_H #include #include "kundo2command.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" class KRITAIMAGE_EXPORT KisSetLayerStyleCommand : public KUndo2Command { public: KisSetLayerStyleCommand(KisLayerSP layer, KisPSDLayerStyleSP oldStyle, KisPSDLayerStyleSP newStyle, KUndo2Command *parent = 0); void undo(); void redo(); static void updateLayerStyle(KisLayerSP layer, KisPSDLayerStyleSP style); private: KisLayerSP m_layer; KisPSDLayerStyleSP m_oldStyle; KisPSDLayerStyleSP m_newStyle; }; #endif diff --git a/krita/image/commands_new/kis_update_command.h b/krita/image/commands_new/kis_update_command.h index f7d9f5c74c8..87adc4bf334 100644 --- a/krita/image/commands_new/kis_update_command.h +++ b/krita/image/commands_new/kis_update_command.h @@ -1,51 +1,51 @@ /* * Copyright (c) 2011 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_UPDATE_COMMAND_H #define __KIS_UPDATE_COMMAND_H #include "kundo2command.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" class KisUpdatesFacade; class KRITAIMAGE_EXPORT KisUpdateCommand : public KUndo2Command { public: KisUpdateCommand(KisNodeSP node, QRect dirtyRect, KisUpdatesFacade *updatesFacade, bool needsFullRefresh = false); ~KisUpdateCommand(); void undo(); void redo(); private: void update(); private: KisNodeSP m_node; QRect m_dirtyRect; KisUpdatesFacade *m_updatesFacade; bool m_needsFullRefresh; }; #endif /* __KIS_UPDATE_COMMAND_H */ diff --git a/krita/image/filter/kis_color_transformation_configuration.h b/krita/image/filter/kis_color_transformation_configuration.h index 5910bbf2f52..3208c056a5c 100644 --- a/krita/image/filter/kis_color_transformation_configuration.h +++ b/krita/image/filter/kis_color_transformation_configuration.h @@ -1,40 +1,40 @@ /* * Copyright (c) 2015 Thorsten Zachmann * * 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_COLOR_TRANSFORMATION_CONFIGURATION_H_ #define _KIS_COLOR_TRANSFORMATION_CONFIGURATION_H_ #include "filter/kis_filter_configuration.h" -#include "krita_export.h" +#include "kritaimage_export.h" class KoColorSpace; class KisColorTransformationFilter; class KRITAIMAGE_EXPORT KisColorTransformationConfiguration : public KisFilterConfiguration { public: KisColorTransformationConfiguration(const QString & name, qint32 version); virtual ~KisColorTransformationConfiguration(); KoColorTransformation *colorTransformation(const KoColorSpace *cs, const KisColorTransformationFilter * filter) const; private: struct Private; Private* const d; }; #endif /* _KIS_COLOR_TRANSFORMATION_CONFIGURATION_H_ */ diff --git a/krita/image/filter/kis_color_transformation_filter.h b/krita/image/filter/kis_color_transformation_filter.h index 7fa24561695..9e9b5f595ea 100644 --- a/krita/image/filter/kis_color_transformation_filter.h +++ b/krita/image/filter/kis_color_transformation_filter.h @@ -1,48 +1,48 @@ /* * Copyright (c) 2009 Cyrille Berger * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef _KIS_COLOR_TRANSFORMATION_FILTER_H_ #define _KIS_COLOR_TRANSFORMATION_FILTER_H_ #include "kis_filter.h" -#include "krita_export.h" +#include "kritaimage_export.h" /** * This is a base class for filters that implement a filter for * \ref KoColorTransformation based filters. */ class KRITAIMAGE_EXPORT KisColorTransformationFilter : public KisFilter { public: KisColorTransformationFilter(const KoID& id, const KoID & category, const QString & entry); virtual ~KisColorTransformationFilter(); virtual void processImpl(KisPaintDeviceSP device, const QRect& applyRect, const KisFilterConfiguration* config, KoUpdater* progressUpdater ) const; /** * Create the color transformation that will be applied on the device. */ virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfiguration* config) const = 0; virtual KisFilterConfiguration* factoryConfiguration(const KisPaintDeviceSP) const; }; #endif diff --git a/krita/image/filter/kis_filter.h b/krita/image/filter/kis_filter.h index c32d103f970..772a23a1db1 100644 --- a/krita/image/filter/kis_filter.h +++ b/krita/image/filter/kis_filter.h @@ -1,130 +1,130 @@ /* * Copyright (c) 2004,2006-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_FILTER_H_ #define _KIS_FILTER_H_ #include #include #include #include "KoID.h" #include "KoColorSpace.h" #include "kis_types.h" #include "kis_base_processor.h" -#include "krita_export.h" +#include "kritaimage_export.h" /** * Basic interface of a Krita filter. */ class KRITAIMAGE_EXPORT KisFilter : public KisBaseProcessor { public: static KoID categoryAdjust(); static KoID categoryArtistic(); static KoID categoryBlur(); static KoID categoryColors(); static KoID categoryEdgeDetection(); static KoID categoryEmboss(); static KoID categoryEnhance(); static KoID categoryMap(); static KoID categoryNonPhotorealistic(); static KoID categoryOther(); public: /** * Construct a Krita filter */ KisFilter(const KoID& id, const KoID & category, const QString & entry); virtual ~KisFilter(); public: /** * Override this function with the implementation of your filter. * * This is a low level function that expects all the conditions * for the @param device be met. Use usual process() methods * instead. * * @param device the paint device to filter * @param applyRect the rectangle where the filter is applied * @param config the parameters of the filter * @param progressUpdater to pass on the progress the filter is making */ virtual void processImpl(KisPaintDeviceSP device, const QRect& applyRect, const KisFilterConfiguration* config, KoUpdater* progressUpdater = 0 ) const = 0; /** * Filter \p src device and write the result into \p dst device. * If \p dst is an alpha color space device, it will get special * treatment. * * @param src the source paint device * @param dst the destination paint device * @param selection the selection * @param applyRect the rectangle where the filter is applied * @param config the parameters of the filter * @param progressUpdater to pass on the progress the filter is making */ void process(const KisPaintDeviceSP src, KisPaintDeviceSP dst, KisSelectionSP selection, const QRect& applyRect, const KisFilterConfiguration* config, KoUpdater* progressUpdater = 0 ) const; /** * A convenience method for a two-device process() function */ void process(KisPaintDeviceSP device, const QRect& applyRect, const KisFilterConfiguration* config, KoUpdater* progressUpdater = 0 ) const; /** * Some filters need pixels outside the current processing rect to compute the new * value (for instance, convolution filters) */ virtual QRect neededRect(const QRect & rect, const KisFilterConfiguration* = 0) const; /** * Similar to \ref neededRect: some filters will alter a lot of pixels that are * near to each other at the same time. So when you changed a single rectangle * in a device, the actual rectangle that will feel the influence of this change * might be bigger. Use this function to determine that rect. */ virtual QRect changedRect(const QRect & rect, const KisFilterConfiguration* = 0) const; protected: QString configEntryGroup() const; }; #endif diff --git a/krita/image/filter/kis_filter_configuration.h b/krita/image/filter/kis_filter_configuration.h index 81777c0a68e..b94b905c997 100644 --- a/krita/image/filter/kis_filter_configuration.h +++ b/krita/image/filter/kis_filter_configuration.h @@ -1,138 +1,138 @@ /* * Copyright (c) 2006 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_FILTER_CONFIGURATION_H_ #define _KIS_FILTER_CONFIGURATION_H_ #include #include "kis_properties_configuration.h" #include "kis_types.h" -#include "krita_export.h" +#include "kritaimage_export.h" /** * KisFilterConfiguration does inherit neither KisShared or QSharedData * so sometimes there might be problem with broken QSharedPointer counters. * This macro activates debugging routines for such stuff. * * In the future, please either port the entire KisNodeFilterInterface * into KisSafeFilterConfigurationSP or derive filter configuration * interface from QSharedData to handle these cases. */ #define SANITY_CHECK_FILTER_CONFIGURATION_OWNER /** * A KisFilterConfiguration is the serializable representation of * the filter parameters. Filters can subclass this class to implement * direct accessors to properties, but properties not in the map will * not be serialized. * * XXX: Use KoProperties here! */ class KRITAIMAGE_EXPORT KisFilterConfiguration : public KisPropertiesConfiguration { public: /** * Create a new filter config. */ KisFilterConfiguration(const QString & name, qint32 version); protected: /** * Deep copy the filter configFile */ KisFilterConfiguration(const KisFilterConfiguration & rhs); public: virtual ~KisFilterConfiguration(); public: /** * This function is use to convert from legacy XML as used in .kra file. */ virtual void fromLegacyXML(const QDomElement&); using KisPropertiesConfiguration::fromXML; using KisPropertiesConfiguration::toXML; virtual void fromXML(const QDomElement&); virtual void toXML(QDomDocument&, QDomElement&) const; /** * Get the unique, language independent name of the filter. */ const QString & name() const; /** * Get the version of the filter that has created this config */ qint32 version() const; /** * Check if that configuration is compatible with this paint device. * The default implementation always return true. */ virtual bool isCompatible(const KisPaintDeviceSP) const; /** * @return an array with each colorspace channel a true/false bit * that indicates whether the channel should be filtered or left * alone. It is up to the filter to decide whether channels that * are to be left alone are copied to the dest file or not. */ QBitArray channelFlags() const; /** * Set the channel flags. An empty array is allowed; that means * that all channels are to be filtered. Filters can optimize on * that. The array must be in the order of the pixel layout. */ void setChannelFlags(QBitArray channelFlags); /** * These functions exist solely to allow plugins to reimplement them as * needed, while allowing consumers to implement support for them without * linking directly to the plugin. In particular, the filter management * in Sketch requires this. */ virtual void setCurve(const KisCubicCurve &curve); virtual const KisCubicCurve& curve() const; virtual void setCurves(QList &curves); virtual const QList& curves() const; #ifdef SANITY_CHECK_FILTER_CONFIGURATION_OWNER private: friend class KisNodeFilterInterface; int sanityRefUsageCounter(); int sanityDerefUsageCounter(); #endif /* SANITY_CHECK_FILTER_CONFIGURATION_OWNER */ protected: void setVersion(qint32 version); private: struct Private; Private* const d; }; Q_DECLARE_METATYPE(KisFilterConfiguration*) #endif // _KIS_FILTER_CONFIGURATION_H_ diff --git a/krita/image/filter/kis_filter_registry.h b/krita/image/filter/kis_filter_registry.h index bd30dcbe336..ba594be091d 100644 --- a/krita/image/filter/kis_filter_registry.h +++ b/krita/image/filter/kis_filter_registry.h @@ -1,59 +1,59 @@ /* * Copyright (c) 2003 Patrick Julien * Copyright (c) 2004 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_FILTER_REGISTRY_H_ #define KIS_FILTER_REGISTRY_H_ #include #include "kis_types.h" #include "KoGenericRegistry.h" -#include +#include class QString; class KisFilterConfiguration; class KRITAIMAGE_EXPORT KisFilterRegistry : public QObject, public KoGenericRegistry { Q_OBJECT public: virtual ~KisFilterRegistry(); static KisFilterRegistry* instance(); void add(KisFilterSP item); void add(const QString &id, KisFilterSP item); KisFilterConfiguration* cloneConfiguration(KisFilterConfiguration*); Q_SIGNALS: void filterAdded(QString id); private: KisFilterRegistry(QObject *parent); KisFilterRegistry(const KisFilterRegistry&); KisFilterRegistry operator=(const KisFilterRegistry&); }; #endif // KIS_FILTERSPACE_REGISTRY_H_ diff --git a/krita/image/floodfill/kis_fill_interval_map.h b/krita/image/floodfill/kis_fill_interval_map.h index af40b215a9b..84fe9558988 100644 --- a/krita/image/floodfill/kis_fill_interval_map.h +++ b/krita/image/floodfill/kis_fill_interval_map.h @@ -1,51 +1,51 @@ /* * Copyright (c) 2014 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_FILL_INTERVAL_MAP_H #define __KIS_FILL_INTERVAL_MAP_H #include #include #include -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_fill_interval.h" class KRITAIMAGE_EXPORT KisFillIntervalMap { public: public: KisFillIntervalMap(); ~KisFillIntervalMap(); void insertInterval(const KisFillInterval &interval); void cropInterval(KisFillInterval *interval); QStack fetchAllIntervals(int rowCorrection = 0) const; void clear(); private: friend class KisFillIntervalMapTest; private: struct Private; const QScopedPointer m_d; }; #endif /* __KIS_FILL_INTERVAL_MAP_H */ diff --git a/krita/image/floodfill/kis_scanline_fill.h b/krita/image/floodfill/kis_scanline_fill.h index 13895f0893c..e505bd3fbce 100644 --- a/krita/image/floodfill/kis_scanline_fill.h +++ b/krita/image/floodfill/kis_scanline_fill.h @@ -1,65 +1,65 @@ /* * Copyright (c) 2014 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_SCANLINE_FILL_H #define __KIS_SCANLINE_FILL_H #include -#include +#include #include #include class KisFillInterval; class KisFillIntervalMap; class KRITAIMAGE_EXPORT KisScanlineFill { public: KisScanlineFill(KisPaintDeviceSP device, const QPoint &startPoint, const QRect &boundingRect); ~KisScanlineFill(); void fillColor(const KoColor &fillColor); void fillSelection(KisPixelSelectionSP pixelSelection); void setThreshold(int threshold); private: friend class KisScanlineFillTest; Q_DISABLE_COPY(KisScanlineFill) template void processLine(KisFillInterval interval, const int rowIncrement, T &pixelPolicy); template void extendedPass(KisFillInterval *currentInterval, int srcRow, bool extendRight, T &pixelPolicy); template void runImpl(T &pixelPolicy); private: void testingProcessLine(const KisFillInterval &processInterval); QVector testingGetForwardIntervals() const; KisFillIntervalMap* testingGetBackwardIntervals() const; private: struct Private; const QScopedPointer m_d; }; #endif /* __KIS_SCANLINE_FILL_H */ diff --git a/krita/image/generator/kis_generator.h b/krita/image/generator/kis_generator.h index 97addbbab54..f0da49fede3 100644 --- a/krita/image/generator/kis_generator.h +++ b/krita/image/generator/kis_generator.h @@ -1,98 +1,98 @@ /* * Copyright (c) 2008 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_GENERATOR_H_ #define _KIS_GENERATOR_H_ #include #include #include "KoID.h" #include "KoColorSpace.h" #include "kis_types.h" #include "kis_base_processor.h" -#include "krita_export.h" +#include "kritaimage_export.h" class KisProcessingInformation; /** * Basic interface of a Krita generator: a generator is a program * that can fill a paint device with a color. A generator can have a * preferred colorspace. * * Generators can have initial parameter settings that determine the * way a particular generator works, but also state that allows the generator * to continue from one invocation of generate to another (handy for, e.g., * painting) */ class KRITAIMAGE_EXPORT KisGenerator : public KisBaseProcessor { friend class KisGeneratorConfigurationFactory; public: KisGenerator(const KoID& id, const KoID & category, const QString & entry); virtual ~KisGenerator(); public: /** * Override this function with the implementation of your generator. * * @param dst the destination paint device * @param size the size of the area that is to be filled * @param config the parameters of the filter */ virtual void generate(KisProcessingInformation dst, const QSize& size, const KisFilterConfiguration* config, KoUpdater* progressUpdater ) const = 0; /** * Provided for convenience when no progress reporting is needed. */ virtual void generate(KisProcessingInformation dst, const QSize& size, const KisFilterConfiguration* config ) const; /** * A generator may be specialized for working in a certain colorspace. * If so, this function returns in instance of that colorspace, else * it return 0. */ virtual const KoColorSpace * colorSpace(); /** * @param _imageArea the rectangle of the image * @return the rectangle that is affected by this generator, if the generator * is supposed to affect all pixels, then the function should return * @p _imageArea */ virtual QRect generatedRect(QRect _imageArea, const KisFilterConfiguration* = 0) const; protected: /// @return the name of config group in KConfig QString configEntryGroup() const; }; #endif diff --git a/krita/image/generator/kis_generator_layer.h b/krita/image/generator/kis_generator_layer.h index 06d40395f97..4ec53fee91f 100644 --- a/krita/image/generator/kis_generator_layer.h +++ b/krita/image/generator/kis_generator_layer.h @@ -1,90 +1,90 @@ /* * Copyright (c) 2008 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_GENERATOR_LAYER_H_ #define KIS_GENERATOR_LAYER_H_ #include "kis_selection_based_layer.h" -#include +#include #include class KisFilterConfiguration; /** * A generator layer is a special kind of layer that can be prefilled * with some pixel pattern generated by a KisGenerator plugin. * A KisGenerator is similar to a filter, but doesn't take * input pixel data and creates new pixel data. * * It is not possible to destructively paint on a generator layer. * * XXX: what about threadedness? */ class KRITAIMAGE_EXPORT KisGeneratorLayer : public KisSelectionBasedLayer { Q_OBJECT public: /** * Create a new Generator layer with the given configuration * and selection. Note that the selection will be _copied_ * (using COW, though). */ KisGeneratorLayer(KisImageWSP image, const QString &name, KisFilterConfiguration * kfc, KisSelectionSP selection); KisGeneratorLayer(const KisGeneratorLayer& rhs); virtual ~KisGeneratorLayer(); KisNodeSP clone() const { return KisNodeSP(new KisGeneratorLayer(*this)); } void setFilter(KisFilterConfiguration *filterConfig); bool accept(KisNodeVisitor &); void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter); QIcon icon() const; KisDocumentSectionModel::PropertyList sectionModelProperties() const; /** * re-run the generator. This happens over the bounds * of the associated selection. */ void update(); using KisSelectionBasedLayer::setDirty; void setDirty(const QRect & rect); void setX(qint32 x); void setY(qint32 y); private Q_SLOTS: void slotDelayedStaticUpdate(); public: // KisIndirectPaintingSupport KisLayer* layer() { return this; } private: struct Private; const QScopedPointer m_d; }; #endif diff --git a/krita/image/generator/kis_generator_registry.h b/krita/image/generator/kis_generator_registry.h index 6bbd8cc15d1..d3fdf1b78d8 100644 --- a/krita/image/generator/kis_generator_registry.h +++ b/krita/image/generator/kis_generator_registry.h @@ -1,59 +1,59 @@ /* * Copyright (c) 2008 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_GENERATOR_REGISTRY_H_ #define KIS_GENERATOR_REGISTRY_H_ #include #include "kis_types.h" #include "KoGenericRegistry.h" -#include +#include class QString; class KisFilterConfiguration; /** * XXX_DOCS */ class KRITAIMAGE_EXPORT KisGeneratorRegistry : public QObject, public KoGenericRegistry { Q_OBJECT public: virtual ~KisGeneratorRegistry(); static KisGeneratorRegistry* instance(); void add(KisGeneratorSP item); void add(const QString &id, KisGeneratorSP item); KisFilterConfiguration* cloneConfiguration(KisFilterConfiguration* kfc); Q_SIGNALS: void generatorAdded(QString id); private: KisGeneratorRegistry(QObject *parent); KisGeneratorRegistry(const KisGeneratorRegistry&); KisGeneratorRegistry operator=(const KisGeneratorRegistry&); }; #endif // KIS_GENERATOR_REGISTRY_H_ diff --git a/krita/image/kis_acyclic_signal_connector.h b/krita/image/kis_acyclic_signal_connector.h index 7f4fc1bd3cb..7ee341b7efd 100644 --- a/krita/image/kis_acyclic_signal_connector.h +++ b/krita/image/kis_acyclic_signal_connector.h @@ -1,106 +1,106 @@ /* * Copyright (c) 2014 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_ACYCLIC_SIGNAL_CONNECTOR_H #define __KIS_ACYCLIC_SIGNAL_CONNECTOR_H #include -#include "krita_export.h" +#include "kritaimage_export.h" /** * A special class for connecting UI elements to manager classes. * It allows to avoid direct calling blockSignals() for the sender UI * element all the time. This is the most important when the measured * value can be changed not only by the user through the UI, but also * by the manager according to some internal rules. * * Example: * * Suppose we have the following connections: * * 1) QDoubleSpinBox::valueChanged(double) -> Manager::slotSetValue(double) * 2) Manager::valueChanged(double) -> QDoubleSpinBox::setValue(double) * * Now if the manager decides to change/correct the value, the spinbox * will go into an infinite loop. * * See an example in KisToolCropConfigWidget. */ class KRITAIMAGE_EXPORT KisAcyclicSignalConnector : public QObject { Q_OBJECT public: KisAcyclicSignalConnector(QObject *parent); void connectForwardDouble(QObject *sender, const char *signal, QObject *receiver, const char *method); void connectBackwardDouble(QObject *sender, const char *signal, QObject *receiver, const char *method); void connectForwardInt(QObject *sender, const char *signal, QObject *receiver, const char *method); void connectBackwardInt(QObject *sender, const char *signal, QObject *receiver, const char *method); void connectForwardBool(QObject *sender, const char *signal, QObject *receiver, const char *method); void connectBackwardBool(QObject *sender, const char *signal, QObject *receiver, const char *method); void connectForwardVoid(QObject *sender, const char *signal, QObject *receiver, const char *method); void connectBackwardVoid(QObject *sender, const char *signal, QObject *receiver, const char *method); private Q_SLOTS: void forwardSlotDouble(double value); void backwardSlotDouble(double value); void forwardSlotInt(int value); void backwardSlotInt(int value); void forwardSlotBool(bool value); void backwardSlotBool(bool value); void forwardSlotVoid(); void backwardSlotVoid(); Q_SIGNALS: void forwardSignalDouble(double value); void backwardSignalDouble(double value); void forwardSignalInt(int value); void backwardSignalInt(int value); void forwardSignalBool(bool value); void backwardSignalBool(bool value); void forwardSignalVoid(); void backwardSignalVoid(); private: int m_signalsBlocked; }; #endif /* __KIS_ACYCLIC_SIGNAL_CONNECTOR_H */ diff --git a/krita/image/kis_adjustment_layer.h b/krita/image/kis_adjustment_layer.h index 83584d1e93b..6c1a034acf2 100644 --- a/krita/image/kis_adjustment_layer.h +++ b/krita/image/kis_adjustment_layer.h @@ -1,123 +1,123 @@ /* * Copyright (c) 2006 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. */ /** * @file * This file is part of the Krita calligra application. It handles * a contains a KisFilter OR a KisLayer, and this class is created * to influence the rendering of layers below this one. Can also * function as a fixating layer. * * @author Boudewijn Rempt * @author comments by hscott * @since 1.5 */ #ifndef KIS_ADJUSTMENT_LAYER_H_ #define KIS_ADJUSTMENT_LAYER_H_ #include -#include +#include #include "kis_selection_based_layer.h" class KisFilterConfiguration; /** * @class KisAdjustmentLayer Contains a KisFilter and a KisSelection. * If the selection is present, it is a mask used by the adjustment layer * to know where to apply the filter, thus the combination is used * to influence the rendering of the layers under this layer * in the layerstack. AdjustmentLayers also function as a kind * of "fixating layers". */ class KRITAIMAGE_EXPORT KisAdjustmentLayer : public KisSelectionBasedLayer { Q_OBJECT public: /** * creates a new adjustment layer with the given * configuration and selection. Note that the selection * will be _copied_ (with COW, though). * @param image the image to set this AdjustmentLayer to * @param name name of the adjustment layer * @param kfc the configuration for the adjustment layer filter * @param selection is a mask used by the adjustment layer to * know where to apply the filter. */ KisAdjustmentLayer(KisImageWSP image, const QString &name, KisFilterConfiguration * kfc, KisSelectionSP selection); KisAdjustmentLayer(const KisAdjustmentLayer& rhs); virtual ~KisAdjustmentLayer(); bool accept(KisNodeVisitor &); void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter); /** * clones this AdjustmentLayer into a KisNodeSP type. * @return the KisNodeSP returned */ KisNodeSP clone() const { return KisNodeSP(new KisAdjustmentLayer(*this)); } /** * gets the adjustmentLayer's tool filter * @return QIcon returns the KIcon tool filter */ QIcon icon() const; /** * gets the AdjustmentLayer properties describing whether * or not the node is locked, visible, and the filter * name is it is a filter. Overrides sectionModelProperties * in KisLayer, and KisLayer overrides * sectionModelProperties in KisBaseNode. * @return KisDocumentSectionModel::PropertyList returns a list * of the properties */ KisDocumentSectionModel::PropertyList sectionModelProperties() const; public: /** * \see KisNodeFilterInterface::setFilter() */ void setFilter(KisFilterConfiguration *filterConfig); void setChannelFlags(const QBitArray & channelFlags); protected: // override from KisLayer QRect incomingChangeRect(const QRect &rect) const; // override from KisNode QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const; public Q_SLOTS: /** * gets this AdjustmentLayer. Overrides function in * KisIndirectPaintingSupport * @return this AdjustmentLayer */ KisLayer* layer() { return this; } }; #endif // KIS_ADJUSTMENT_LAYER_H_ diff --git a/krita/image/kis_algebra_2d.h b/krita/image/kis_algebra_2d.h index b5f0121aedf..c5383530aa1 100644 --- a/krita/image/kis_algebra_2d.h +++ b/krita/image/kis_algebra_2d.h @@ -1,260 +1,260 @@ /* * Copyright (c) 2014 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_ALGEBRA_2D_H #define __KIS_ALGEBRA_2D_H #include #include #include #include #include #include -#include +#include class QPainterPath; namespace KisAlgebra2D { template struct PointTypeTraits { }; template <> struct PointTypeTraits { typedef int value_type; typedef qreal calculation_type; }; template <> struct PointTypeTraits { typedef qreal value_type; typedef qreal calculation_type; }; template typename PointTypeTraits::value_type dotProduct(const T &a, const T &b) { return a.x() * b.x() + a.y() * b.y(); } template typename PointTypeTraits::value_type crossProduct(const T &a, const T &b) { return a.x() * b.y() - a.y() * b.x(); } template qreal norm(const T &a) { return std::sqrt(pow2(a.x()) + pow2(a.y())); } template Point normalize(const Point &a) { const qreal length = norm(a); return (1.0 / length) * a; } /** * Usual sign() function with positive zero */ template T signPZ(T x) { return x >= T(0) ? T(1) : T(-1); } /** * Usual sign() function with zero returning zero */ template T signZZ(T x) { return x == T(0) ? T(0) : x > T(0) ? T(1) : T(-1); } /** * Copies the sign of \p y into \p x and returns the result */ template inline T copysign(T x, T y) { T strippedX = qAbs(x); return y >= T(0) ? strippedX : -strippedX; } template T leftUnitNormal(const T &a) { T result = a.x() != 0 ? T(-a.y() / a.x(), 1) : T(-1, 0); qreal length = norm(result); result *= (crossProduct(a, result) >= 0 ? 1 : -1) / length; return -result; } template T rightUnitNormal(const T &a) { return -leftUnitNormal(a); } template T inwardUnitNormal(const T &a, int polygonDirection) { return polygonDirection * leftUnitNormal(a); } /** * \return 1 if the polygon is counterclockwise * -1 if the polygon is clockwise * * Note: the sign is flipped because our 0y axis * is reversed */ template int polygonDirection(const QVector &polygon) { typename PointTypeTraits::value_type doubleSum = 0; const int numPoints = polygon.size(); for (int i = 1; i <= numPoints; i++) { int prev = i - 1; int next = i == numPoints ? 0 : i; doubleSum += (polygon[next].x() - polygon[prev].x()) * (polygon[next].y() + polygon[prev].y()); } return doubleSum >= 0 ? 1 : -1; } template bool isInRange(T x, T a, T b) { T length = qAbs(a - b); return qAbs(x - a) <= length && qAbs(x - b) <= length; } void KRITAIMAGE_EXPORT adjustIfOnPolygonBoundary(const QPolygonF &poly, int polygonDirection, QPointF *pt); /** * Let \p pt, \p base1 are two vectors. \p base1 is uniformly scaled * and then rotated into \p base2 using transformation matrix S * * R. The function applies the same transformation to \pt and returns * the result. **/ QPointF KRITAIMAGE_EXPORT transformAsBase(const QPointF &pt, const QPointF &base1, const QPointF &base2); qreal KRITAIMAGE_EXPORT angleBetweenVectors(const QPointF &v1, const QPointF &v2); namespace Private { inline void resetEmptyRectangle(const QPoint &pt, QRect *rc) { *rc = QRect(pt, QSize(1, 1)); } inline void resetEmptyRectangle(const QPointF &pt, QRectF *rc) { static const qreal eps = 1e-10; *rc = QRectF(pt, QSizeF(eps, eps)); } } template inline void accumulateBounds(const Point &pt, Rect *bounds) { if (bounds->isEmpty()) { Private::resetEmptyRectangle(pt, bounds); } if (pt.x() > bounds->right()) { bounds->setRight(pt.x()); } if (pt.x() < bounds->left()) { bounds->setLeft(pt.x()); } if (pt.y() > bounds->bottom()) { bounds->setBottom(pt.y()); } if (pt.y() < bounds->top()) { bounds->setTop(pt.y()); } } template inline Point clampPoint(Point pt, const Rect &bounds) { if (pt.x() > bounds.right()) { pt.rx() = bounds.right(); } if (pt.x() < bounds.left()) { pt.rx() = bounds.left(); } if (pt.y() > bounds.bottom()) { pt.ry() = bounds.bottom(); } if (pt.y() < bounds.top()) { pt.ry() = bounds.top(); } return pt; } QPainterPath KRITAIMAGE_EXPORT smallArrow(); /** * Multiply width and height of \p rect by \p coeff keeping the * center of the rectangle pinned */ QRect KRITAIMAGE_EXPORT blowRect(const QRect &rect, qreal coeff); QPoint KRITAIMAGE_EXPORT ensureInRect(QPoint pt, const QRect &bounds); QPointF KRITAIMAGE_EXPORT ensureInRect(QPointF pt, const QRectF &bounds); QRect KRITAIMAGE_EXPORT ensureRectNotSmaller(QRect rc, const QSize &size); /** * Attempt to intersect a line to the area of the a rectangle. * * If the line intersects the rectange, it will be modified to represent the intersecting line segment and true is returned. * If the line does not intersect the area, it remains unmodified and false will be returned. * * @param segment * @param area * @return true if successful */ bool KRITAIMAGE_EXPORT intersectLineRect(QLineF &line, const QRect rect); template inline Point abs(const Point &pt) { return Point(qAbs(pt.x()), qAbs(pt.y())); } } #endif /* __KIS_ALGEBRA_2D_H */ diff --git a/krita/image/kis_async_merger.h b/krita/image/kis_async_merger.h index 418d0d393a2..cca09ade993 100644 --- a/krita/image/kis_async_merger.h +++ b/krita/image/kis_async_merger.h @@ -1,70 +1,70 @@ /* Copyright (c) Dmitry Kazakov , 2009 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef __KIS_ASYNC_MERGER_H #define __KIS_ASYNC_MERGER_H -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" #include "kis_paint_device.h" class QRect; class KisBaseRectsWalker; class KRITAIMAGE_EXPORT KisAsyncMerger { public: void startMerge(KisBaseRectsWalker &walker, bool notifyClones = true); private: inline void resetProjection(); inline void setupProjection(KisProjectionLeafSP currentLeaf, const QRect& rect, bool useTempProjection); inline void writeProjection(KisProjectionLeafSP topmostLeaf, bool useTempProjection, QRect rect); inline bool compositeWithProjection(KisProjectionLeafSP leaf, const QRect &rect); inline void doNotifyClones(KisBaseRectsWalker &walker); private: /** * The place where intermediate results of layer's merge * are going. It may be equal to m_finalProjection. In * this case the projection will be written directly to * the original of the parent layer */ KisPaintDeviceSP m_currentProjection; /** * The final destination of every projection of all * the layers. It is equal to the original of a parental * node. * NOTE: This pointer is cached here to avoid * race conditions */ KisPaintDeviceSP m_finalProjection; /** * Creation of the paint device is quite expensive, so we'll just * save the pointer to our temporary device here and will get it when * needed. This variable must not be used anywhere out of * setupProjection() */ KisPaintDeviceSP m_cachedPaintDevice; }; #endif /* __KIS_ASYNC_MERGER_H */ diff --git a/krita/image/kis_base_accessor.h b/krita/image/kis_base_accessor.h index f8fe1da98de..2cc89bb8573 100644 --- a/krita/image/kis_base_accessor.h +++ b/krita/image/kis_base_accessor.h @@ -1,59 +1,59 @@ /* This file is part of the KDE project * 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 _KISBASEACCESSOR_H_ #define _KISBASEACCESSOR_H_ -#include +#include #include class KRITAIMAGE_EXPORT KisBaseConstAccessor : public KisShared { Q_DISABLE_COPY(KisBaseConstAccessor) public: KisBaseConstAccessor() {} virtual ~KisBaseConstAccessor(); /** * @return a pointer to the pixel data as it was at the moment of the last memento creation. */ virtual const quint8 * oldRawData() const = 0; /** * @return a pointer to the most actual pixel data, * this points to te same data as rawData() method of * a writable accessor */ virtual const quint8 * rawDataConst() const = 0; virtual qint32 x() const = 0; virtual qint32 y() const = 0; }; class KRITAIMAGE_EXPORT KisBaseAccessor { Q_DISABLE_COPY(KisBaseAccessor) public: KisBaseAccessor() {} virtual ~KisBaseAccessor(); /** * @return a pointer to the pixel data. Do NOT interpret the data - leave that to a colorspace */ virtual quint8 * rawData() = 0; }; #endif diff --git a/krita/image/kis_base_mask_generator.h b/krita/image/kis_base_mask_generator.h index 14aa61ab571..495883e3b81 100644 --- a/krita/image/kis_base_mask_generator.h +++ b/krita/image/kis_base_mask_generator.h @@ -1,138 +1,138 @@ /* * Copyright (c) 2008-2009 Cyrille Berger * Copyright (c) 2010 Lukáš Tvrdý * * 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_MASK_GENERATOR_H_ #define _KIS_MASK_GENERATOR_H_ #include "kis_brush_mask_applicator_base.h" // vc.h must come first #include #include -#include "krita_export.h" +#include "kritaimage_export.h" class QDomElement; class QDomDocument; const KoID DefaultId("default", ki18n("Default")); ///< generate Krita default mask generator const KoID SoftId("soft", ki18n("Soft")); ///< generate brush mask from former softbrush paintop, where softness is based on curve const KoID GaussId("gauss", ki18n("Gaussian")); ///< generate brush mask with a Gaussian-blurred edge static const int OVERSAMPLING = 4; /** * This is the base class for mask shapes * You should subclass it if you want to create a new * shape. */ class KRITAIMAGE_EXPORT KisMaskGenerator { public: enum Type { CIRCLE, RECTANGLE }; public: /** * This function creates an auto brush shape with the following value : * @param w width * @param h height * @param fh horizontal fade (fh \< w / 2 ) * @param fv vertical fade (fv \< h / 2 ) */ KisMaskGenerator(qreal radius, qreal ratio, qreal fh, qreal fv, int spikes, bool antialiasEdges, Type type, const KoID& id = DefaultId); virtual ~KisMaskGenerator(); private: void init(); public: /** * @return the alpha value at the position (x,y) */ virtual quint8 valueAt(qreal x, qreal y) const = 0; virtual bool shouldSupersample() const; virtual bool shouldVectorize() const; virtual KisBrushMaskApplicatorBase* applicator(); virtual void toXML(QDomDocument& , QDomElement&) const; /** * Unserialise a \ref KisMaskGenerator */ static KisMaskGenerator* fromXML(const QDomElement&); qreal width() const; qreal height() const; qreal diameter() const; qreal ratio() const; qreal horizontalFade() const; qreal verticalFade() const; int spikes() const; Type type() const; inline QString id() const { return m_id.id(); } inline QString name() const { return m_id.name(); } static QList maskGeneratorIds(); qreal softness() const; virtual void setSoftness(qreal softness); QString curveString() const; void setCurveString(const QString& curveString); bool antialiasEdges() const; virtual void setScale(qreal scaleX, qreal scaleY); protected: qreal effectiveSrcWidth() const; qreal effectiveSrcHeight() const; protected: struct Private { qreal diameter, ratio; qreal softness; qreal fh, fv; int spikes; qreal cachedSpikesAngle; qreal cs, ss; bool empty; Type type; QString curveString; bool antialiasEdges; qreal scaleX; qreal scaleY; KisBrushMaskApplicatorBase *defaultMaskProcessor; }; Private* const d; private: const KoID& m_id; }; #endif diff --git a/krita/image/kis_base_node.h b/krita/image/kis_base_node.h index a6e4fab5462..c495de13e5b 100644 --- a/krita/image/kis_base_node.h +++ b/krita/image/kis_base_node.h @@ -1,441 +1,441 @@ /* * 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_BASE_NODE_H #define _KIS_BASE_NODE_H #include #include #include #include #include "KisDocumentSectionModel.h" #include "kis_shared.h" #include "kis_paint_device.h" #include "kis_processing_visitor.h" // included, not forward declared for msvc class KoProperties; class KoColorSpace; class KoCompositeOp; class KisNodeVisitor; class KisUndoAdapter; -#include "krita_export.h" +#include "kritaimage_export.h" /** * A KisBaseNode is the base class for all components of an image: * nodes, layers masks, selections. A node has a number of properties, * can be represented as a thumbnail and knows what to do when it gets * a certain paint device to process. A KisBaseNode does not know * anything about its peers. You should not directly inherit from a * KisBaseNode; inherit from KisNode instead. */ class KRITAIMAGE_EXPORT KisBaseNode : public QObject, public KisShared { Q_OBJECT public: /** * Create a new, empty base node. The node is unnamed, unlocked * visible and unlinked. */ KisBaseNode(); /** * Create a copy of this node. */ KisBaseNode(const KisBaseNode & rhs); /** * Delete this node */ virtual ~KisBaseNode(); /** * Return the paintdevice you can use to change pixels on. For a * paint layer these will be paint pixels, for an adjustment layer or a mask * the selection paint device. * * @return the paint device to paint on. Can be 0 if the actual * node type does not support painting. */ virtual KisPaintDeviceSP paintDevice() const; /** * @return the rendered representation of a node * before the effect masks have had their go at it. Can be 0. */ virtual KisPaintDeviceSP original() const; /** * @return the fully rendered representation of this layer: its * rendered original and its effect masks. Can be 0. */ virtual KisPaintDeviceSP projection() const; virtual const KoColorSpace *colorSpace() const = 0; /** * Return the opacity of this layer, scaled to a range between 0 * and 255. * XXX: Allow true float opacity */ quint8 opacity() const; //0-255 /** * Set the opacity for this layer. The range is between 0 and 255. * The layer will be marked dirty. * * XXX: Allow true float opacity */ void setOpacity(quint8 val); //0-255 /** * return the 8-bit opacity of this layer scaled to the range * 0-100 * * XXX: Allow true float opacity */ quint8 percentOpacity() const; //0-100 /** * Set the opacity of this layer with a number between 0 and 100; * the number will be scaled to between 0 and 255. * XXX: Allow true float opacity */ void setPercentOpacity(quint8 val); //0-100 /** * Return the composite op associated with this layer. */ virtual const KoCompositeOp *compositeOp() const = 0; const QString& compositeOpId() const; /** * Set a new composite op for this layer. The layer will be marked * dirty. */ void setCompositeOp(const QString& compositeOpId); /** * @return unique id, which is now used by clone layers. */ QUuid uuid() const; /** * Set the uuid of node. This should only be used when loading * existing node and in constructor. */ void setUuid(const QUuid& id); /** * return the name of this node. This is the same as the * QObject::objectName. */ QString name() const { return objectName(); } /** * set the QObject::objectName. This is also the user-visible name * of the layer. The reason for this is that we want to see the * layer name also when debugging. */ void setName(const QString& name) { setObjectName(name); baseNodeChangedCallback(); } /** * @return the icon used to represent the node type, for instance * in the layerbox and in the menu. */ virtual QIcon icon() const { return QIcon(); }; /** * Return a the properties of this base node (locked, visible etc, * with the right icons for their representation and their state. * * Subclasses can extend this list with new properties, like * opacity for layers or visualized for masks. * * The order of properties is, unfortunately, for now, important, * so take care which properties superclasses of your class * define. * * KisBaseNode defines visible = 0, locked = 1 * KisLayer defines opacity = 2, compositeOp = 3 * KisMask defines active = 2 (KisMask does not inherit kislayer) */ virtual KisDocumentSectionModel::PropertyList sectionModelProperties() const; /** * Change the section model properties. */ virtual void setSectionModelProperties(const KisDocumentSectionModel::PropertyList &properties); /** * Return all the properties of this layer as a KoProperties-based * serializable key-value list. */ KoProperties & nodeProperties() const; /** * Merge the specified properties with the properties of this * layer. Whereever these properties overlap, the value of the * node properties is changed. No properties on the node are * deleted. If there are new properties in this list, they will be * added on the node. */ void mergeNodeProperties(const KoProperties & properties); /** * Compare the given properties list with the properties of this * node. * * @return false only if the same property exists in both lists * but with a different value. Properties that are not in both * lists are disregarded. */ bool check(const KoProperties & properties) const; /** * Accept the KisNodeVisitor (for the Visitor design pattern), * should call the correct function on the KisNodeVisitor for this * node type, so you need to override it for all leaf classes in * the node inheritance hierarchy. * * return false if the visitor could not successfully act on this * node instance. */ virtual bool accept(KisNodeVisitor &) { return false; } /** * Accept the KisNodeVisitor (for the Visitor design pattern), * should call the correct function on the KisProcessingVisitor * for this node type, so you need to override it for all leaf * classes in the node inheritance hierarchy. * * The processing visitor differs from node visitor in the way * that it accepts undo adapter, that allows the processing to * be multithreaded */ virtual void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) { Q_UNUSED(visitor); Q_UNUSED(undoAdapter); } /** * @return a thumbnail in requested size. The thumbnail is a rgba * QImage and may have transparent parts. Returns a fully * transparent QImage of the requested size if the current node * type cannot generate a thumbnail. If the requested size is too * big, return a null QImage. */ virtual QImage createThumbnail(qint32 w, qint32 h); /** * Ask this node to re-read the pertinent settings from the krita * configuration. */ virtual void updateSettings() { } /** * @return true if this node is visible (i.e, active (except for * selection masks where visible and active properties are * different)) in the graph */ virtual bool visible(bool recursive = false) const; /** * Set the visible status of this node. Visible nodes are active * in the graph (except for selections masks which can be active * while hidden), that is to say, they are taken into account * when merging. Invisible nodes play no role in the final image *, but will be modified when modifying all layers, for instance * when cropping. * * Toggling the visibility of a node will not automatically lead * to recomposition. * * @param visible the new visibility state * @param isLoading if true, the property is set during loading. */ virtual void setVisible(bool visibile, bool loading = false); /** * Return the locked status of this node. Locked nodes cannot be * edited. */ bool userLocked() const; /** * Set the locked status of this node. Locked nodes cannot be * edited. */ void setUserLocked(bool l); /** * Return the locked status of this node. System Locked nodes indicates * that an algorithm is processing them and that an other * algorithm need to wait before accessing it. */ bool systemLocked() const; /** * Set the locked status of this node. System Locked nodes indicates * that an algorithm is processing them and that an other * algorithm need to wait before accessing it. * * A KisNode will update the layer model when the lock is released. * * @param l lock state * @param update set false if the tools shouldn't be locked */ virtual void setSystemLocked(bool l, bool update = true); /** * @return true if the node can be edited: * * if checkVisibility is true, then the node is only editable if it is visible and not locked. * if checkVisibility is false, then the node is editable if it's not locked. */ bool isEditable(bool checkVisibility = true) const; /** * @return true if the node is editable and has a paintDevice() * which which can be used for accessing pixels. It is an * equivalent to (isEditable() && paintDevice()) */ bool hasEditablePaintDevice() const; /** * @return the x-offset of this layer in the image plane. */ virtual qint32 x() const { return 0; } /** * Set the x offset of this layer in the image place. * Re-implement this where it makes sense, by default it does * nothing. It should not move child nodes. */ virtual void setX(qint32) { } /** * @return the y-offset of this layer in the image plane. */ virtual qint32 y() const { return 0; } /** * Set the y offset of this layer in the image place. * Re-implement this where it makes sense, by default it does * nothing. It should not move child nodes. */ virtual void setY(qint32) { } /** * Returns an approximation of where the bounds on actual data are * in this node. */ virtual QRect extent() const { return QRect(); } /** * Returns the exact bounds of where the actual data resides in * this node. */ virtual QRect exactBounds() const { return QRect(); } /** * Sets the state of the node to the value of @param collapsed */ void setCollapsed(bool collapsed); /** * returns the collapsed state of this node */ bool collapsed() const; protected: /** * FIXME: This method is a workaround for getting parent node * on a level of KisBaseNode. In fact, KisBaseNode should inherit * KisNode (in terms of current Krita) to be able to traverse * the node stack */ virtual KisBaseNodeSP parentCallback() const { return 0; } virtual void notifyParentVisibilityChanged(bool value) { Q_UNUSED(value); } /** * This callback is called when some meta state of the base node * that can be interesting to the UI has changed. E.g. visibility, * lockness, opacity, compositeOp and etc. This signal is * forwarded by the KisNode and KisNodeGraphListener to the model * in KisLayerBox, so it can update its controls when information * changes. */ virtual void baseNodeChangedCallback() { } Q_SIGNALS: /** * This signal is emitted when the visibility of the layer is changed with \ref setVisible. */ void visibilityChanged(bool); /** * This signal is emitted when the node is locked or unlocked with \ref setUserLocked. */ void userLockingChanged(bool); /** * This signal is emitted when the node is locked or unlocked with \ref setSystemLocked. */ void systemLockingChanged(bool); private: struct Private; Private * const m_d; }; #endif diff --git a/krita/image/kis_base_processor.h b/krita/image/kis_base_processor.h index 81f387bfddb..922a8358474 100644 --- a/krita/image/kis_base_processor.h +++ b/krita/image/kis_base_processor.h @@ -1,167 +1,167 @@ /* * Copyright (c) 2008 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_BASE_PROCESSOR_H_ #define _KIS_BASE_PROCESSOR_H_ #include #include #include #include #include "KoID.h" #include "KoColorSpace.h" #include "kis_types.h" #include "kis_shared.h" #include "kis_image.h" -#include "krita_export.h" +#include "kritaimage_export.h" class QWidget; class KisBookmarkedConfigurationManager; class KisFilterConfiguration; class KisConfigWidget; /** * Base class for classes that process areas of pixels. * Processors can either read in pixels and write out pixels * or just write out pixels, using a certain set of configuation * pixels. * * in-out processing is typically filtering: @see KisFilter. * out-only processing is typiccaly generating: @see KisGenerator. * * Information about the area that needs to be processed is contained * @see KisProcessingInformation and @see KisConstProcessingInformation. */ class KRITAIMAGE_EXPORT KisBaseProcessor : public KisShared { friend class KisBaseProcessorConfigurationFactory; public: KisBaseProcessor(const KoID& id, const KoID & category, const QString & entry); virtual ~KisBaseProcessor(); /** * Return the configuration set as the default by the user or the default * configuration from the filter writer as returned by factoryConfiguration. * * This configuration is used by default for the configuration widget and * given to the process function if there is no configuration widget. * * @return the default configuration of this widget */ KisFilterConfiguration * defaultConfiguration(const KisPaintDeviceSP) const; /** * @return the bookmark manager for this processor */ KisBookmarkedConfigurationManager* bookmarkManager(); /** * @return the bookmark manager for this processor */ const KisBookmarkedConfigurationManager* bookmarkManager() const; /// @return Unique identification for this processor QString id() const; /// @return User-visible identification for this processor QString name() const; /// @return the submenu in the filters menu does processor want to go? KoID menuCategory() const; /// @return the i18n'ed string this filter wants to show itself in the menu QString menuEntry() const; /** * Return the default keyboard shortcut for activation of this filter * * @return the shortcut */ KShortcut shortcut() const; /** * Create the configuration widget for this processor. * * @param parent the Qt owner widget of this widget * @param dev the paintdevice this filter will act on */ virtual KisConfigWidget * createConfigurationWidget(QWidget * parent, const KisPaintDeviceSP dev) const; // "Support" functions public: /** * If true, this filter can be used in painting tools as a paint operation */ bool supportsPainting() const; /// This filter can be used in adjustment layers bool supportsAdjustmentLayers() const; /** * This filter supports cutting up the work area and filtering * each chunk in a separate thread. Filters that need access to the * whole area for correct computations should return false. */ bool supportsThreading() const; /// If true, the filter wants to show a configuration widget bool showConfigurationWidget(); /** * Determine the colorspace independence of this filter. * @see ColorSpaceIndependence * * @return the degree of independence */ ColorSpaceIndependence colorSpaceIndependence() const; /// @return the default configuration as defined by whoever wrote the plugin virtual KisFilterConfiguration* factoryConfiguration(const KisPaintDeviceSP) const; protected: void setSupportsPainting(bool v); void setSupportsAdjustmentLayers(bool v); void setSupportsThreading(bool v); void setColorSpaceIndependence(ColorSpaceIndependence v); void setShowConfigurationWidget(bool v); /** * Set the default shortcut for activation of this filter. */ void setShortcut(const KShortcut & shortcut); protected: void init(const QString& configEntryGroup); private: struct Private; Private* const d; }; #endif diff --git a/krita/image/kis_basic_math_toolbox.h b/krita/image/kis_basic_math_toolbox.h index 41b7729cc0f..98aaf25aefa 100644 --- a/krita/image/kis_basic_math_toolbox.h +++ b/krita/image/kis_basic_math_toolbox.h @@ -1,44 +1,44 @@ /* * This file is part of the KDE project * * Copyright (c) 2005 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_BASIC_MATH_TOOLBOX_H #define KIS_BASIC_MATH_TOOLBOX_H #include "kis_math_toolbox.h" -#include "krita_export.h" +#include "kritaimage_export.h" /** * This class implement KisMathToolbox for most colorspaces, only colorspaces with "angular" * channels need to reimplement the functions */ class KRITAIMAGE_EXPORT KisBasicMathToolbox : public KisMathToolbox { public: KisBasicMathToolbox(); ~KisBasicMathToolbox(); public: virtual KisWavelet* fastWaveletTransformation(KisPaintDeviceSP src, const QRect&, KisWavelet* buff = 0); virtual void fastWaveletUntransformation(KisPaintDeviceSP dst, const QRect&, KisWavelet* wav, KisWavelet* buff = 0); private: void wavetrans(KisWavelet* wav, KisWavelet* buff, uint halfsize); void waveuntrans(KisWavelet* wav, KisWavelet* buff, uint halfsize); }; #endif diff --git a/krita/image/kis_bookmarked_configuration_manager.h b/krita/image/kis_bookmarked_configuration_manager.h index 6d5d8cb6b3f..304a105d474 100644 --- a/krita/image/kis_bookmarked_configuration_manager.h +++ b/krita/image/kis_bookmarked_configuration_manager.h @@ -1,86 +1,86 @@ /* * 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_BOOKMARKED_CONFIGURATION_MANAGER_H_ #define _KIS_BOOKMARKED_CONFIGURATION_MANAGER_H_ #include class KisSerializableConfiguration; class KisSerializableConfigurationFactory; class QString; class KLocalizedString; -#include "krita_export.h" +#include "kritaimage_export.h" class KRITAIMAGE_EXPORT KisBookmarkedConfigurationManager { public: static const char ConfigDefault[]; static const char ConfigLastUsed[]; public: /** * @param configEntryGroup name of the configuration entry with the * bookmarked configurations. */ KisBookmarkedConfigurationManager(const QString & configEntryGroup, KisSerializableConfigurationFactory*); ~KisBookmarkedConfigurationManager(); /** * Load the configuration. */ KisSerializableConfiguration* load(const QString & configname) const; /** * Save the configuration. */ void save(const QString & configname, const KisSerializableConfiguration*); /** * @return true if the configuration configname exists */ bool exists(const QString & configname) const; /** * @return the list of the names of configurations. */ QList configurations() const; /** * @return the default configuration */ KisSerializableConfiguration* defaultConfiguration() const; /** * Remove a bookmarked configuration */ void remove(const QString & name); /** * Generate an unique name, for instance when the user is creating a new * entry. * @param base the base of the new name, including a "%1" for incrementing * the number, for instance : "New Configuration %1", then this function * will return the string where %1 will be replaced by the lowest number * and be inexistant in the lists of configuration */ QString uniqueName(const KLocalizedString & base); private: QString configEntryGroup() const; private: struct Private; Private* const d; }; #endif diff --git a/krita/image/kis_cached_gradient_shape_strategy.h b/krita/image/kis_cached_gradient_shape_strategy.h index 216a04dcff2..7045917d131 100644 --- a/krita/image/kis_cached_gradient_shape_strategy.h +++ b/krita/image/kis_cached_gradient_shape_strategy.h @@ -1,43 +1,43 @@ /* * Copyright (c) 2014 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_CACHED_GRADIENT_SHAPE_STRATEGY_H #define __KIS_CACHED_GRADIENT_SHAPE_STRATEGY_H #include "kis_gradient_shape_strategy.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include class QRect; class KRITAIMAGE_EXPORT KisCachedGradientShapeStrategy : public KisGradientShapeStrategy { public: KisCachedGradientShapeStrategy(const QRect &rc, qreal xStep, qreal yStep, KisGradientShapeStrategy *baseStrategy); ~KisCachedGradientShapeStrategy(); double valueAt(double x, double y) const; private: struct Private; const QScopedPointer m_d; }; #endif /* __KIS_CACHED_GRADIENT_SHAPE_STRATEGY_H */ diff --git a/krita/image/kis_cage_transform_worker.h b/krita/image/kis_cage_transform_worker.h index fdf31a95ed3..00bb233628d 100644 --- a/krita/image/kis_cage_transform_worker.h +++ b/krita/image/kis_cage_transform_worker.h @@ -1,55 +1,55 @@ /* * Copyright (c) 2014 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_CAGE_TRANSFORM_WORKER_H #define __KIS_CAGE_TRANSFORM_WORKER_H #include -#include +#include #include class QImage; class KRITAIMAGE_EXPORT KisCageTransformWorker { public: KisCageTransformWorker(KisPaintDeviceSP dev, const QVector &origCage, KoUpdater *progress, int pixelPrecision = 8); KisCageTransformWorker(const QImage &srcImage, const QPointF &srcImageOffset, const QVector &origCage, KoUpdater *progress, int pixelPrecision = 8); ~KisCageTransformWorker(); void prepareTransform(); void setTransformedCage(const QVector &transformedCage); void run(); QImage runOnQImage(QPointF *newOffset); private: struct Private; const QScopedPointer m_d; }; #endif /* __KIS_CAGE_TRANSFORM_WORKER_H */ diff --git a/krita/image/kis_circle_mask_generator.h b/krita/image/kis_circle_mask_generator.h index 6469e504f56..1141801d64f 100644 --- a/krita/image/kis_circle_mask_generator.h +++ b/krita/image/kis_circle_mask_generator.h @@ -1,60 +1,60 @@ /* * Copyright (c) 2008-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_CIRCLE_MASK_GENERATOR_H_ #define _KIS_CIRCLE_MASK_GENERATOR_H_ -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_mask_generator.h" /** * Create, serialize and deserialize an elliptical 8-bit mask. */ class KRITAIMAGE_EXPORT KisCircleMaskGenerator : public KisMaskGenerator { public: struct FastRowProcessor; public: KisCircleMaskGenerator(qreal radius, qreal ratio, qreal fh, qreal fv, int spikes, bool antialiasEdges); virtual ~KisCircleMaskGenerator(); virtual quint8 valueAt(qreal x, qreal y) const; virtual bool shouldSupersample() const; virtual bool shouldVectorize() const; KisBrushMaskApplicatorBase* applicator(); virtual void setSoftness(qreal softness); virtual void setScale(qreal scaleX, qreal scaleY); private: qreal norme(qreal a, qreal b) const { return a*a + b * b; } private: struct Private; Private* const d; }; #endif diff --git a/krita/image/kis_clone_layer.h b/krita/image/kis_clone_layer.h index 0e6f0353204..8ea67321e40 100644 --- a/krita/image/kis_clone_layer.h +++ b/krita/image/kis_clone_layer.h @@ -1,134 +1,134 @@ /* * 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_CLONE_LAYER_H_ #define KIS_CLONE_LAYER_H_ #include #include "kis_types.h" #include "kis_layer.h" #include "kis_indirect_painting_support.h" -#include +#include #include "kis_clone_info.h" class KisNodeVisitor; enum CopyLayerType { COPY_PROJECTION, COPY_ORIGINAL }; /** * A copy layer adds the contents of another layer in another place in * the layer stack. It is possible to add more effect masks to the * copy. You can either copy the original data or the projection data * produced by the original layer + original effect masks. There is no * physical copy of the data; if the original changes, the copy * changes too. The copy layer can be positioned differently from the * original layer. **/ class KRITAIMAGE_EXPORT KisCloneLayer : public KisLayer { Q_OBJECT public: KisCloneLayer(KisLayerSP from, KisImageWSP image, const QString &name, quint8 opacity); KisCloneLayer(const KisCloneLayer& rhs); virtual ~KisCloneLayer(); KisNodeSP clone() const { return KisNodeSP(new KisCloneLayer(*this)); } /** * When the source layer of the clone is removed from the stack * we should substitute the clone with a usual paint layer, * because the source might become unreachable quite soon. This * method builds a paint layer representation of this clone. */ KisLayerSP reincarnateAsPaintLayer() const; bool allowAsChild(KisNodeSP) const; KisPaintDeviceSP original() const; KisPaintDeviceSP paintDevice() const; bool needProjection() const; QIcon icon() const; KisDocumentSectionModel::PropertyList sectionModelProperties() const; qint32 x() const; qint32 y() const; void setX(qint32); void setY(qint32); /// Returns an approximation of where the bounds on actual data are in this layer QRect extent() const; /// Returns the exact bounds of where the actual data resides in this layer QRect exactBounds() const; bool accept(KisNodeVisitor &); void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter); /** * Used when loading: loading is done in two passes, and the copy * from layer is set when all layers have been created, not during * loading. */ void setCopyFromInfo(KisCloneInfo info); KisCloneInfo copyFromInfo() const; void setCopyFrom(KisLayerSP layer); KisLayerSP copyFrom() const; void setCopyType(CopyLayerType type); CopyLayerType copyType() const; /** * This function is called by the original to notify * us that it is dirty */ void setDirtyOriginal(const QRect &rect); QRect needRectOnSourceForMasks(const QRect &rc) const; protected: // override from KisNode QRect accessRect(const QRect &rect, PositionToFilthy pos) const; // override from KisLayer void copyOriginalToProjection(const KisPaintDeviceSP original, KisPaintDeviceSP projection, const QRect& rect) const; void notifyParentVisibilityChanged(bool value); QRect outgoingChangeRect(const QRect &rect) const; private: struct Private; Private * const m_d; }; #endif // KIS_CLONE_LAYER_H_ diff --git a/krita/image/kis_colorspace_convert_visitor.h b/krita/image/kis_colorspace_convert_visitor.h index 0bf6d39e3aa..c249218e8ff 100644 --- a/krita/image/kis_colorspace_convert_visitor.h +++ b/krita/image/kis_colorspace_convert_visitor.h @@ -1,85 +1,85 @@ /* * Copyright (c) 2005 C. Boemann * * 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_COLORSPACE_CONVERT_VISITOR_H_ #define KIS_COLORSPACE_CONVERT_VISITOR_H_ #include #include -#include +#include #include "kis_global.h" #include "kis_types.h" #include "kis_node_visitor.h" /** * This will convert all layers to the destination color space. */ class KRITAIMAGE_EXPORT KisColorSpaceConvertVisitor : public KisNodeVisitor { public: KisColorSpaceConvertVisitor(KisImageWSP image, const KoColorSpace *srcColorSpace, const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags); virtual ~KisColorSpaceConvertVisitor(); public: bool visit(KisPaintLayer *layer); bool visit(KisGroupLayer *layer); bool visit(KisAdjustmentLayer* layer); bool visit(KisGeneratorLayer * layer); bool visit(KisExternalLayer *); bool visit(KisNode*) { return true; } bool visit(KisCloneLayer*) { return true; } bool visit(KisFilterMask*) { return true; } bool visit(KisTransformMask*) { return true; } bool visit(KisTransparencyMask*) { return true; } bool visit(KisSelectionMask*) { return true; } private: bool convertPaintDevice(KisLayer* layer); KisImageWSP m_image; const KoColorSpace *m_srcColorSpace; const KoColorSpace *m_dstColorSpace; KoColorConversionTransformation::Intent m_renderingIntent; KoColorConversionTransformation::ConversionFlags m_conversionFlags; QBitArray m_emptyChannelFlags; }; #endif // KIS_COLORSPACE_CONVERT_VISITOR_H_ diff --git a/krita/image/kis_composite_progress_proxy.h b/krita/image/kis_composite_progress_proxy.h index 834c416a6f6..d27a4c7e0d1 100644 --- a/krita/image/kis_composite_progress_proxy.h +++ b/krita/image/kis_composite_progress_proxy.h @@ -1,42 +1,42 @@ /* * Copyright (c) 2011 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_COMPOSITE_PROGRESS_PROXY_H #define __KIS_COMPOSITE_PROGRESS_PROXY_H #include #include -#include "krita_export.h" +#include "kritaimage_export.h" class KRITAIMAGE_EXPORT KisCompositeProgressProxy : public KoProgressProxy { public: void addProxy(KoProgressProxy *proxy); void removeProxy(KoProgressProxy *proxy); int maximum() const; void setValue(int value); void setRange(int minimum, int maximum); void setFormat(const QString &format); private: QList m_proxies; }; #endif /* __KIS_COMPOSITE_PROGRESS_PROXY_H */ diff --git a/krita/image/kis_config_widget.h b/krita/image/kis_config_widget.h index be8aa7917b6..99fbe01ba88 100644 --- a/krita/image/kis_config_widget.h +++ b/krita/image/kis_config_widget.h @@ -1,94 +1,94 @@ /* * Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org) * Copyright (c) 2004-2006 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_CONFIG_WIDGET_H_ #define _KIS_CONFIG_WIDGET_H_ #include -#include +#include #include class KisViewManager; class KisPropertiesConfiguration; /** * Empty base class. Configurable resources like filters, paintops etc. * can build their own configuration widgets that inherit this class. * The configuration widget should emit sigConfigurationItemChanged * when it wants a preview updated; there is a timer that * waits a little time to see if there are more changes coming * and then emits sigConfigurationUpdated. */ class KRITAIMAGE_EXPORT KisConfigWidget : public QWidget { Q_OBJECT protected: KisConfigWidget(QWidget * parent = 0, Qt::WFlags f = 0, int delay = 500); public: virtual ~KisConfigWidget(); /** * @param config the configuration for this configuration widget. */ virtual void setConfiguration(const KisPropertiesConfiguration * config) = 0; /** * @return the configuration */ virtual KisPropertiesConfiguration* configuration() const = 0; /** * Sets the view object that can be used by the configuration * widget for richer functionality */ virtual void setView(KisViewManager *view); Q_SIGNALS: /** * emitted whenever it makes sense to update the preview */ void sigConfigurationUpdated(); /** * Subclasses should emit this signal whenever the preview should be * be recalculated. This kicks of a timer, so it's perfectly fine * to connect this to the changed signals of the widgets in your configuration * widget. */ void sigConfigurationItemChanged(); void sigSaveLockedConfig(KisPropertiesConfiguration* p); void sigDropLockedConfig(KisPropertiesConfiguration* p); private Q_SLOTS: void slotConfigChanged(); void kickTimer(); private: QTimer m_timer; int m_delay; }; #endif diff --git a/krita/image/kis_convolution_kernel.h b/krita/image/kis_convolution_kernel.h index 63568f07568..7df71dd384a 100644 --- a/krita/image/kis_convolution_kernel.h +++ b/krita/image/kis_convolution_kernel.h @@ -1,64 +1,64 @@ /* * Copyright (c) 2005,2008 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_CONVOLUTION_KERNEL_H_ #define _KIS_CONVOLUTION_KERNEL_H_ #include #include #include "kis_shared.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" using namespace Eigen; class KisMaskGenerator; class QImage; class KRITAIMAGE_EXPORT KisConvolutionKernel : public KisShared { public: KisConvolutionKernel(quint32 width, quint32 height, qreal offset, qreal factor); virtual ~KisConvolutionKernel(); quint32 width() const; quint32 height() const; /** * Change the size of a kernel, it won't reallocate, and therefore it must keep the same kernel size ( oldwidth * oldheight = newwidth*newheight) */ void setSize(quint32 width, quint32 height); qreal offset() const; qreal factor() const; void setFactor(qreal); Matrix& data(); const Matrix * data() const; static KisConvolutionKernelSP fromQImage(const QImage& image); static KisConvolutionKernelSP fromMaskGenerator(KisMaskGenerator *, qreal angle = 0.0); static KisConvolutionKernelSP fromMatrix(Matrix matrix, qreal offset, qreal factor); private: struct Private; Private* const d; }; class QDebug; QDebug operator<<(QDebug debug, const KisConvolutionKernel &c); #endif diff --git a/krita/image/kis_convolution_painter.h b/krita/image/kis_convolution_painter.h index 32832a8fe10..0cf302ba9db 100644 --- a/krita/image/kis_convolution_painter.h +++ b/krita/image/kis_convolution_painter.h @@ -1,93 +1,93 @@ /* * Copyright (c) 2005 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_CONVOLUTION_PAINTER_H_ #define KIS_CONVOLUTION_PAINTER_H_ #include "kis_shared.h" #include "kis_shared_ptr.h" #include "kis_types.h" #include "kis_painter.h" #include "kis_image.h" -#include "krita_export.h" +#include "kritaimage_export.h" template class KisConvolutionWorker; enum KisConvolutionBorderOp { BORDER_IGNORE = 0, // read the pixels outside of the application rect BORDER_REPEAT = 1 // Use the border for the missing pixels }; /** * @brief The KisConvolutionPainter class applies a convolution kernel to a paint device. * * * Note: https://bugs.kde.org/show_bug.cgi?id=220310 shows that there's something here * that we need to fix... */ class KRITAIMAGE_EXPORT KisConvolutionPainter : public KisPainter { public: KisConvolutionPainter(); KisConvolutionPainter(KisPaintDeviceSP device); KisConvolutionPainter(KisPaintDeviceSP device, KisSelectionSP selection); /** * Convolve all channels in src using the specified kernel; there is only one kernel for all * channels possible. By default the border pixels are not convolved, that is, convolving * starts with at (x + kernel.width/2, y + kernel.height/2) and stops at w - (kernel.width/2) * and h - (kernel.height/2) * * The border op decides what to do with pixels too close to the edge of the rect as defined above. * * The channels flag determines which set out of color channels, alpha channels. * channels we convolve. * * Note that we do not (currently) support different kernels for * different channels _or_ channel types. * * If you want to convolve a subset of the channels in a pixel, * set those channels with KisPainter::setChannelFlags(); */ void applyMatrix(const KisConvolutionKernelSP kernel, const KisPaintDeviceSP src, QPoint srcPos, QPoint dstPos, QSize areaSize, KisConvolutionBorderOp borderOp = BORDER_REPEAT); protected: friend class KisConvolutionPainterTest; enum TestingEnginePreference { NONE, SPATIAL, FFTW }; KisConvolutionPainter(KisPaintDeviceSP device, TestingEnginePreference enginePreference); private: template KisConvolutionWorker* createWorker(const KisConvolutionKernelSP kernel, KisPainter *painter, KoUpdater *progress); private: TestingEnginePreference m_enginePreference; }; #endif //KIS_CONVOLUTION_PAINTER_H_ diff --git a/krita/image/kis_count_visitor.h b/krita/image/kis_count_visitor.h index 210d33662c8..3d86eba65a5 100644 --- a/krita/image/kis_count_visitor.h +++ b/krita/image/kis_count_visitor.h @@ -1,120 +1,120 @@ /* * 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_COUNT_VISITOR #define KIS_COUNT_VISITOR -#include "krita_export.h" +#include "kritaimage_export.h" #include #include "kis_node_visitor.h" #include "kis_node.h" #include "kis_paint_layer.h" #include "kis_paint_device.h" #include "kis_group_layer.h" #include "kis_adjustment_layer.h" #include "kis_external_layer_iface.h" #include "kis_clone_layer.h" #include "kis_filter_mask.h" #include "kis_transform_mask.h" #include "kis_transparency_mask.h" #include "kis_selection_mask.h" #include "generator/kis_generator_layer.h" /** * The count visitor traverses the node stack for nodes that conform * to certain properties. You can set the types of nodes to count and * add a list of properties to check. The children of nodes that are * not counted will be checked and counted if they conform to the * requirements. */ class KRITAIMAGE_EXPORT KisCountVisitor : public KisNodeVisitor { public: using KisNodeVisitor::visit; KisCountVisitor(const QStringList & nodeTypes, const KoProperties & properties) : m_nodeTypes(nodeTypes) , m_properties(properties) , m_count(0) { } quint32 count() { return m_count; } bool visit(KisNode* node) { return check(node); } bool visit(KisPaintLayer *layer) { return check(layer); } bool visit(KisGroupLayer *layer) { return check(layer); } bool visit(KisAdjustmentLayer *layer) { return check(layer); } bool visit(KisExternalLayer *layer) { return check(layer); } bool visit(KisCloneLayer *layer) { return check(layer); } bool visit(KisFilterMask *mask) { return check(mask); } bool visit(KisTransformMask *mask) { return check(mask); } bool visit(KisTransparencyMask *mask) { return check(mask); } bool visit(KisGeneratorLayer * layer) { return check(layer); } bool visit(KisSelectionMask* mask) { return check(mask); } private: bool inList(KisNode* node); bool check(KisNode * node); const QStringList m_nodeTypes; const KoProperties m_properties; quint32 m_count; }; #endif diff --git a/krita/image/kis_crop_saved_extra_data.h b/krita/image/kis_crop_saved_extra_data.h index 54cbd575916..9e2f3f79740 100644 --- a/krita/image/kis_crop_saved_extra_data.h +++ b/krita/image/kis_crop_saved_extra_data.h @@ -1,61 +1,61 @@ /* * 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_CROP_SAVED_EXTRA_DATA_H #define __KIS_CROP_SAVED_EXTRA_DATA_H #include #include "kundo2commandextradata.h" #include "kis_types.h" -#include "krita_export.h" +#include "kritaimage_export.h" class KRITAIMAGE_EXPORT KisCropSavedExtraData : public KUndo2CommandExtraData { public: enum Type { CROP_IMAGE, RESIZE_IMAGE, CROP_LAYER }; public: KisCropSavedExtraData(Type type, QRect cropRect, KisNodeSP cropNode = 0); ~KisCropSavedExtraData(); inline Type type() const { return m_type; } inline QRect cropRect() const { return m_cropRect; } inline KisNodeSP cropNode() const { return m_cropNode; } private: Type m_type; QRect m_cropRect; KisNodeSP m_cropNode; }; #endif /* __KIS_CROP_SAVED_EXTRA_DATA_H */ diff --git a/krita/image/kis_cubic_curve.h b/krita/image/kis_cubic_curve.h index 77351dc1baf..2a6cf414d3f 100644 --- a/krita/image/kis_cubic_curve.h +++ b/krita/image/kis_cubic_curve.h @@ -1,81 +1,81 @@ /* * 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_CUBIC_CURVE_H_ #define _KIS_CUBIC_CURVE_H_ #include #include #include -#include +#include class QPointF; const QString DEFAULT_CURVE_STRING = "0,0;1,1;"; /** * Hold the data for a cubic curve. */ class KRITAIMAGE_EXPORT KisCubicCurve { public: KisCubicCurve(); KisCubicCurve(const QList& points); KisCubicCurve(const QVector& points); KisCubicCurve(const KisCubicCurve& curve); ~KisCubicCurve(); KisCubicCurve& operator=(const KisCubicCurve& curve); bool operator==(const KisCubicCurve& curve) const; public: qreal value(qreal x) const; QList points() const; void setPoints(const QList& points); void setPoint(int idx, const QPointF& point); /** * Add a point to the curve, the list of point is always sorted. * @return the index of the inserted point */ int addPoint(const QPointF& point); void removePoint(int idx); bool isNull() const; /** * This allows us to carry around a display name for the curve internally. It is used * currently in Sketch for perchannel, but would potentially be useful anywhere * curves are used in the UI */ void setName(const QString& name); const QString& name() const; public: const QVector uint8Transfer(int size = 256) const; const QVector uint16Transfer(int size = 256) const; const QVector floatTransfer(int size = 256) const; public: QString toString() const; void fromString(const QString&); private: struct Data; struct Private; Private* const d; }; Q_DECLARE_METATYPE(KisCubicCurve) #endif diff --git a/krita/image/kis_curve_circle_mask_generator.h b/krita/image/kis_curve_circle_mask_generator.h index 0decf74884a..cf58aa59816 100644 --- a/krita/image/kis_curve_circle_mask_generator.h +++ b/krita/image/kis_curve_circle_mask_generator.h @@ -1,69 +1,69 @@ /* * Copyright (c) 2010 Lukáš Tvrdý * * 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_CURVE_CIRCLE_MASK_GENERATOR_H_ #define _KIS_CURVE_CIRCLE_MASK_GENERATOR_H_ -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_mask_generator.h" #include #include class KisCubicCurve; class QDomElement; class QDomDocument; class QPointF; /** * This mask generator use softness/hardness defined by user curve * It used to be soft brush paintop. */ class KRITAIMAGE_EXPORT KisCurveCircleMaskGenerator : public KisMaskGenerator { public: KisCurveCircleMaskGenerator(qreal radius, qreal ratio, qreal fh, qreal fv, int spikes,const KisCubicCurve& curve, bool antialiasEdges); virtual ~KisCurveCircleMaskGenerator(); virtual quint8 valueAt(qreal x, qreal y) const; void setScale(qreal scaleX, qreal scaleY); bool shouldSupersample() const; virtual void toXML(QDomDocument& , QDomElement&) const; virtual void setSoftness(qreal softness); static void transformCurveForSoftness(qreal softness,const QList &points, int curveResolution, QVector &result); private: qreal norme(qreal a, qreal b) const { return a*a + b*b; } private: struct Private; Private* const d; }; #endif diff --git a/krita/image/kis_curve_rect_mask_generator.h b/krita/image/kis_curve_rect_mask_generator.h index 503c35b27ab..9d9c9e2a91e 100644 --- a/krita/image/kis_curve_rect_mask_generator.h +++ b/krita/image/kis_curve_rect_mask_generator.h @@ -1,54 +1,54 @@ /* * Copyright (c) 2010 Lukáš Tvrdý * * 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_CURVE_RECT_MASK_GENERATOR_H_ #define _KIS_CURVE_RECT_MASK_GENERATOR_H_ -#include "krita_export.h" +#include "kritaimage_export.h" class KisCubicCurve; class QDomElement; class QDomDocument; #include "kis_mask_generator.h" /** * Curve based softness for this rectangular mask generator */ class KRITAIMAGE_EXPORT KisCurveRectangleMaskGenerator : public KisMaskGenerator { public: KisCurveRectangleMaskGenerator(qreal radius, qreal ratio, qreal fh, qreal fv, int spikes, const KisCubicCurve& curve, bool antialiasEdges); virtual ~KisCurveRectangleMaskGenerator(); virtual quint8 valueAt(qreal x, qreal y) const; void setScale(qreal scaleX, qreal scaleY); virtual void toXML(QDomDocument& , QDomElement&) const; virtual void setSoftness(qreal softness); private: struct Private; Private* const d; }; #endif diff --git a/krita/image/kis_debug.h b/krita/image/kis_debug.h index 08d11c1091b..e4041f47d60 100644 --- a/krita/image/kis_debug.h +++ b/krita/image/kis_debug.h @@ -1,150 +1,150 @@ /* * Copyright (c) 2005 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_DEBUG_AREAS_H_ #define KIS_DEBUG_AREAS_H_ #include #define dbgResources kDebug(30009) #define dbgKrita kDebug(41000) // For temporary debug lines, where you'd have used kDebug() before. #define dbgImage kDebug(41001) #define dbgRegistry kDebug(41002) #define dbgTools kDebug(41003) #define dbgTiles kDebug(41004) #define dbgFilters kDebug(41005) #define dbgPlugins kDebug(41006) #define dbgUI kDebug(41007) #define dbgFile kDebug(41008) #define dbgMath kDebug(41009) #define dbgRender kDebug(41010) #define dbgScript kDebug(41011) #define warnKrita kWarning(41000) // For temporary debug lines, where you'd have used kWarning() before. #define warnImage kWarning(41001) #define warnRegistry kWarning(41002) #define warnTools kWarning(41003) #define warnTiles kWarning(41004) #define warnFilters kWarning(41005) #define warnPlugins kWarning(41006) #define warnUI kWarning(41007) #define warnFile kWarning(41008) #define warnMath kWarning(41009) #define warnRender kWarning(41010) #define warnScript kWarning(41011) #define errKrita kError(41000) // For temporary debug lines, where you'd have used kError() before. #define errImage kError(41001) #define errRegistry kError(41002) #define errTools kError(41003) #define errTiles kError(41004) #define errFilters kError(41005) #define errPlugins kError(41006) #define errUI kError(41007) #define errFile kError(41008) #define errMath kError(41009) #define errRender kError(41010) #define errScript kError(41011) #define fatalKrita kFatal(41000) // For temporary debug lines, where you'd have used kFatal() before. #define fatalImage kFatal(41001) #define fatalRegistry kFatal(41002) #define fatalTools kFatal(41003) #define fatalTiles kFatal(41004) #define fatalFilters kFatal(41005) #define fatalPlugins kFatal(41006) #define fatalUI kFatal(41007) #define fatalFile kFatal(41008) #define fatalMath kFatal(41009) #define fatalRender kFatal(41010) #define fatalScript kFatal(41011) #endif /** * Use this macro to display in the output stream the name of a variable followed by its value. */ #define ppVar( var ) #var << "=" << var #ifdef __GNUC__ #define ENTER_FUNCTION() qDebug() << "Entering" << __func__ #define LEAVE_FUNCTION() qDebug() << "Leaving " << __func__ #else #define ENTER_FUNCTION() qDebug() << "Entering" << "" #define LEAVE_FUNCTION() qDebug() << "Leaving " << "" #endif # ifndef QT_NO_DEBUG # undef Q_ASSERT # define Q_ASSERT(cond) if(!(cond)) { kError() << kBacktrace(); qt_assert(#cond,__FILE__,__LINE__); } qt_noop() # endif -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" class QRect; class QString; void KRITAIMAGE_EXPORT kis_debug_save_device_incremental(KisPaintDeviceSP device, int i, const QRect &rc, const QString &suffix, const QString &prefix); /** * Saves the paint device incrementally. Put this macro into a * function that is called several times and you'll have as many * separate dump files as the number of times the function was * called. That is very convenient for debugging canvas updates: * adding this macro will let you track the whole history of updates. * * The files are saved with pattern: _.png */ #define KIS_DUMP_DEVICE_1(device, rc, suffix) \ do { \ static int i = -1; i++; \ kis_debug_save_device_incremental((device), i, (rc), (suffix), QString()); \ } while(0) /** * Saves the paint device incrementally. Put this macro into a * function that is called several times and you'll have as many * separate dump files as the number of times the function was * called. That is very convenient for debugging canvas updates: * adding this macro will let you track the whole history of updates. * * The \p prefix parameter makes it easy to sort out dumps from * different functions. * * The files are saved with pattern: __.png */ #define KIS_DUMP_DEVICE_2(device, rc, suffix, prefix) \ do { \ static int i = -1; i++; \ kis_debug_save_device_incremental((device), i, (rc), (suffix), (prefix)); \ } while(0) #ifdef __GNUC__ KRITAIMAGE_EXPORT const char* __methodName(const char *prettyFunction); #define __METHOD_NAME__ __methodName(__PRETTY_FUNCTION__) #else #define __METHOD_NAME__ ":" #endif #define PREPEND_METHOD(msg) QString("%1: %2").arg(__METHOD_NAME__).arg(msg) #include "kis_assert.h" diff --git a/krita/image/kis_distance_information.h b/krita/image/kis_distance_information.h index 847ef0b87a8..0ab01df03d0 100644 --- a/krita/image/kis_distance_information.h +++ b/krita/image/kis_distance_information.h @@ -1,118 +1,118 @@ /* * Copyright (c) 2010 Cyrille Berger * 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_DISTANCE_INFORMATION_H_ #define _KIS_DISTANCE_INFORMATION_H_ #include #include -#include "krita_export.h" +#include "kritaimage_export.h" class KisPaintInformation; /** * This structure contains information about the desired spacing * requested by the paintAt call */ class KisSpacingInformation { public: explicit KisSpacingInformation() : m_spacing(0.0, 0.0) , m_isIsotropic(true) , m_rotation(0.0) { } explicit KisSpacingInformation(qreal isotropicSpacing) : m_spacing(isotropicSpacing, isotropicSpacing) , m_isIsotropic(true) , m_rotation(0.0) { } explicit KisSpacingInformation(const QPointF &anisotropicSpacing, qreal rotation) : m_spacing(anisotropicSpacing) , m_isIsotropic(anisotropicSpacing.x() == anisotropicSpacing.y()) , m_rotation(rotation) { } inline QPointF spacing() const { return m_spacing; } inline bool isIsotropic() const { return m_isIsotropic; } inline qreal scalarApprox() const { return m_isIsotropic ? m_spacing.x() : QVector2D(m_spacing).length(); } inline qreal rotation() const { return m_rotation; } private: QPointF m_spacing; bool m_isIsotropic; qreal m_rotation; }; /** * This structure is used as return value of paintLine to contain * information that is needed to be passed for the next call. */ class KRITAIMAGE_EXPORT KisDistanceInformation { public: KisDistanceInformation(); KisDistanceInformation(const QPointF &lastPosition, qreal lastTime); KisDistanceInformation(const KisDistanceInformation &rhs); KisDistanceInformation& operator=(const KisDistanceInformation &rhs); ~KisDistanceInformation(); const KisSpacingInformation& currentSpacing() const; bool hasLastDabInformation() const; QPointF lastPosition() const; qreal lastTime() const; qreal lastDrawingAngle() const; bool hasLastPaintInformation() const; const KisPaintInformation& lastPaintInformation() const; void registerPaintedDab(const KisPaintInformation &info, const KisSpacingInformation &spacing); qreal getNextPointPosition(const QPointF &start, const QPointF &end); private: qreal getNextPointPositionIsotropic(const QPointF &start, const QPointF &end); qreal getNextPointPositionAnisotropic(const QPointF &start, const QPointF &end); private: struct Private; Private * const m_d; }; #endif diff --git a/krita/image/kis_dom_utils.h b/krita/image/kis_dom_utils.h index 2d29be47bd5..4059224a463 100644 --- a/krita/image/kis_dom_utils.h +++ b/krita/image/kis_dom_utils.h @@ -1,235 +1,235 @@ /* * Copyright (c) 2014 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_DOM_UTILS_H #define __KIS_DOM_UTILS_H #include #include #include #include #include #include "klocale.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_debug.h" namespace KisDomUtils { namespace Private { inline QString numberToString(const QString &value) { return value; } template inline QString numberToString(T value) { return QString::number(value); } inline int stringToInt(const QString &str) { bool ok = false; int value = 0; QLocale c(QLocale::German); value = str.toInt(&ok); if (!ok) { value = c.toInt(str, &ok); } if (!ok) { qWarning() << "WARNING: KisDomUtils::stringToInt failed:" << ppVar(str); value = 0; } return value; } inline double stringToDouble(const QString &str) { bool ok = false; double value = 0; QLocale c(QLocale::German); /** * A special workaround to handle ','/'.' decimal point * in different locales. Added for backward compatibility, * because we used to save qreals directly using * * e.setAttribute("w", (qreal)value), * * which did local-aware conversion. */ value = str.toDouble(&ok); if (!ok) { value = c.toDouble(str, &ok); } if (!ok) { qWarning() << "WARNING: KisDomUtils::stringToDouble failed:" << ppVar(str); value = 0; } return value; } } /** * Save a value of type QRect into an XML tree. A child for \p parent * is created and assigned a tag \p tag. The corresponding value can * be fetched from the XML using loadValue() later. * * \see loadValue() */ void KRITAIMAGE_EXPORT saveValue(QDomElement *parent, const QString &tag, const QRect &rc); void KRITAIMAGE_EXPORT saveValue(QDomElement *parent, const QString &tag, const QSize &size); void KRITAIMAGE_EXPORT saveValue(QDomElement *parent, const QString &tag, const QPointF &pt); void KRITAIMAGE_EXPORT saveValue(QDomElement *parent, const QString &tag, const QVector3D &pt); void KRITAIMAGE_EXPORT saveValue(QDomElement *parent, const QString &tag, const QTransform &t); /** * Save a value of a scalar type into an XML tree. A child for \p parent * is created and assigned a tag \p tag. The corresponding value can * be fetched from the XML using loadValue() later. * * \see loadValue() */ template void saveValue(QDomElement *parent, const QString &tag, T value) { QDomDocument doc = parent->ownerDocument(); QDomElement e = doc.createElement(tag); parent->appendChild(e); e.setAttribute("type", "value"); e.setAttribute("value", Private::numberToString(value)); } /** * Save a vector of values into an XML tree. A child for \p parent is * created and assigned a tag \p tag. The values in the array should * have a type supported by saveValue() overrides. The corresponding * vector can be fetched from the XML using loadValue() later. * * \see loadValue() */ template void saveValue(QDomElement *parent, const QString &tag, const QVector &array) { QDomDocument doc = parent->ownerDocument(); QDomElement e = doc.createElement(tag); parent->appendChild(e); e.setAttribute("type", "array"); int i = 0; foreach (const T &v, array) { saveValue(&e, QString("item_%1").arg(i++), v); } } /** * Find an element with tag \p tag which is a child of \p parent. The element should * be the only element with the provided tag in this parent. * * \return true is the element with \p tag is found and it is unique */ bool KRITAIMAGE_EXPORT findOnlyElement(const QDomElement &parent, const QString &tag, QDomElement *el, QStringList *errorMessages = 0); /** * Load an object from an XML element, which is a child of \p parent and has * a tag \p tag. * * \return true if the object is successfully loaded and is unique * * \see saveValue() */ bool KRITAIMAGE_EXPORT loadValue(const QDomElement &e, float *v); bool KRITAIMAGE_EXPORT loadValue(const QDomElement &e, double *v); bool KRITAIMAGE_EXPORT loadValue(const QDomElement &e, QSize *size); bool KRITAIMAGE_EXPORT loadValue(const QDomElement &e, QRect *rc); bool KRITAIMAGE_EXPORT loadValue(const QDomElement &e, QPointF *pt); bool KRITAIMAGE_EXPORT loadValue(const QDomElement &e, QVector3D *pt); bool KRITAIMAGE_EXPORT loadValue(const QDomElement &e, QTransform *t); namespace Private { bool KRITAIMAGE_EXPORT checkType(const QDomElement &e, const QString &expectedType); } /** * Load a scalar value from an XML element, which is a child of \p parent * and has a tag \p tag. * * \return true if the object is successfully loaded and is unique * * \see saveValue() */ template bool loadValue(const QDomElement &e, T *value) { if (!Private::checkType(e, "value")) return false; QVariant v(e.attribute("value", "no-value")); *value = v.value(); return true; } /** * Load an array from an XML element, which is a child of \p parent * and has a tag \p tag. * * \return true if the object is successfully loaded and is unique * * \see saveValue() */ template bool loadValue(const QDomElement &e, QVector *array) { if (!Private::checkType(e, "array")) return false; QDomElement child = e.firstChildElement(); while (!child.isNull()) { T value; if (!loadValue(child, &value)) return false; *array << value; child = child.nextSiblingElement(); } return true; } template bool loadValue(const QDomElement &parent, const QString &tag, T *value) { QDomElement e; if (!findOnlyElement(parent, tag, &e)) return false; return loadValue(e, value); } KRITAIMAGE_EXPORT QDomElement findElementByAttibute(QDomNode parent, const QString &tag, const QString &attribute, const QString &key); } #endif /* __KIS_DOM_UTILS_H */ diff --git a/krita/image/kis_fast_math.h b/krita/image/kis_fast_math.h index 2da7f3a447c..041488e0c18 100644 --- a/krita/image/kis_fast_math.h +++ b/krita/image/kis_fast_math.h @@ -1,36 +1,36 @@ /* * Copyright (c) 2010 Lukáš Tvrdý * * 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. * * adopted from here http://www.snippetcenter.org/en/a-fast-atan2-function-s1868.aspx */ #ifndef _KIS_IMAGE_FAST_ #define _KIS_IMAGE_FAST_ -#include "krita_export.h" +#include "kritaimage_export.h" /** * This namespace countains fast but inaccurate version of mathematical function. */ namespace KisFastMath { /// atan2 replacement KRITAIMAGE_EXPORT qreal atan2(qreal y, qreal x); } #endif diff --git a/krita/image/kis_fill_painter.h b/krita/image/kis_fill_painter.h index 117f49ee06a..57eb35263ad 100644 --- a/krita/image/kis_fill_painter.h +++ b/krita/image/kis_fill_painter.h @@ -1,285 +1,285 @@ /* * Copyright (c) 2004 Adrian Page * Copyright (c) 2004 Bart Coppens * * 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_FILL_PAINTER_H_ #define KIS_FILL_PAINTER_H_ #include #include "KoColor.h" #include "KoColorSpaceRegistry.h" #include "kis_painter.h" #include "kis_types.h" #include "kis_selection.h" -#include +#include class KoPattern; class KisFilterConfiguration; // XXX: Filling should set dirty rect. /** * This painter can be used to fill paint devices in different ways. This can also be used * for flood filling related operations. */ class KRITAIMAGE_EXPORT KisFillPainter : public KisPainter { public: /** * Construct an empty painter. Use the begin(KisPaintDeviceSP) method to attach * to a paint device */ KisFillPainter(); /** * Start painting on the specified paint device */ KisFillPainter(KisPaintDeviceSP device); KisFillPainter(KisPaintDeviceSP device, KisSelectionSP selection); private: void initFillPainter(); public: /** * Fill a rectangle with black transparent pixels (0, 0, 0, 0 for RGBA). */ void eraseRect(qint32 x1, qint32 y1, qint32 w, qint32 h); /** * Overloaded version of the above function. */ void eraseRect(const QRect& rc); /** * Fill current selection of KisPainter with a specified \p color. * * The filling rect is limited by \p rc to allow multithreaded * filling/processing. */ void fillSelection(const QRect &rc, const KoColor &color); /** * Fill a rectangle with a certain color. */ void fillRect(qint32 x, qint32 y, qint32 w, qint32 h, const KoColor& c); /** * Overloaded version of the above function. */ void fillRect(const QRect& rc, const KoColor& c); /** * Fill a rectangle with a certain color and opacity. */ void fillRect(qint32 x, qint32 y, qint32 w, qint32 h, const KoColor& c, quint8 opacity); /** * Overloaded version of the above function. */ void fillRect(const QRect& rc, const KoColor& c, quint8 opacity); /** * Fill a rectangle with a certain pattern. The pattern is repeated if it does not fit the * entire rectangle. */ void fillRect(qint32 x1, qint32 y1, qint32 w, qint32 h, const KoPattern * pattern); /** * Fill a rectangle with a certain pattern. The pattern is repeated if it does not fit the * entire rectangle. */ void fillRect(qint32 x1, qint32 y1, qint32 w, qint32 h, const KisPaintDeviceSP device, const QRect& deviceRect); /** * Overloaded version of the above function. */ void fillRect(const QRect& rc, const KoPattern * pattern); /** * Fill the specified area with the output of the generator plugin that is configured * in the generator parameter */ void fillRect(qint32 x1, qint32 y1, qint32 w, qint32 h, const KisFilterConfiguration * generator); /** * Fills the enclosed area around the point with the set color. If * there is a selection, the whole selection is filled. Note that * you must have set the width and height on the painter if you * don't have a selection. * * @param startX the X position where the floodfill starts * @param startY the Y position where the floodfill starts * @param sourceDevice the sourceDevice that determines the area that * is floodfilled if sampleMerged is on */ void fillColor(int startX, int startY, KisPaintDeviceSP sourceDevice); /** * Fills the enclosed area around the point with the set pattern. * If there is a selection, the whole selection is filled. Note * that you must have set the width and height on the painter if * you don't have a selection. * * @param startX the X position where the floodfill starts * @param startY the Y position where the floodfill starts * @param sourceDevice the sourceDevice that determines the area that * is floodfilled if sampleMerged is on */ void fillPattern(int startX, int startY, KisPaintDeviceSP sourceDevice); /** * Returns a selection mask for the floodfill starting at the specified position. * * @param startX the X position where the floodfill starts * @param startY the Y position where the floodfill starts * @param sourceDevice the sourceDevice that determines the area that * is floodfilled if sampleMerged is on */ KisSelectionSP createFloodSelection(int startX, int startY, KisPaintDeviceSP sourceDevice); /** * Set the threshold for floodfill. The range is 0-255: 0 means the fill will only * fill parts that are the exact same color, 255 means anything will be filled */ void setFillThreshold(int threshold); /** Returns the fill threshold, see setFillThreshold for details */ int fillThreshold() const { return m_threshold; } bool useCompositioning() const { return m_useCompositioning; } void setUseCompositioning(bool useCompositioning) { m_useCompositioning = useCompositioning; } /** Sets the width of the paint device */ void setWidth(int w) { m_width = w; } /** Sets the height of the paint device */ void setHeight(int h) { m_height = h; } /** If true, floodfill doesn't fill outside the selected area of a layer */ bool careForSelection() const { return m_careForSelection; } /** Set caring for selection. See careForSelection for details */ void setCareForSelection(bool set) { m_careForSelection = set; } /** Sets the auto growth/shrinking radius */ void setSizemod(int sizemod) { m_sizemod = sizemod; } /** Sets how much to auto-grow or shrink (if @param sizemod is negative) the selection flood before painting, this affects every fill operation except fillRect */ int sizemod() { return m_sizemod; } /** Sets feathering radius */ void setFeather(int feather) { m_feather = feather; } /** defines the feathering radius for selection flood operations, this affects every fill operation except fillRect */ uint feather() { return m_feather; } private: // for floodfill void genericFillStart(int startX, int startY, KisPaintDeviceSP sourceDevice); void genericFillEnd(KisPaintDeviceSP filled); KisSelectionSP m_fillSelection; int m_feather; int m_sizemod; int m_threshold; int m_width, m_height; QRect m_rect; bool m_careForSelection; bool m_useCompositioning; }; inline void KisFillPainter::fillRect(qint32 x, qint32 y, qint32 w, qint32 h, const KoColor& c) { fillRect(x, y, w, h, c, OPACITY_OPAQUE_U8); } inline void KisFillPainter::fillRect(const QRect& rc, const KoColor& c) { fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, OPACITY_OPAQUE_U8); } inline void KisFillPainter::eraseRect(qint32 x1, qint32 y1, qint32 w, qint32 h) { const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8(); KoColor c(Qt::black, cs); fillRect(x1, y1, w, h, c, OPACITY_TRANSPARENT_U8); } inline void KisFillPainter::eraseRect(const QRect& rc) { const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8(); KoColor c(Qt::black, cs); fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, OPACITY_TRANSPARENT_U8); } inline void KisFillPainter::fillRect(const QRect& rc, const KoColor& c, quint8 opacity) { fillRect(rc.x(), rc.y(), rc.width(), rc.height(), c, opacity); } inline void KisFillPainter::fillRect(const QRect& rc, const KoPattern* pattern) { fillRect(rc.x(), rc.y(), rc.width(), rc.height(), pattern); } inline void KisFillPainter::setFillThreshold(int threshold) { m_threshold = threshold; } #endif //KIS_FILL_PAINTER_H_ diff --git a/krita/image/kis_filter_strategy.h b/krita/image/kis_filter_strategy.h index ab2b678ced6..18fc47be418 100644 --- a/krita/image/kis_filter_strategy.h +++ b/krita/image/kis_filter_strategy.h @@ -1,207 +1,207 @@ /* * Copyright (c) 2004 Michael Thaler * Copyright (c) 2005 C. Boemann * Copyright (c) 2013 Juan Palacios * * 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_FILTER_STRATEGY_H_ #define KIS_FILTER_STRATEGY_H_ #include #include "kis_types.h" #include "KoGenericRegistry.h" #include "KoID.h" -#include "krita_export.h" +#include "kritaimage_export.h" class KRITAIMAGE_EXPORT KisFilterStrategy { public: KisFilterStrategy(KoID id) : m_id(id) {} virtual ~KisFilterStrategy() {} QString id() { return m_id.id(); } QString name() { return m_id.name(); } virtual qreal valueAt(qreal /*t*/) const { return 0; } virtual qint32 intValueAt(qint32 t) const { return qint32(255*valueAt(t / 256.0)); } qreal support() { return supportVal; } qint32 intSupport() { return intSupportVal; } virtual bool boxSpecial() { return false; } virtual QString description() { return QString(""); } protected: qreal supportVal; qint32 intSupportVal; KoID m_id; }; class KRITAIMAGE_EXPORT KisHermiteFilterStrategy : public KisFilterStrategy { public: KisHermiteFilterStrategy() : KisFilterStrategy(KoID("Hermite", i18n("Hermite"))) { supportVal = 1.0; intSupportVal = 256; } virtual ~KisHermiteFilterStrategy() {} virtual qint32 intValueAt(qint32 t) const; virtual qreal valueAt(qreal t) const; }; class KRITAIMAGE_EXPORT KisBicubicFilterStrategy : public KisFilterStrategy { public: KisBicubicFilterStrategy() : KisFilterStrategy(KoID("Bicubic", i18n("Bicubic"))) { supportVal = 2.0; intSupportVal = 512; } virtual ~KisBicubicFilterStrategy() {} virtual QString description() { return i18n("Adds pixels using the color of surrounding pixels. Produces smoother tonal gradations than Bilinear."); } virtual qint32 intValueAt(qint32 t) const; }; class KRITAIMAGE_EXPORT KisBoxFilterStrategy : public KisFilterStrategy { public: KisBoxFilterStrategy() : KisFilterStrategy(KoID("Box", i18n("Box"))) { supportVal = 0.5; intSupportVal = 128; } virtual ~KisBoxFilterStrategy() {} virtual QString description() { return i18n("Replicate pixels in the image. Preserves all the original detail, but can produce jagged effects."); } virtual qint32 intValueAt(qint32 t) const; virtual qreal valueAt(qreal t) const; virtual bool boxSpecial() { return true; } }; class KRITAIMAGE_EXPORT KisBilinearFilterStrategy : public KisFilterStrategy { public: KisBilinearFilterStrategy() : KisFilterStrategy(KoID("Bilinear", i18n("Bilinear"))) { supportVal = 1.0; intSupportVal = 256; } virtual ~KisBilinearFilterStrategy() {} virtual QString description() { return i18n("Adds pixels averaging the color values of surrounding pixels. Produces medium quality results when the image is scaled from half to two times the original size."); } virtual qint32 intValueAt(qint32 t) const; virtual qreal valueAt(qreal t) const; }; class KRITAIMAGE_EXPORT KisBellFilterStrategy : public KisFilterStrategy { public: KisBellFilterStrategy() : KisFilterStrategy(KoID("Bell", i18n("Bell"))) { supportVal = 1.5; intSupportVal = 128 + 256; } virtual ~KisBellFilterStrategy() {} virtual qreal valueAt(qreal t) const; }; class KRITAIMAGE_EXPORT KisBSplineFilterStrategy : public KisFilterStrategy { public: KisBSplineFilterStrategy() : KisFilterStrategy(KoID("BSpline", i18n("BSpline"))) { supportVal = 2.0; intSupportVal = 512; } virtual ~KisBSplineFilterStrategy() {} virtual qreal valueAt(qreal t) const; }; class KRITAIMAGE_EXPORT KisLanczos3FilterStrategy : public KisFilterStrategy { public: KisLanczos3FilterStrategy() : KisFilterStrategy(KoID("Lanczos3", i18n("Lanczos3"))) { supportVal = 3.0; intSupportVal = 768; } virtual ~KisLanczos3FilterStrategy() {} virtual QString description() { return i18n("Offers similar results than Bicubic, but maybe a little bit sharper. Can produce light and dark halos along strong edges."); } virtual qreal valueAt(qreal t) const; private: qreal sinc(qreal x) const; }; class KRITAIMAGE_EXPORT KisMitchellFilterStrategy : public KisFilterStrategy { public: KisMitchellFilterStrategy() : KisFilterStrategy(KoID("Mitchell", i18n("Mitchell"))) { supportVal = 2.0; intSupportVal = 256; } virtual ~KisMitchellFilterStrategy() {} virtual qreal valueAt(qreal t) const; }; class KRITAIMAGE_EXPORT KisFilterStrategyRegistry : public KoGenericRegistry { public: static KisFilterStrategyRegistry* instance(); /** * This function return a list of all the keys in KoID format by using the name() method * on the objects stored in the registry. */ QList listKeys() const; /** * This function return a string formated in HTML that contains the descriptions of all objects * (with a non empty description) stored in the registry. */ QString formatedDescriptions() const; private: KisFilterStrategyRegistry(); ~KisFilterStrategyRegistry(); KisFilterStrategyRegistry(const KisFilterStrategyRegistry&); KisFilterStrategyRegistry operator=(const KisFilterStrategyRegistry&); }; #endif // KIS_FILTER_STRATEGY_H_ diff --git a/krita/image/kis_fixed_paint_device.h b/krita/image/kis_fixed_paint_device.h index b56e43d7c1e..5fdbf07734a 100644 --- a/krita/image/kis_fixed_paint_device.h +++ b/krita/image/kis_fixed_paint_device.h @@ -1,183 +1,183 @@ /* * Copyright (c) 2009 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_FIXED_PAINT_DEVICE_H #define KIS_FIXED_PAINT_DEVICE_H -#include +#include #include #include "kis_global.h" #include "kis_shared.h" #include #include #include #include /** * A fixed paint device is a simple paint device that consists of an array * of bytes and a rectangle. It cannot grow, it cannot shrink, all you can * do is fill the paint device with the right bytes and use it as an argument * to KisPainter or use the bytes as an argument to KoColorSpace functions. */ class KRITAIMAGE_EXPORT KisFixedPaintDevice : public KisShared { public: KisFixedPaintDevice(const KoColorSpace* colorSpace); virtual ~KisFixedPaintDevice(); /** * Deep copy the fixed paint device, including the data. */ KisFixedPaintDevice(const KisFixedPaintDevice& rhs); /** * Deep copy the fixed paint device, including the data. */ KisFixedPaintDevice& operator=(const KisFixedPaintDevice& rhs); /** * setRect sets the rect of the fixed paint device to rect. * This will _not_ create the associated data area. * * @rect the bounds in pixels. The x,y of the rect represent the origin * of the fixed paint device. */ void setRect(const QRect& rc); /** * @return the rect that the data represents */ QRect bounds() const; /** * @return the amount of allocated pixels (you can fake the size with setRect/bounds) * It is useful to know the accumulated memory size in pixels (not in bytes) for optimizations to avoid re-allocation. */ int allocatedPixels() const; /** * @return the pixelSize associated with this fixed paint device. */ quint32 pixelSize() const; const KoColorSpace* colorSpace() const { return m_colorSpace; } /** * initializes the paint device. * * @param defaultValue the default byte with which all pixels will be filled. * @return false if the allocation failed. */ bool initialize(quint8 defaultValue = 0); /** * @return a pointer to the beginning of the data associated with this fixed paint device. */ quint8* data(); quint8* data() const; /** * Read the bytes representing the rectangle described by x, y, w, h into * data. If data is not big enough, Krita will gladly overwrite the rest * of your precious memory. * * Since this is a copy, you need to make sure you have enough memory. * * The reading is done only if the rectangular area x,y,w,h is inside the bounds of the device * and the device is not empty */ void readBytes(quint8 * dstData, qint32 x, qint32 y, qint32 w, qint32 h) const; /** * Converts the paint device to a different colorspace */ void convertTo(const KoColorSpace * dstColorSpace = 0, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::InternalRenderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::InternalConversionFlags); /** * Fill this paint device with the data from image * * @param srcProfileName name of the RGB profile to interpret the image as. 0 is interpreted as sRGB */ virtual void convertFromQImage(const QImage& image, const QString &srcProfileName); /** * Create an RGBA QImage from a rectangle in the paint device. * * @param x Left coordinate of the rectangle * @param y Top coordinate of the rectangle * @param w Width of the rectangle in pixels * @param h Height of the rectangle in pixels * @param dstProfile RGB profile to use in conversion. May be 0, in which * case it's up to the color strategy to choose a profile (most * like sRGB). */ virtual QImage convertToQImage(const KoColorProfile *dstProfile, qint32 x, qint32 y, qint32 w, qint32 h, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::InternalRenderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::InternalConversionFlags) const; /** * Create an RGBA QImage from a rectangle in the paint device. The * rectangle is defined by the parent image's bounds. * * @param dstProfile RGB profile to use in conversion. May be 0, in which * case it's up to the color strategy to choose a profile (most * like sRGB). */ virtual QImage convertToQImage(const KoColorProfile *dstProfile, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::InternalRenderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::InternalConversionFlags) const; /** * Clear the given rectangle to transparent black. * * XXX: this will not (yet) expand the paint device to contain the specified rect * but if the paintdevice has not been initialized, it will be. */ void clear(const QRect & rc); /** * Fill the given rectangle with the given pixel. This does not take the * selection into account. * * XXX: this will not (yet) expand the paint device to contain the specified rect * but if the paintdevice has not been initialized, it will be. */ void fill(qint32 x, qint32 y, qint32 w, qint32 h, const quint8 *fillPixel); /** * Mirrors the device. */ void mirror(bool horizontal, bool vertical); private: const KoColorSpace* m_colorSpace; QRect m_bounds; QVector m_data; }; #endif diff --git a/krita/image/kis_gauss_circle_mask_generator.h b/krita/image/kis_gauss_circle_mask_generator.h index 8779af71391..17867f08cae 100644 --- a/krita/image/kis_gauss_circle_mask_generator.h +++ b/krita/image/kis_gauss_circle_mask_generator.h @@ -1,54 +1,54 @@ /* * Copyright (c) 2010 Lukáš Tvrdý * Copyright (c) 2011 Geoffry Song * * 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_GAUSS_MASK_GENERATOR_H_ #define _KIS_GAUSS_MASK_GENERATOR_H_ -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_mask_generator.h" /** * This mask generator uses a Gaussian-blurred circle */ class KRITAIMAGE_EXPORT KisGaussCircleMaskGenerator : public KisMaskGenerator { public: KisGaussCircleMaskGenerator(qreal diameter, qreal ratio, qreal fh, qreal fv, int spikes, bool antialiasEdges); virtual ~KisGaussCircleMaskGenerator(); virtual quint8 valueAt(qreal x, qreal y) const; void setScale(qreal scaleX, qreal scaleY); private: qreal norme(qreal a, qreal b) const { return a*a + b*b; } private: struct Private; Private* const d; }; #endif diff --git a/krita/image/kis_gauss_rect_mask_generator.h b/krita/image/kis_gauss_rect_mask_generator.h index cb40e08f914..fd61f03412a 100644 --- a/krita/image/kis_gauss_rect_mask_generator.h +++ b/krita/image/kis_gauss_rect_mask_generator.h @@ -1,53 +1,53 @@ /* * Copyright (c) 2010 Lukáš Tvrdý * Copyright (c) 2011 Geoffry Song * * 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_GAUSS_RECT_MASK_GENERATOR_H_ #define _KIS_GAUSS_RECT_MASK_GENERATOR_H_ -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_mask_generator.h" /** * This mask generator uses a Gaussian-blurred rectangle */ class KRITAIMAGE_EXPORT KisGaussRectangleMaskGenerator : public KisMaskGenerator { public: KisGaussRectangleMaskGenerator(qreal diameter, qreal ratio, qreal fh, qreal fv, int spikes, bool antialiasEdges); virtual ~KisGaussRectangleMaskGenerator(); virtual quint8 valueAt(qreal x, qreal y) const; void setScale(qreal scaleX, qreal scaleY); private: qreal norme(qreal a, qreal b) const { return a*a + b*b; } private: struct Private; Private* const d; }; #endif diff --git a/krita/image/kis_gaussian_kernel.h b/krita/image/kis_gaussian_kernel.h index daafea7fcb8..ae59286333e 100644 --- a/krita/image/kis_gaussian_kernel.h +++ b/krita/image/kis_gaussian_kernel.h @@ -1,55 +1,55 @@ /* * Copyright (c) 2014 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_GAUSSIAN_KERNEL_H #define __KIS_GAUSSIAN_KERNEL_H -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" #include using namespace Eigen; class QRect; class KRITAIMAGE_EXPORT KisGaussianKernel { public: static Matrix createHorizontalMatrix(qreal radius); static Matrix createVerticalMatrix(qreal radius); static KisConvolutionKernelSP createHorizontalKernel(qreal radius); static KisConvolutionKernelSP createVerticalKernel(qreal radius); static qreal sigmaFromRadius(qreal radius); static int kernelSizeFromRadius(qreal radius); static void applyGaussian(KisPaintDeviceSP device, const QRect& rect, qreal xRadius, qreal yRadius, const QBitArray &channelFlags, KoUpdater *updater); }; #endif /* __KIS_GAUSSIAN_KERNEL_H */ diff --git a/krita/image/kis_gradient_painter.h b/krita/image/kis_gradient_painter.h index e3cfb9d77ae..32f964f5a09 100644 --- a/krita/image/kis_gradient_painter.h +++ b/krita/image/kis_gradient_painter.h @@ -1,91 +1,91 @@ /* * Copyright (c) 2004 Adrian Page * * 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_GRADIENT_PAINTER_H_ #define KIS_GRADIENT_PAINTER_H_ #include #include #include "kis_global.h" #include "kis_types.h" #include "kis_painter.h" -#include +#include /** * XXX: Docs! */ class KRITAIMAGE_EXPORT KisGradientPainter : public KisPainter { public: KisGradientPainter(); KisGradientPainter(KisPaintDeviceSP device); KisGradientPainter(KisPaintDeviceSP device, KisSelectionSP selection); ~KisGradientPainter(); enum enumGradientShape { GradientShapeLinear, GradientShapeBiLinear, GradientShapeRadial, GradientShapeSquare, GradientShapeConical, GradientShapeConicalSymetric, GradientShapePolygonal }; enum enumGradientRepeat { GradientRepeatNone, GradientRepeatForwards, GradientRepeatAlternate }; void setGradientShape(enumGradientShape shape); void precalculateShape(); /** * Paint a gradient in the rect between startx, starty, width and height. */ bool paintGradient(const QPointF& gradientVectorStart, const QPointF& gradientVectorEnd, enumGradientRepeat repeat, double antiAliasThreshold, bool reverseGradient, qint32 startx, qint32 starty, qint32 width, qint32 height); // convenience overload bool paintGradient(const QPointF& gradientVectorStart, const QPointF& gradientVectorEnd, enumGradientRepeat repeat, double antiAliasThreshold, bool reverseGradient, const QRect &applyRect); private: struct Private; const QScopedPointer m_d; }; #endif //KIS_GRADIENT_PAINTER_H_ diff --git a/krita/image/kis_green_coordinates_math.h b/krita/image/kis_green_coordinates_math.h index 53eb7530cfd..2a20d74d4fb 100644 --- a/krita/image/kis_green_coordinates_math.h +++ b/krita/image/kis_green_coordinates_math.h @@ -1,59 +1,59 @@ /* * Copyright (c) 2014 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_GREEN_COORDINATES_MATH_H #define __KIS_GREEN_COORDINATES_MATH_H #include #include #include -#include "krita_export.h" +#include "kritaimage_export.h" class KRITAIMAGE_EXPORT KisGreenCoordinatesMath { public: KisGreenCoordinatesMath(); ~KisGreenCoordinatesMath(); /** * Prepare the transformation framework by computing internal * coordinates of the points in cage. * * Please note that the points in \p points will later be accessed * with indexes only. */ void precalculateGreenCoordinates(const QVector &originalCage, const QVector &points); /** * Precalculate coefficients of the destination cage. Should be * called once for every cage change */ void generateTransformedCageNormals(const QVector &transformedCage); /** * Transform one point according to its index */ QPointF transformedPoint(int pointIndex, const QVector &transformedCage); private: struct Private; const QScopedPointer m_d; }; #endif /* __KIS_GREEN_COORDINATES_MATH_H */ diff --git a/krita/image/kis_image.h b/krita/image/kis_image.h index 07832d7983e..2417a83129f 100644 --- a/krita/image/kis_image.h +++ b/krita/image/kis_image.h @@ -1,833 +1,833 @@ /* * 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_default_bounds.h" #include "kis_image_interfaces.h" -#include +#include class KisDocument; class KoColorSpace; class KoColor; class KisCompositeProgressProxy; class KisActionRecorder; class KisUndoStore; class KisUndoAdapter; class KisImageSignalRouter; class KisPostExecutionUndoAdapter; class KisFilterStrategy; class KoColorProfile; class KisPerspectiveGrid; class KisLayerComposition; class KisSpontaneousJob; 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 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, bool startProjection = true); virtual ~KisImage(); public: // KisNodeGraphListener implementation void aboutToAddANode(KisNode *parent, int index); void nodeHasBeenAdded(KisNode *parent, int index); void aboutToRemoveANode(KisNode *parent, int index); void nodeChanged(KisNode * node); void notifySelectionChanged(); void requestProjectionUpdate(KisNode *node, const QRect& rect); public: // KisProjectionUpdateListener implementation void notifyProjectionUpdated(const QRect &rc); public: /** * 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); /** * XXX: docs! */ QImage convertToQImage(const QRect& scaledRect, const QSize& scaledImageSize, const KoColorProfile *profile); /** * Calls KisUpdateScheduler::lock */ void lock(); /** * Calls KisUpdateScheduler::unlock */ void unlock(); /** * Returns true if lock() has been called more often than unlock(). */ 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; /** * Set the automatic layer name counter one back. */ void rollBackLayerName(); /** * @return the perspective grid associated to this image */ KisPerspectiveGrid* perspectiveGrid(); /** * Resize the image to the specified rect. The resize * method handles the creating on an undo step itself. * * @param newRect the rect describing the new width, height and offset * of the image */ void resizeImage(const QRect& newRect); /** * Crop the image to the specified rect. The crop * method handles the creating on an undo step itself. * * @param newRect the rect describing the new width, height and offset * of the image */ void cropImage(const QRect& newRect); /** * Crop a node to @newRect. The node will *not* be moved anywhere, * it just drops some content */ void cropNode(KisNodeSP node, const QRect& newRect); void scaleImage(const QSize &size, qreal xres, qreal yres, KisFilterStrategy *filterStrategy); void scaleNode(KisNodeSP node, qreal sx, qreal sy, KisFilterStrategy *filterStrategy); /** * Execute a rotate transform on all layers in this image. * Image is resized to fit rotated image. */ void rotateImage(double radians); /** * Execute a rotate transform on on a subtree of this image. * Image is not resized. */ void rotateNode(KisNodeSP node, double radians); /** * Execute a shear transform on all layers in this image. */ void shear(double angleX, double angleY); /** * Shear a node and all its children. * @param angleX, @param angleY are given in degrees. */ 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 * adn 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; /** * 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. * * @param documentCoord PostScript Pt coordinate to convert. */ QPoint documentToIntPixel(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 document rectangle to an integer pixel rectangle. * * @param documentRect PostScript Pt rectangle to convert. */ QRect documentToIntPixel(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. */ KisLayerSP 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. */ KisLayerSP flattenLayer(KisLayerSP layer); /** * Removes \p nodes in a safe way, that is handling clone layers * reincarnation correctly */ void safeRemoveMultipleNodes(QList nodes); /** * Merges layers in \p mergedLayers and creates a new layer above * \p putAfter */ KisNodeSP mergeMultipleLayers(QList mergedLayers, KisNodeSP putAfter); /// This overrides interface for KisDefaultBounds /// @return the exact bounds of the image in pixel coordinates. QRect bounds() 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(KisLayerComposition* composition); /** * Remove the layer compostion */ void removeComposition(KisLayerComposition* 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; /** * Notifies that the node collapsed state has changed */ void notifyNodeCollpasedChanged(); public: bool startIsolatedMode(KisNodeSP node); void stopIsolatedMode(); 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); /** * 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(); /** * 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(); public Q_SLOTS: KisCompositeProgressProxy* compositeProgressProxy(); void barrierLock(); bool tryBarrierLock(); void waitForDone(); KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy); void addJob(KisStrokeId id, KisStrokeJobData *data); void endStroke(KisStrokeId id); bool cancelStroke(KisStrokeId id); void blockUpdates(); void unblockUpdates(); /** * 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(); /** * \see disableUIUpdates */ void enableUIUpdates(); /** * 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. */ void disableDirtyRequests(); /** * \see disableDirtyRequests() */ void enableDirtyRequests(); void refreshGraphAsync(KisNodeSP root = 0); void refreshGraphAsync(KisNodeSP root, const QRect &rc); void refreshGraphAsync(KisNodeSP root, const QRect &rc, const QRect &cropRect); /** * Triggers synchronous recomposition of the projection */ void refreshGraph(KisNodeSP root = 0); 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 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(); private: KisImage(const KisImage& rhs); 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 QRect& rect, 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; /** * 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 * const m_d; }; #endif // KIS_IMAGE_H_ diff --git a/krita/image/kis_image_config.h b/krita/image/kis_image_config.h index b305284c1ab..4a022d11933 100644 --- a/krita/image/kis_image_config.h +++ b/krita/image/kis_image_config.h @@ -1,86 +1,86 @@ /* * Copyright (c) 2010 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_IMAGE_CONFIG_H_ #define KIS_IMAGE_CONFIG_H_ #include -#include "krita_export.h" +#include "kritaimage_export.h" class KRITAIMAGE_EXPORT KisImageConfig { public: KisImageConfig(); ~KisImageConfig(); bool enablePerfLog(bool requestDefault = false) const; void setEnablePerfLog(bool value); qreal transformMaskOffBoundsReadArea() const; int updatePatchHeight() const; void setUpdatePatchHeight(int value); int updatePatchWidth() const; void setUpdatePatchWidth(int value); qreal maxCollectAlpha() const; qreal maxMergeAlpha() const; qreal maxMergeCollectAlpha() const; qreal schedulerBalancingRatio() const; void setSchedulerBalancingRatio(qreal value); int maxSwapSize(bool requestDefault = false) const; void setMaxSwapSize(int value); int swapSlabSize() const; void setSwapSlabSize(int value); int swapWindowSize() const; void setSwapWindowSize(int value); int tilesHardLimit() const; // MiB int tilesSoftLimit() const; // MiB int poolLimit() const; // MiB qreal memoryHardLimitPercent(bool requestDefault = false) const; // % of total RAM qreal memorySoftLimitPercent(bool requestDefault = false) const; // % of memoryHardLimitPercent() * (1 - 0.01 * memoryPoolLimitPercent()) qreal memoryPoolLimitPercent(bool requestDefault = false) const; // % of memoryHardLimitPercent() void setMemoryHardLimitPercent(qreal value); void setMemorySoftLimitPercent(qreal value); void setMemoryPoolLimitPercent(qreal value); static int totalRAM(); // MiB /** * @return a specific directory for the swapfile, if set. If not set, return an * empty QString and use the default KDE directory. */ QString swapDir(bool requestDefault = false); void setSwapDir(const QString &swapDir); private: Q_DISABLE_COPY(KisImageConfig) private: KConfigGroup m_config; }; #endif /* KIS_IMAGE_CONFIG_H_ */ diff --git a/krita/image/kis_image_interfaces.h b/krita/image/kis_image_interfaces.h index 96a1d6539d0..5845dae5400 100644 --- a/krita/image/kis_image_interfaces.h +++ b/krita/image/kis_image_interfaces.h @@ -1,66 +1,66 @@ /* * Copyright (c) 2011 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_IMAGE_INTERFACES_H #define __KIS_IMAGE_INTERFACES_H #include "kis_types.h" -#include +#include class QRect; class KisStrokeStrategy; class KisStrokeJobData; class KRITAIMAGE_EXPORT KisStrokesFacade { public: virtual ~KisStrokesFacade(); virtual KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy) = 0; virtual void addJob(KisStrokeId id, KisStrokeJobData *data) = 0; virtual void endStroke(KisStrokeId id) = 0; virtual bool cancelStroke(KisStrokeId id) = 0; }; class KRITAIMAGE_EXPORT KisUpdatesFacade { public: virtual ~KisUpdatesFacade(); virtual void blockUpdates() = 0; virtual void unblockUpdates() = 0; virtual void disableUIUpdates() = 0; virtual void enableUIUpdates() = 0; virtual void disableDirtyRequests() = 0; virtual void enableDirtyRequests() = 0; virtual void refreshGraphAsync(KisNodeSP root = 0) = 0; virtual void refreshGraphAsync(KisNodeSP root, const QRect &rc) = 0; virtual void refreshGraphAsync(KisNodeSP root, const QRect &rc, const QRect &cropRect) = 0; }; class KRITAIMAGE_EXPORT KisProjectionUpdateListener { public: virtual ~KisProjectionUpdateListener(); virtual void notifyProjectionUpdated(const QRect &rc) = 0; }; #endif /* __KIS_IMAGE_INTERFACES_H */ diff --git a/krita/image/kis_image_signal_router.h b/krita/image/kis_image_signal_router.h index b4489debabf..7b54723e680 100644 --- a/krita/image/kis_image_signal_router.h +++ b/krita/image/kis_image_signal_router.h @@ -1,142 +1,142 @@ /* * Copyright (c) 2011 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_IMAGE_SIGNAL_ROUTER_H #define __KIS_IMAGE_SIGNAL_ROUTER_H #include #include -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" #include "kis_group_layer.h" class KoColorSpace; class KoColorProfile; enum KisImageSignalTypeEnum { LayersChangedSignal, ModifiedSignal, SizeChangedSignal, ProfileChangedSignal, ColorSpaceChangedSignal, ResolutionChangedSignal }; /** * A special signal which handles stillPoint capabilities of the image * * \see KisImage::sigSizeChanged() */ struct ComplexSizeChangedSignal { ComplexSizeChangedSignal() {} ComplexSizeChangedSignal(QPointF _oldStillPoint, QPointF _newStillPoint) : oldStillPoint(_oldStillPoint), newStillPoint(_newStillPoint) { } /** * A helper method calculating the still points from image areas * we process. It works as if the source image was "cropped" by \p * portionOfOldImage, and this portion formed the new image of size * \p transformedIntoImageOfSize. * * Note, that \p portionOfTheImage may be equal to the image bounds(). */ ComplexSizeChangedSignal(const QRect &portionOfOldImage, const QSize &transformedIntoImageOfSize) { oldStillPoint = QRectF(portionOfOldImage).center(); newStillPoint = QRectF(QPointF(), QSizeF(transformedIntoImageOfSize)).center(); } ComplexSizeChangedSignal inverted() const { return ComplexSizeChangedSignal(newStillPoint, oldStillPoint); } QPointF oldStillPoint; QPointF newStillPoint; }; struct KisImageSignalType { KisImageSignalType() {} KisImageSignalType(KisImageSignalTypeEnum _id) : id(_id) { } KisImageSignalType(ComplexSizeChangedSignal signal) : id(SizeChangedSignal), sizeChangedSignal(signal) { } KisImageSignalType inverted() const { KisImageSignalType t; t.id = id; t.sizeChangedSignal = sizeChangedSignal.inverted(); return t; } KisImageSignalTypeEnum id; ComplexSizeChangedSignal sizeChangedSignal; }; typedef QVector KisImageSignalVector; class KRITAIMAGE_EXPORT KisImageSignalRouter : public QObject { Q_OBJECT public: KisImageSignalRouter(KisImageWSP image); ~KisImageSignalRouter(); void emitNotification(KisImageSignalType type); void emitNotifications(KisImageSignalVector notifications); void emitNodeChanged(KisNodeSP node); void emitNodeHasBeenAdded(KisNode *parent, int index); void emitAboutToRemoveANode(KisNode *parent, int index); private Q_SLOTS: void slotNotification(KisImageSignalType type); Q_SIGNALS: void sigNotification(KisImageSignalType type); // Notifications void sigImageModified(); void sigSizeChanged(const QPointF &oldStillPoint, const QPointF &newStillPoint); void sigProfileChanged(const KoColorProfile * profile); void sigColorSpaceChanged(const KoColorSpace* cs); void sigResolutionChanged(double xRes, double yRes); // Graph change signals void sigNodeChanged(KisNodeSP node); void sigNodeAddedAsync(KisNodeSP node); void sigRemoveNodeAsync(KisNodeSP node); void sigLayersChangedAsync(); private: KisImageWSP m_image; }; #endif /* __KIS_IMAGE_SIGNAL_ROUTER_H */ diff --git a/krita/image/kis_indirect_painting_support.h b/krita/image/kis_indirect_painting_support.h index ae8a5431452..522ed114974 100644 --- a/krita/image/kis_indirect_painting_support.h +++ b/krita/image/kis_indirect_painting_support.h @@ -1,113 +1,113 @@ /* * Copyright (c) 2004 Bart Coppens * Copyright (c) 2010 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_INDIRECT_PAINTING_SUPPORT_H_ #define KIS_INDIRECT_PAINTING_SUPPORT_H_ -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" #include "kis_node.h" class QBitArray; class KisUndoAdapter; class KisPostExecutionUndoAdapter; class KisPainter; class KUndo2MagicString; /** * For classes that support indirect painting. * * XXX: Name doesn't suggest an object -- is KisIndirectPaintingLayer * a better name? (BSAR) */ class KRITAIMAGE_EXPORT KisIndirectPaintingSupport { KisIndirectPaintingSupport(const KisIndirectPaintingSupport&); KisIndirectPaintingSupport& operator=(const KisIndirectPaintingSupport&); public: KisIndirectPaintingSupport(); virtual ~KisIndirectPaintingSupport(); bool hasTemporaryTarget() const; void setTemporaryTarget(KisPaintDeviceSP t); void setTemporaryCompositeOp(const KoCompositeOp* c); void setTemporaryOpacity(quint8 o); void setTemporaryChannelFlags(const QBitArray& channelFlags); void setTemporarySelection(KisSelectionSP selection); /** * Configures the painter to conform the painting parameters * stored for th temporary target, such as compositeOp, opacity, * channel flags and selection. Please do not setup them manually, * but use this function instead. */ void setupTemporaryPainter(KisPainter *painter) const; /** * Writes the temporary target into the paint device of the layer. * This action will lock the temporary target itself. */ void mergeToLayer(KisNodeSP layer, KisUndoAdapter *undoAdapter, const KUndo2MagicString &transactionText,int timedID = -1); void mergeToLayer(KisNodeSP layer, KisPostExecutionUndoAdapter *undoAdapter, const KUndo2MagicString &transactionText,int timedID = -1); /** * Lock the temporary target. * It should be done for guarding every access to * temporaryTarget() or original() * NOTE: well, not "every", but... */ void lockTemporaryTarget() const; /** * Unlock the temporary target * * \see lockTemporaryTarget() */ void unlockTemporaryTarget() const; KisPaintDeviceSP temporaryTarget(); const KisPaintDeviceSP temporaryTarget() const; private: friend class KisPainterBasedStrokeStrategy; /** * Only for debugging purposes. Please use setupTemporaryPainer() * instead. */ KisSelectionSP temporarySelection() const; private: template void mergeToLayerImpl(KisNodeSP layer, UndoAdapter *undoAdapter, const KUndo2MagicString &transactionText,int timedID = -1); void releaseResources(); private: struct Private; Private* const d; }; #endif /* KIS_INDIRECT_PAINTING_SUPPORT_H_ */ diff --git a/krita/image/kis_layer.h b/krita/image/kis_layer.h index 52bc3570436..3437953189f 100644 --- a/krita/image/kis_layer.h +++ b/krita/image/kis_layer.h @@ -1,382 +1,382 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2005 C. Boemann * Copyright (c) 2007 Boudewijn Rempt * Copyright (c) 2009 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_LAYER_H_ #define KIS_LAYER_H_ #include #include #include #include -#include "krita_export.h" +#include "kritaimage_export.h" #include "KisDocumentSectionModel.h" #include "kis_types.h" #include "kis_node.h" template class QStack; class QBitArray; class KisCloneLayer; class KisPSDLayerStyle; class KisAbstractProjectionPlane; namespace KisMetaData { class Store; } /** * Abstract class that represents the concept of a Layer in Krita. This is not related * to the paint devices: this is merely an abstraction of how layers can be stacked and * rendered differently. * Regarding the previous-, first-, next- and lastChild() calls, first means that it the layer * is at the top of the group in the layerlist, using next will iterate to the bottom to last, * whereas previous will go up to first again. * * * TODO: Add a layer mode whereby the projection of the layer is used * as a clipping path? **/ class KRITAIMAGE_EXPORT KisLayer : public KisNode { Q_OBJECT public: /** * @param image is the pointer of the image or null * @param opacity is a value between OPACITY_TRANSPARENT_U8 and OPACITY_OPAQUE_U8 **/ KisLayer(KisImageWSP image, const QString &name, quint8 opacity); KisLayer(const KisLayer& rhs); virtual ~KisLayer(); /// returns the image's colorSpace or null, if there is no image virtual const KoColorSpace * colorSpace() const; /// returns the layer's composite op for the colorspace of the layer's parent. const KoCompositeOp * compositeOp() const; KisPSDLayerStyleSP layerStyle() const; void setLayerStyle(KisPSDLayerStyleSP layerStyle); /** * \see a comment in KisNode::projectionPlane() */ virtual KisAbstractProjectionPlaneSP projectionPlane() const; /** * The projection plane representing the layer itself without any * styles or anything else. It is used by the layer styles projection * plane to stack up the planes. */ virtual KisAbstractProjectionPlaneSP internalProjectionPlane() const; QRect partialChangeRect(KisNodeSP lastNode, const QRect& rect); void buildProjectionUpToNode(KisPaintDeviceSP projection, KisNodeSP lastNode, const QRect& rect); virtual bool needProjection() const; /** * Return the fully rendered representation of this layer: its * data and its effect masks */ KisPaintDeviceSP projection() const; /** * Return the layer data before the effect masks have had their go * at it. */ virtual KisPaintDeviceSP original() const = 0; /** * @return the selection associated with this layer, if there is * one. Otherwise, return 0; */ virtual KisSelectionMaskSP selectionMask() const; /** * @return the selection contained in the first KisSelectionMask associated * with this layer or the image, if either exists, otherwise, return 0. */ virtual KisSelectionSP selection() const; virtual KisDocumentSectionModel::PropertyList sectionModelProperties() const; virtual void setSectionModelProperties(const KisDocumentSectionModel::PropertyList &properties); /** * set/unset the channel flag for the alpha channel of this layer */ void disableAlphaChannel(bool disable); /** * returns true if the channel flag for the alpha channel * of this layer is not set. * returns false otherwise. */ bool alphaChannelDisabled() const; /** * set the channelflags for this layer to the specified bit array. * The bit array must have exactly the same number of channels as * the colorspace this layer is in, or be empty, in which case all * channels are active. */ virtual void setChannelFlags(const QBitArray & channelFlags); /** * Return a bit array where each bit indicates whether a * particular channel is active or not. If the channelflags bit * array is empty, all channels are active. */ QBitArray & channelFlags() const; /** * Returns true if this layer is temporary: i.e., it should not * appear in the layerbox, even though it is temporarily in the * layer stack and taken into account on recomposition. */ bool temporary() const; /** * Set to true if this layer should not appear in the layerbox, * even though it is temporarily in the layer stack and taken into * account on recomposition. */ void setTemporary(bool t); /// returns the image this layer belongs to, or null if there is no image KisImageWSP image() const; /** * Set the image this layer belongs to. */ virtual void setImage(KisImageWSP image); /** * Create and return a layer that is the result of merging * this with layer. * * This method is designed to be called only within KisImage::mergeLayerDown(). * * Decendands override this to create specific merged types when possible. * The KisLayer one creates a KisPaintLayerSP via a bitBlt, and can work on all layer types. * * Decendants that perform there own version do NOT call KisLayer::createMergedLayer */ virtual KisLayerSP createMergedLayer(KisLayerSP prevLayer); /** * Clones should be informed about updates of the original * layer, so this is a way to register them */ void registerClone(KisCloneLayerWSP clone); /** * Deregisters the clone from the update list * * \see registerClone() */ void unregisterClone(KisCloneLayerWSP clone); /** * Return the list of the clones of this node. Be careful * with the list, because it is not thread safe. */ const QList registeredClones() const; /** * Returns whether we have a clone. * * Be careful with it. It is not thread safe to add/remove * clone while checking hasClones(). So there should be no updates. */ bool hasClones() const; /** * It is calles by the async merger after projection update is done */ void updateClones(const QRect &rect); public: qint32 x() const; qint32 y() const; void setX(qint32 x); void setY(qint32 y); /** * Returns an approximation of where the bounds * of actual data of this layer are */ QRect extent() const; /** * Returns the exact bounds of where the actual data * of this layer resides */ QRect exactBounds() const; QImage createThumbnail(qint32 w, qint32 h); public: /** * Returns true if there are any effect masks present */ bool hasEffectMasks() const; /** * @return the list of effect masks */ QList effectMasks(KisNodeSP lastNode = 0) const; /** * Get the group layer that contains this layer. */ KisLayerSP parentLayer() const; /** * @return the metadata object associated with this object. */ KisMetaData::Store* metaData(); protected: // override from KisNode QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const; protected: /** * Ask the layer to assemble its data & apply all the effect masks * to it. */ QRect updateProjection(const QRect& rect, KisNodeSP filthyNode); /** * Layers can override this method to get some special behavior * when copying data from \p original to \p projection, e.g. blend * in indirect painting device. If you need to modify data * outside \p rect, please also override outgoingChangeRect() * method. */ virtual void copyOriginalToProjection(const KisPaintDeviceSP original, KisPaintDeviceSP projection, const QRect& rect) const; /** * For KisLayer classes change rect transformation consists of two * parts: incoming and outgoing. * * 1) incomingChangeRect(rect) chande rect transformation * performed by the transformations done basing on global * projection. It is performed in KisAsyncMerger + * KisUpdateOriginalVisitor classes. It happens before data * coming to KisLayer::original() therefore it is * 'incoming'. See KisAdjustmentLayer for example of usage. * * 2) outgoingChangeRect(rect) change rect transformation that * happens in KisLayer::copyOriginalToProjection(). It applies * *only* when the layer is 'filthy', that is was the cause of * the merge process. See KisCloneLayer for example of usage. * * The flow of changed areas can be illustrated in the * following way: * * 1. Current projection of size R1 is stored in KisAsyncMerger::m_currentProjection * | * | <-- KisUpdateOriginalVisitor writes data into layer's original() device. * | The changed area on KisLayer::original() is * | R2 = KisLayer::incomingChangeRect(R1) * | * 2. KisLayer::original() / changed rect: R2 * | * | <-- KisLayer::updateProjection() starts composing a layer * | It calls KisLayer::copyOriginalToProjection() which copies some area * | to a temporaty device. The temporary device now stores * | R3 = KisLayer::outgoingChangeRect(R2) * | * 3. Temporary device / changed rect: R3 * | * | <-- KisLayer::updateProjection() continues composing a layer. It merges a mask. * | R4 = KisMask::changeRect(R3) * | * 4. KisLayer::original() / changed rect: R4 * * So in the end rect R4 will be passed up to the next layers in the stack. */ virtual QRect incomingChangeRect(const QRect &rect) const; /** * \see incomingChangeRect() */ virtual QRect outgoingChangeRect(const QRect &rect) const; /** * @param rectVariesFlag (out param) a flag, showing whether * a rect varies from mask to mask * @return an area that should be updated because of * the change of @requestedRect of the layer */ QRect masksChangeRect(const QList &masks, const QRect &requestedRect, bool &rectVariesFlag) const; /** * Get needRects for all masks * @param changeRect requested rect to be updated on final * projection. Should be a return value * of @ref masksChangedRect() * @param applyRects (out param) a stack of the rects where filters * should be applied * @param rectVariesFlag (out param) a flag, showing whether * a rect varies from mask to mask * @return a needRect that should be prepared on the layer's * paintDevice for all masks to succeed */ QRect masksNeedRect(const QList &masks, const QRect &changeRect, QStack &applyRects, bool &rectVariesFlag) const; QRect applyMasks(const KisPaintDeviceSP source, KisPaintDeviceSP destination, const QRect &requestedRect, KisNodeSP filthyNode, KisNodeSP lastNode) const; bool canMergeAndKeepBlendOptions(KisLayerSP otherLayer); private: friend class KisLayerProjectionPlane; friend class KisTransformMask; friend class KisLayerTest; private: struct Private; Private * const m_d; }; Q_DECLARE_METATYPE(KisLayerSP) #endif // KIS_LAYER_H_ diff --git a/krita/image/kis_layer_composition.h b/krita/image/kis_layer_composition.h index 4b94efc8509..3f45810f406 100644 --- a/krita/image/kis_layer_composition.h +++ b/krita/image/kis_layer_composition.h @@ -1,89 +1,89 @@ /* * Copyright (c) 2012 Sven Langkamp * * 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_LAYERCOMPOSITION_H #define _KIS_LAYERCOMPOSITION_H -#include "krita_export.h" +#include "kritaimage_export.h" #include #include #include #include #include "kis_image.h" /** * Storage class for layer compositions. Layer compositions allow to have several state for visible layers * e.g. used in storyboarding with one background and differnt foregrounds */ class KRITAIMAGE_EXPORT KisLayerComposition { public: KisLayerComposition(KisImageWSP image, const QString& name); ~KisLayerComposition(); /** * Sets name of the composition */ void setName(const QString& name); /** * Name of the composition as show in the docker * \return name of the composition */ QString name(); /** * Stores the current visibility of all layers in the composition */ void store(); /** * Applies the stored visibility to all the nodes */ void apply(); /** * Set the export enabled flag, if false the compositions will not be exported */ void setExportEnabled(bool enabled); /** * Export enabled flag, if false the compositions will not be exported * \return name of the composition */ bool isExportEnabled(); void setVisible(QUuid id, bool visible); void setCollapsed(QUuid id, bool collapsed); void save(QDomDocument& doc, QDomElement& element); private: KisImageWSP m_image; QString m_name; QMap m_visibilityMap; QMap m_collapsedMap; bool m_exportEnabled; friend class KisCompositionVisitor; }; #endif diff --git a/krita/image/kis_liquify_transform_worker.h b/krita/image/kis_liquify_transform_worker.h index d70935d2724..30a6148af44 100644 --- a/krita/image/kis_liquify_transform_worker.h +++ b/krita/image/kis_liquify_transform_worker.h @@ -1,92 +1,92 @@ /* * Copyright (c) 2014 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_LIQUIFY_TRANSFORM_WORKER_H #define __KIS_LIQUIFY_TRANSFORM_WORKER_H #include #include -#include +#include #include class QImage; class QRect; class QSize; class QTransform; class QDomElement; class KRITAIMAGE_EXPORT KisLiquifyTransformWorker : boost::equality_comparable { public: KisLiquifyTransformWorker(const QRect &srcBounds, KoUpdater *progress, int pixelPrecision = 8); KisLiquifyTransformWorker(const KisLiquifyTransformWorker &rhs); ~KisLiquifyTransformWorker(); bool operator==(const KisLiquifyTransformWorker &other) const; int pointToIndex(const QPoint &cellPt); QSize gridSize() const; void translatePoints(const QPointF &base, const QPointF &offset, qreal sigma, bool useWashMode, qreal flow); void scalePoints(const QPointF &base, qreal scale, qreal sigma, bool useWashMode, qreal flow); void rotatePoints(const QPointF &base, qreal angle, qreal sigma, bool useWashMode, qreal flow); void undoPoints(const QPointF &base, qreal amount, qreal sigma); const QVector& originalPoints() const; QVector& transformedPoints(); void run(KisPaintDeviceSP device); QImage runOnQImage(const QImage &srcImage, const QPointF &srcImageOffset, const QTransform &imageToThumbTransform, QPointF *newOffset); void toXML(QDomElement *e) const; static KisLiquifyTransformWorker* fromXML(const QDomElement &e); void translate(const QPointF &offset); private: struct Private; const QScopedPointer m_d; }; #endif /* __KIS_LIQUIFY_TRANSFORM_WORKER_H */ diff --git a/krita/image/kis_mask.h b/krita/image/kis_mask.h index 33fc9858098..4b6a43a469c 100644 --- a/krita/image/kis_mask.h +++ b/krita/image/kis_mask.h @@ -1,202 +1,202 @@ /* * Copyright (c) 2006 Boudewijn Rempt * (c) 2009 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_MASK_ #define _KIS_MASK_ #include #include "kis_types.h" #include "kis_node.h" #include "kis_global.h" #include "kis_indirect_painting_support.h" -#include +#include /** KisMask is the base class for all single channel mask-like paint devices in Krita. Masks can be rendered in different ways at different moments during the rendering stack. Masks are "owned" by layers (of any type), and cannot occur by themselves on themselves. The properties that masks implement are made available through the iterators created on their parent layer, or through iterators that can be created on the paint device that holds the mask data: masks are just paint devices, too. Masks should show up in the layerbox as sub-layers for the layer they are associated with and be ccp'able and draggable to other layers. Examples of masks are: - filter masks: like the alpha filter mask that is the most common type of mask and is simply known as "mask" in the gui. Other filter masks use any of krita's filters to filter the pixels of their parent. (In this they differ from adjustment layers, which filter all layers under them in their group stack). - selections: the selection mask is rendered after composition and zooming and determines the selectedness of the pixels of the parent layer. - painterly overlays: painterly overlays indicate a particular property of the pixel in the parent paint device they are associated with, like wetness, height or gravity. XXX: For now, all masks are 8 bit. Make the channel depth settable. */ class KRITAIMAGE_EXPORT KisMask : public KisNode, KisIndirectPaintingSupport { Q_OBJECT public: /** * Create a new KisMask. */ KisMask(const QString & name); /** * Copy the mask */ KisMask(const KisMask& rhs); virtual ~KisMask(); bool allowAsChild(KisNodeSP node) const; /** * @brief initSelection initializes the selection for the mask from * the given selection's projection. * @param copyFrom the selection we base the mask on * @param parentLayer the parent of this mask; it determines the default bounds of the mask. */ void initSelection(KisSelectionSP copyFrom, KisLayerSP parentLayer); /** * @brief initSelection initializes the selection for the mask from * the given paint device. * @param copyFromDevice the paint device we base the mask on * @param parentLayer the parent of this mask; it determines the default bounds of the mask. */ void initSelection(KisPaintDeviceSP copyFromDevice, KisLayerSP parentLayer); /** * @brief initSelection initializes an empty selection * @param parentLayer the parent of this mask; it determines the default bounds of the mask. */ void initSelection(KisLayerSP parentLayer); const KoColorSpace * colorSpace() const; const KoCompositeOp * compositeOp() const; /** * Return the selection associated with this mask. A selection can * contain both a paint device and shapes. */ KisSelectionSP selection() const; /** * @return the selection: if you paint on mask, you paint on the selections */ KisPaintDeviceSP paintDevice() const; /** * @return the same as paintDevice() */ KisPaintDeviceSP original() const; /** * @return the same as paintDevice() */ KisPaintDeviceSP projection() const; KisAbstractProjectionPlaneSP projectionPlane() const; /** * Change the selection to the specified selection object. The * selection is deep copied. */ void setSelection(KisSelectionSP selection); /** * Selected the specified rect with the specified amount of selectedness. */ void select(const QRect & rc, quint8 selectedness = MAX_SELECTED); /** * The extent and bounds of the mask are those of the selection inside */ QRect extent() const; QRect exactBounds() const; /** * overridden from KisBaseNode */ qint32 x() const; /** * overridden from KisBaseNode */ void setX(qint32 x); /** * overridden from KisBaseNode */ qint32 y() const; /** * overridden from KisBaseNode */ void setY(qint32 y); QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const; QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const; QImage createThumbnail(qint32 w, qint32 h); void testingInitSelection(const QRect &rect); protected: /** * Apply the effect the projection using the mask as a selection. * Made public in KisEffectMask */ void apply(KisPaintDeviceSP projection, const QRect & applyRect, const QRect & needRect, PositionToFilthy maskPos) const; virtual QRect decorateRect(KisPaintDeviceSP &src, KisPaintDeviceSP &dst, const QRect & rc, PositionToFilthy maskPos) const; private: friend class KisMaskProjectionPlane; private: struct Private; Private * const m_d; }; #endif diff --git a/krita/image/kis_memory_leak_tracker.h b/krita/image/kis_memory_leak_tracker.h index ff7d0662269..7e9936eea80 100644 --- a/krita/image/kis_memory_leak_tracker.h +++ b/krita/image/kis_memory_leak_tracker.h @@ -1,79 +1,79 @@ /* * Copyright (c) 2010 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_MEMORY_LEAK_TRACKER_H_ #define _KIS_MEMORY_LEAK_TRACKER_H_ -#include +#include #include // Only linux support the memory leak tracker #ifndef Q_OS_LINUX #undef HAVE_MEMORY_LEAK_TRACKER #endif // Disable the memory leak tracker on release build #ifdef NDEBUG #undef HAVE_MEMORY_LEAK_TRACKER #endif /** * This class tracks what pointer is reference by who. It is used by * the smart pointers to detect leaks. * * Note that the KisMemoryLeakTracker is currently only available on Linux, * and translate to NOOP on other platforms. It is also just a debug tool, * and should not be used in a production build of krita. */ class KRITAIMAGE_EXPORT KisMemoryLeakTracker { KisMemoryLeakTracker(); ~KisMemoryLeakTracker(); public: static KisMemoryLeakTracker* instance(); void reference(const void* what, const void* bywho, const char* whatName = 0); void dereference(const void* what, const void* bywho); void dumpReferences(); void dumpReferences(const void* what); public: template void reference(const _T_* what, const void* bywho); template void dereference(const _T_* what, const void* bywho); private: struct Private; Private* const d; }; #include template void KisMemoryLeakTracker::reference(const _T_* what, const void* bywho) { reference((void*)what, bywho, typeid(what).name()); } template void KisMemoryLeakTracker::dereference(const _T_* what, const void* bywho) { dereference((void*)what, bywho); } #endif diff --git a/krita/image/kis_memory_statistics_server.h b/krita/image/kis_memory_statistics_server.h index cb7e734e125..fa0f9859830 100644 --- a/krita/image/kis_memory_statistics_server.h +++ b/krita/image/kis_memory_statistics_server.h @@ -1,90 +1,90 @@ /* * 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_MEMORY_STATISTICS_SERVER_H #define __KIS_MEMORY_STATISTICS_SERVER_H #include #include #include -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" class KRITAIMAGE_EXPORT KisMemoryStatisticsServer : public QObject { Q_OBJECT public: struct Statistics { Statistics() : imageSize(0), totalMemorySize(0), realMemorySize(0), historicalMemorySize(0), poolSize(0), swapSize(0), totalMemoryLimit(0), tilesHardLimit(0), tilesSoftLimit(0), tilesPoolLimit(0) { } qint64 imageSize; qint64 totalMemorySize; qint64 realMemorySize; qint64 historicalMemorySize; qint64 poolSize; qint64 swapSize; qint64 totalMemoryLimit; qint64 tilesHardLimit; qint64 tilesSoftLimit; qint64 tilesPoolLimit; }; public: ~KisMemoryStatisticsServer(); static KisMemoryStatisticsServer* instance(); Statistics fetchMemoryStatistics(KisImageSP image) const; public Q_SLOTS: void notifyImageChanged(); Q_SIGNALS: void sigUpdateMemoryStatistics(); private: KisMemoryStatisticsServer(); private: struct Private; const QScopedPointer m_d; }; #endif /* __KIS_MEMORY_STATISTICS_SERVER_H */ diff --git a/krita/image/kis_name_server.h b/krita/image/kis_name_server.h index c0e71e8dd39..9ec26ac9bc7 100644 --- a/krita/image/kis_name_server.h +++ b/krita/image/kis_name_server.h @@ -1,40 +1,40 @@ /* * Copyright (c) 2002 Patrick Julien * * 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_NAMESERVER_H_ #define KIS_NAMESERVER_H_ #include -#include +#include class KRITAIMAGE_EXPORT KisNameServer { public: KisNameServer(qint32 seed = 1); ~KisNameServer(); qint32 number(); qint32 currentSeed() const; void rollback(); private: qint32 m_generator; QString m_prefix; }; #endif // KIS_NAMESERVER_H_ diff --git a/krita/image/kis_node.h b/krita/image/kis_node.h index f51211e84cd..2a9c965a008 100644 --- a/krita/image/kis_node.h +++ b/krita/image/kis_node.h @@ -1,361 +1,361 @@ /* * 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_NODE_H #define _KIS_NODE_H #include "kis_types.h" #include "kis_undo_adapter.h" #include "kis_base_node.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include class QRect; class QStringList; class KoProperties; class KisNodeVisitor; class KisNodeGraphListener; class KisNodeProgressProxy; class KisBusyProgressIndicator; class KisAbstractProjectionPlane; class KisProjectionLeaf; /** * A KisNode is a KisBaseNode that knows about its direct peers, parent * and children and whether it can have children. * * THREAD-SAFETY: All const methods of this class and setDirty calls * are considered to be thread-safe(!). All the others * especially add(), remove() and setParent() must be * protected externally. * * NOTE: your subclasses must have the Q_OBJECT declaration, even if * you do not define new signals or slots. */ class KRITAIMAGE_EXPORT KisNode : public KisBaseNode { friend class KisFilterMaskTest; Q_OBJECT public: /** * The struct describing the position of the node * against the filthy node. * NOTE: please change KisBaseRectsWalker::getPositionToFilthy * when changing this struct */ enum PositionToFilthy { N_ABOVE_FILTHY = 0x08, N_FILTHY_PROJECTION = 0x20, N_FILTHY = 0x40, N_BELOW_FILTHY = 0x80 }; /** * Create an empty node without a parent. */ KisNode(); /** * Create a copy of this node. The copy will not have a parent * node. */ KisNode(const KisNode & rhs); /** * Delete this node */ virtual ~KisNode(); virtual KisNodeSP clone() const = 0; virtual bool accept(KisNodeVisitor &v); virtual void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter); /** * Re-implement this method to add constraints for the * subclasses that can be added as children to this node * * @return false if the given node is not allowed as a child to this node */ virtual bool allowAsChild(KisNodeSP) const = 0; /** * Set the entire node extent dirty; this percolates up to parent * nodes all the way to the root node. By default this is the * empty rect (through KisBaseNode::extent()) */ virtual void setDirty(); /** * Add the given rect to the set of dirty rects for this node; * this percolates up to parent nodes all the way to the root * node. */ virtual void setDirty(const QRect & rect); /** * Add the given rects to the set of dirty rects for this node; * this percolates up to parent nodes all the way to the root * node. */ virtual void setDirty(const QVector &rects); /** * Add the given region to the set of dirty rects for this node; * this percolates up to parent nodes all the way to the root * node, if propagate is true; */ virtual void setDirty(const QRegion ®ion); /** * \return a pointer to a KisAbstractProjectionPlane interface of * the node. This interface is used by the image merging * framework to get information and to blending for the * layer. * * Please note the difference between need/change/accessRect and * the projectionPlane() interface. The former one gives * information about internal composition of the layer, and the * latter one about the total composition, including layer styles, * pass-through blending and etc. */ virtual KisAbstractProjectionPlaneSP projectionPlane() const; /** * The rendering of the image may not always happen in the order * of the main graph. Pass-through nodes ake some subgraphs * linear, so it the order of rendering change. projectionLeaf() * is a special interface of KisNode that represents "a graph for * projection rendering". Therefore the nodes in projectionLeaf() * graph may have a different order the main one. */ virtual KisProjectionLeafSP projectionLeaf() const; protected: /** * \return internal changeRect() of the node. Do not mix with \see * projectionPlane() * * Some filters will cause a change of pixels those are outside * a requested rect. E.g. we change a rect of 2x2, then we want to * apply a convolution filter with kernel 4x4 (changeRect is * (2+2*3)x(2+2*3)=8x8) to that area. The rect that should be updated * on the layer will be exaclty 8x8. More than that the needRect for * that update will be 14x14. See \ref needeRect. */ virtual QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const; /** * \return internal needRect() of the node. Do not mix with \see * projectionPlane() * * Some filters need pixels outside the current processing rect to * compute the new value (for instance, convolution filters) * See \ref changeRect * See \ref accessRect */ virtual QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const; /** * \return internal accessRect() of the node. Do not mix with \see * projectionPlane() * * Shows the area of image, that may be accessed during accessing * the node. * * Example. You have a layer that needs to prepare some rect on a * projection, say expectedRect. To perform this, the projection * of all the layers below of the size needRect(expectedRect) * should be calculeated by the merger beforehand and the layer * will access some other area of image inside the rect * accessRect(expectedRect) during updateProjection call. * * This knowledge about real access rect of a node is used by the * scheduler to avoid collisions between two multithreaded updaters * and so avoid flickering of the image. * * Currently, this method has nondefault value for shifted clone * layers only. */ virtual QRect accessRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const; public: // Graph methods /** * @return the graph sequence number calculated by the associated * graph listener. You can use it for checking for changes in the * graph. */ int graphSequenceNumber() const; /** * @return the graph listener this node belongs to. 0 if the node * does not belong to a grap listener. */ KisNodeGraphListener * graphListener() const; /** * Set the graph listener for this node. The graphlistener will be * informed before and after the list of child nodes has changed. */ void setGraphListener(KisNodeGraphListener * graphListener); /** * Returns the parent node of this node. This is 0 only for a root * node; otherwise this will be an actual Node */ KisNodeSP parent() const; /** * Returns the first child node of this node, or 0 if there are no * child nodes. */ KisNodeSP firstChild() const; /** * Returns the last child node of this node, or 0 if there are no * child nodes. */ KisNodeSP lastChild() const; /** * Returns the previous sibling of this node in the parent's list. * This is the node *above* this node in the composition stack. 0 * is returned if this child has no more previous siblings (== * firstChild()) */ KisNodeSP prevSibling() const; /** * Returns the next sibling of this node in the parent's list. * This is the node *below* this node in the composition stack. 0 * is returned if this child has no more next siblings (== * lastChild()) */ KisNodeSP nextSibling() const; /** * Returns how many direct child nodes this node has (not * recursive). */ quint32 childCount() const; /** * Retrieve the child node at the specified index. * * @return 0 if there is no node at this index. */ KisNodeSP at(quint32 index) const; /** * Retrieve the index of the specified child node. * * @return -1 if the specified node is not a child node of this * node. */ int index(const KisNodeSP node) const; /** * Return a list of child nodes of the current node that conform * to the specified constraints. There are no guarantees about the * order of the nodes in the list. The function is not recursive. * * @param nodeTypes. if not empty, only nodes that inherit the * classnames in this stringlist will be returned. * @param properties. if not empty, only nodes for which * KisNodeBase::check(properties) returns true will be returned. */ QList childNodes(const QStringList & nodeTypes, const KoProperties & properties) const; public: /** * @return the node progress proxy used by this node, if this node has no progress * proxy, it will return the proxy of its parent, if the parent has no progress proxy * it will return 0 */ KisNodeProgressProxy* nodeProgressProxy() const; KisBusyProgressIndicator* busyProgressIndicator() const; private: /** * Create a node progress proxy for this node. You need to create a progress proxy only * if the node is going to appear in the layerbox, and it needs to be created before * the layer box is made aware of the proxy. */ void createNodeProgressProxy(); protected: KisBaseNodeSP parentCallback() const; void notifyParentVisibilityChanged(bool value); void baseNodeChangedCallback(); private: friend class KisNodeFacade; friend class KisNodeTest; friend class KisLayer; // Note: only for setting the preview mask! /** * Set the parent of this node. */ void setParent(KisNodeWSP parent); /** * Add the specified node above the specified node. If aboveThis * is 0, the node is added at the bottom. */ bool add(KisNodeSP newNode, KisNodeSP aboveThis); /** * Removes the node at the specified index from the child nodes. * * @return false if there is no node at this index */ bool remove(quint32 index); /** * Removes the node from the child nodes. * * @return false if there's no such node in this node. */ bool remove(KisNodeSP node); KisNodeSP prevChildImpl(KisNodeSP child); KisNodeSP nextChildImpl(KisNodeSP child); private: struct Private; Private * const m_d; }; Q_DECLARE_METATYPE(KisNodeSP) Q_DECLARE_METATYPE(KisNodeWSP) #endif diff --git a/krita/image/kis_node_facade.h b/krita/image/kis_node_facade.h index ce1da619c6d..7ab5299e8a9 100644 --- a/krita/image/kis_node_facade.h +++ b/krita/image/kis_node_facade.h @@ -1,140 +1,140 @@ /* * 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_NODE_FACADE_H #define _KIS_NODE_FACADE_H #include "kis_types.h" #include "kis_node.h" -#include "krita_export.h" +#include "kritaimage_export.h" /** * KisNodeFacade is the public interface to adding and removing nodes. */ class KRITAIMAGE_EXPORT KisNodeFacade { public: /** * Create a new, empty KisNodeFacade */ KisNodeFacade(); /** * Create a new kisnodefacade for the given root. */ KisNodeFacade(KisNodeSP root); virtual ~KisNodeFacade(); /** * Set the rootnode for this facade */ void setRoot(KisNodeSP root); /** * Return the root node for the graph this facade managed */ const KisNodeSP root() const; /** * Move the given node to specified position. If the node already * has a parent, it is removed from the parent's node list. */ bool moveNode(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis); /** * Move the givent node at the specified index. If the node already * has a parent, it is removed from the parent's node list. * * childCount() is a valid index and appends to the end. */ bool moveNode(KisNodeSP node, KisNodeSP parent, quint32 index); /** * Add an already existing node to the image. The node is put on top * of the nodes in the specified nodegroup. If parent is 0, then * the root is used as parent. * * @param node the node to be added * @param parent the parent node */ bool addNode(KisNodeSP node, KisNodeSP parent = 0); /** * Add already existing node to the graph. * * @param node the node to be added * @param parent the parent node * @param aboveThis in the list with child nodes of the specified * parent, add this node above the specified sibling. * if 0, the node is put in the lowermost position in * its group. * returns false if adding the node didn't work, true if the node got added */ bool addNode(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis); /** * Adds the node as a child of the given parent at the specified * index. * * childCount() is a valid index and appends to the end. Fails and * returns false if the node is already in this group or any * other (remove it first.) */ bool addNode(KisNodeSP node, KisNodeSP parent, quint32 index); /** * Remove the specified node. * * @return false if removing the node failed */ bool removeNode(KisNodeSP node); /** * Move node up one slot, i.e., nextSibling becomes prevSibling */ bool raiseNode(KisNodeSP node); /** * Move node down one slot -- i.e, prevSibling becomes * nextSibling. * * @return false if moving the node failed */ bool lowerNode(KisNodeSP node); /** * Move the given node to the top-most position among its * siblings. * * @return false if moving the node failed. */ bool toTop(KisNodeSP node); /** * Move the given node to bottom-most position among its siblings. * * @return false if moving the node failed. */ bool toBottom(KisNodeSP node); private: struct Private; Private * const m_d; }; #endif diff --git a/krita/image/kis_node_filter_interface.h b/krita/image/kis_node_filter_interface.h index 1d524794703..71d247532be 100644 --- a/krita/image/kis_node_filter_interface.h +++ b/krita/image/kis_node_filter_interface.h @@ -1,60 +1,60 @@ /* * Copyright (c) 2008 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_NODE_FILTER_INTERFACE_H_ #define _KIS_NODE_FILTER_INTERFACE_H_ -#include +#include #include #include "filter/kis_filter_configuration.h" /** * Define an interface for nodes that are associated with a filter. */ class KRITAIMAGE_EXPORT KisNodeFilterInterface { public: KisNodeFilterInterface(KisFilterConfiguration *filterConfig, bool useGeneratorRegistry); KisNodeFilterInterface(const KisNodeFilterInterface &rhs); virtual ~KisNodeFilterInterface(); /** * @return safe shared pointer to the filter configuration * associated with this node */ virtual KisSafeFilterConfigurationSP filter() const; /** * Sets the filter configuration for this node. The filter might * differ from the filter that is currently set up on this node. * * WARNING: the filterConfig becomes *owned* by the node right * after you've set it. Don't try to access the configuration * after you've associated it with the node. */ virtual void setFilter(KisFilterConfiguration *filterConfig); // the child classes should access the filter with the filter() method private: KisNodeFilterInterface& operator=(const KisNodeFilterInterface &other); KisSafeFilterConfigurationSP m_filter; bool m_useGeneratorRegistry; }; #endif diff --git a/krita/image/kis_node_graph_listener.h b/krita/image/kis_node_graph_listener.h index a4d6ede4fb8..51d92d3daae 100644 --- a/krita/image/kis_node_graph_listener.h +++ b/krita/image/kis_node_graph_listener.h @@ -1,113 +1,113 @@ /* * 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_NODE_GRAPH_LISTENER_H_ #define KIS_NODE_GRAPH_LISTENER_H_ -#include "krita_export.h" +#include "kritaimage_export.h" class KisNode; class QRect; /** * Implementations of this class are called by nodes whenever the node * graph changes. These implementations can then emit the right * signals so Qt interview models can be updated before and after * changes. * * The reason for this go-between is that we don't want our nodes to * be QObjects, nor to have sig-slot connections between every node * and every mode. * * It also manages the sequence number of the graph. This is a number * which can be used as a checksum for whether the graph has chenged * from some period of time or not. \see graphSequenceNumber() */ class KRITAIMAGE_EXPORT KisNodeGraphListener { public: KisNodeGraphListener(); virtual ~KisNodeGraphListener(); /** * Inform the model that we're going to add a node. */ virtual void aboutToAddANode(KisNode *parent, int index); /** * Inform the model we're done adding a node. */ virtual void nodeHasBeenAdded(KisNode *parent, int index); /** * Inform the model we're going to remove a node. */ virtual void aboutToRemoveANode(KisNode *parent, int index); /** * Inform the model we're done removing a node. */ virtual void nodeHasBeenRemoved(KisNode *parent, int index); /** * Inform the model we're about to start moving a node (which * includes removing and adding the same node) */ virtual void aboutToMoveNode(KisNode * node, int oldIndex, int newIndex); /** * Inform the model we're done moving the node: it has been * removed and added successfully */ virtual void nodeHasBeenMoved(KisNode * node, int oldIndex, int newIndex); virtual void nodeChanged(KisNode * node); /** * Inform the model that one of the selections in the graph is * changed. The sender is not passed to the function (at least for * now) because the UI should decide itself whether it needs to * fetch new selection of not. */ virtual void notifySelectionChanged(); /** * Inform the model that a node has been changed (setDirty) */ virtual void requestProjectionUpdate(KisNode * node, const QRect& rect); /** * Returns the sequence of the graph. * * Every time some operation performed, which might change the * hierarchy of the nodes, the sequence number grows by one. So * if you have any information about the graph which was acquired * when the sequence number was X and now it has become Y, it * means your information is outdated. * * It is used in the scheduler for checking whether queued walkers * should be regenerated. */ int graphSequenceNumber() const; private: struct Private; Private * const m_d; }; #endif diff --git a/krita/image/kis_node_progress_proxy.h b/krita/image/kis_node_progress_proxy.h index 9ecf75fc806..21051903c7f 100644 --- a/krita/image/kis_node_progress_proxy.h +++ b/krita/image/kis_node_progress_proxy.h @@ -1,69 +1,69 @@ /* * Copyright (c) 2008 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_NODE_PROGRESS_PROXY_H_ #define _KIS_NODE_PROGRESS_PROXY_H_ #include #include #include -#include "krita_export.h" +#include "kritaimage_export.h" /** * This class implements \ref KoProgressProxy and allows node to report progress. */ class KRITAIMAGE_EXPORT KisNodeProgressProxy : public QObject, public KoProgressProxy { Q_OBJECT friend class KisNode; /** * Create a proxy to report progress when processing, this proxy is associated * with a node, it will report progress in the node progress bar. This proxy * will be deleted when @p _node is deleted. */ KisNodeProgressProxy(KisNode* _node); ~KisNodeProgressProxy(); public: /** * @return the node associated with this proxy. */ const KisNodeSP node() const; virtual int maximum() const ; virtual void setValue(int value); virtual void setRange(int minimum, int maximum); virtual void setFormat(const QString & format); /** * @return the current percentage (return -1 if no progress) */ int percentage() const; Q_SIGNALS: /** * Emitted when the percentage of the proxy is changed. * @param _percentage is the progress value in percent * @param _node is the node that own this \ref KisNodeProgressProxy */ void percentageChanged(int _percentage, const KisNodeSP& _node); private: struct Private; Private* const d; }; #endif diff --git a/krita/image/kis_node_visitor.h b/krita/image/kis_node_visitor.h index 50024fecf27..17b82a7ea91 100644 --- a/krita/image/kis_node_visitor.h +++ b/krita/image/kis_node_visitor.h @@ -1,90 +1,90 @@ /* * Copyright (c) 2005 C. Boemann * 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_NODE_VISITOR_H_ #define KIS_NODE_VISITOR_H_ #include "kis_node.h" -#include "krita_export.h" +#include "kritaimage_export.h" class KisPaintLayer; class KisGroupLayer; class KisAdjustmentLayer; class KisExternalLayer; class KisCloneLayer; class KisFilterMask; class KisTransparencyMask; class KisSelectionMask; class KRITAIMAGE_EXPORT KisNodeVisitor { public: KisNodeVisitor() {} virtual ~KisNodeVisitor() {} public: virtual bool visit(KisNode *node) = 0; virtual bool visit(KisPaintLayer *layer) = 0; virtual bool visit(KisGroupLayer *layer) = 0; virtual bool visit(KisAdjustmentLayer *layer) = 0; virtual bool visit(KisExternalLayer *layer) = 0; virtual bool visit(KisGeneratorLayer *layer) = 0; virtual bool visit(KisCloneLayer *layer) = 0; virtual bool visit(KisFilterMask *mask) = 0; virtual bool visit(KisTransformMask *mask) = 0; virtual bool visit(KisTransparencyMask *mask) = 0; virtual bool visit(KisSelectionMask *mask) = 0; protected: /** * Visit all child nodes of the given node starting with the first one until one node returns * false. Then visitAll returns false, otherwise true. * * @param node the parent node whose children will be visited * @param breakOnFail break if one of the children returns false on accept * @return true if none of the childnodes returns false on * accepting the visitor. */ bool visitAll(KisNode * node, bool breakOnFail = false); /** * Visit all child nodes of the given node starting with the last one until one node returns * false. Then visitAll returns false, otherwise true. * * @param node the parent node whose children will be visited * @param breakOnFail break if one of the children returns false on accept * @return true if none of the childnodes returns false on * accepting the visitor. */ bool visitAllInverse(KisNode * node, bool breakOnFail = false); }; #endif // KIS_ NODE_VISITOR_H_ diff --git a/krita/image/kis_outline_generator.h b/krita/image/kis_outline_generator.h index af84a12a385..97f4a5aa5e9 100644 --- a/krita/image/kis_outline_generator.h +++ b/krita/image/kis_outline_generator.h @@ -1,104 +1,104 @@ /* * Copyright (c) 2004 Boudewijn Rempt * Copyright (c) 2007,2010 Sven Langkamp * * Outline algorithm based of the limn of fontutils * Copyright (c) 1992 Karl Berry * Copyright (c) 1992 Kathryn Hargreaves * * 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_OUTLINE_GENERATOR_H #define KIS_OUTLINE_GENERATOR_H #include -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" #include class KoColorSpace; /** * Generates an 'outline' for a paint device. Used e.g. in for brushes and marching ants **/ class KRITAIMAGE_EXPORT KisOutlineGenerator { public: /** * Create an outline generator * @param cs colorspace for the buffer passed to the generator * @param defaultOpacity opacity of pixels that shouldn't be included in the outline **/ KisOutlineGenerator(const KoColorSpace* cs, quint8 defaultOpacity); /** * Generates the outline. * @param buffer buffer with the data for the outline * @param xOffset offset that will be used for the x coordinate of the polygon points * @param yOffset offset that will be used for the y coordinate of the polygon points * @param width width of the buffer * @param height height of the buffer * @returns list of polygons around every non-transparent area **/ QVector outline(quint8* buffer, qint32 xOffset, qint32 yOffset, qint32 width, qint32 height); QVector outline(const KisPaintDevice *buffer, qint32 xOffset, qint32 yOffset, qint32 width, qint32 height); /** * Set the generator to produce simpile outline, skipping outline that are fully enclosed * @param simple set simple mode, if true enclosed outline will be skipped **/ void setSimpleOutline(bool simple); private: private: enum EdgeType { TopEdge = 1, LeftEdge = 2, BottomEdge = 3, RightEdge = 0, NoEdge = 4 }; template QVector outlineImpl(typename StorageStrategy::StorageType buffer, qint32 xOffset, qint32 yOffset, qint32 width, qint32 height); template bool isOutlineEdge(StorageStrategy &storage, EdgeType edge, qint32 x, qint32 y, qint32 bufWidth, qint32 bufHeight); template void nextOutlineEdge(StorageStrategy &storage, EdgeType *edge, qint32 *row, qint32 *col, qint32 width, qint32 height); EdgeType nextEdge(EdgeType edge) { return edge == NoEdge ? edge : static_cast((edge + 1) % 4); } void appendCoordinate(QPolygon * path, int x, int y, EdgeType edge); private: const KoColorSpace* m_cs; quint8 m_defaultOpacity; bool m_simple; KisRandomConstAccessorSP m_accessor; }; #endif // KIS_OUTLINE_GENERATOR_H diff --git a/krita/image/kis_paint_device.h b/krita/image/kis_paint_device.h index 3f94e967005..ef93cb0bfc6 100644 --- a/krita/image/kis_paint_device.h +++ b/krita/image/kis_paint_device.h @@ -1,774 +1,774 @@ /* * Copyright (c) 2002 patrick julien * Copyright (c) 2006 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_PAINT_DEVICE_IMPL_H_ #define KIS_PAINT_DEVICE_IMPL_H_ #include #include #include #include "kis_debug.h" #include #include "kis_types.h" #include "kis_global.h" #include "kis_shared.h" #include "kis_default_bounds_base.h" -#include +#include class KUndo2Command; class QRect; class QImage; class QPoint; class QString; class QColor; class QIODevice; class KoColor; class KoColorSpace; class KoColorProfile; class KisDataManager; class KisPaintDeviceWriter; typedef KisSharedPtr KisDataManagerSP; /** * A paint device contains the actual pixel data and offers methods * to read and write pixels. A paint device has an integer x,y position * (i.e., are not positioned on the image with sub-pixel accuracy). * A KisPaintDevice doesn't have any fixed size, the size changes dynamically * when pixels are accessed by an iterator. */ class KRITAIMAGE_EXPORT KisPaintDevice : public QObject , public KisShared { Q_OBJECT public: /** * Create a new paint device with the specified colorspace. * * @param colorSpace the colorspace of this paint device * @param name for debugging purposes */ KisPaintDevice(const KoColorSpace * colorSpace, const QString& name = QString()); /** * Create a new paint device with the specified colorspace. The * parent node will be notified of changes to this paint device. * * @param parent the node that contains this paint device * @param colorSpace the colorspace of this paint device * @param defaultBounds boundaries of the device in case it is empty * @param name for debugging purposes */ KisPaintDevice(KisNodeWSP parent, const KoColorSpace * colorSpace, KisDefaultBoundsBaseSP defaultBounds = 0, const QString& name = QString()); KisPaintDevice(const KisPaintDevice& rhs); virtual ~KisPaintDevice(); protected: /** * A special constructor for usage in KisPixelSelection. It allows * two paint devices to share a data manager. * * @param explicitDataManager data manager to use inside paint device * @param src source paint device to copy parameters from * @param name for debugging purposes */ KisPaintDevice(KisDataManagerSP explicitDataManager, KisPaintDeviceSP src, const QString& name = QString()); public: /** * Write the pixels of this paint device into the specified file store. */ bool write(KisPaintDeviceWriter &store); /** * Fill this paint device with the pixels from the specified file store. */ bool read(QIODevice *stream); public: /** * set the parent node of the paint device */ void setParentNode(KisNodeWSP parent); /** * set the default bounds for the paint device when * the default pixel in not completely transarent */ void setDefaultBounds(KisDefaultBoundsBaseSP bounds); /** * the default bounds rect of the paint device */ KisDefaultBoundsBaseSP defaultBounds() const; /** * Moves the device to these new coordinates (so no incremental move or so) */ void move(qint32 x, qint32 y); /** * Convenience method for the above. */ virtual void move(const QPoint& pt); /** * The X offset of the paint device */ qint32 x() const; /** * The Y offset of the paint device */ qint32 y() const; /** * set the X offset of the paint device */ void setX(qint32 x); /** * set the Y offset of the paint device */ void setY(qint32 y); /** * Retrieve the bounds of the paint device. The size is not exact, * but may be larger if the underlying datamanager works that way. * For instance, the tiled datamanager keeps the extent to the nearest * multiple of 64. * * If default pixel is not transparent, then the actual extent * rect is united with the defaultBounds()->bounds() value * (the size of the image, usually). */ QRect extent() const; /// Convience method for the above void extent(qint32 &x, qint32 &y, qint32 &w, qint32 &h) const; /** * Get the exact bounds of this paint device. The real solution is * very slow because it does a linear scanline search, but it * uses caching, so calling to this function without changing * the device is quite cheap. * * Exactbounds follows these rules: * *
    *
  • if default pixel is transparent, then exact bounds * of actual pixel data are returned *
  • if default pixel is not transparent, then the union * (defaultBounds()->bounds() | nonDefaultPixelArea()) is * returned *
* \see calculateExactBounds() */ QRect exactBounds() const; /** * Retuns exact rectangle of the paint device that contains * non-default pixels. For paint devices with fully transparent * default pixel is equivalent to exactBounds(). * * nonDefaultPixelArea() follows these rules: * *
    *
  • if default pixel is transparent, then exact bounds * of actual pixel data are returned. The same as exactBounds() *
  • if default pixel is not transparent, then calculates the * rectangle of non-default pixels. May be smaller or greater * than image bounds *
* \see calculateExactBounds() */ QRect nonDefaultPixelArea() const; /** * Returns a rough approximation of region covered by device. * For tiled data manager, it region will consist of a number * of rects each corresponding to a tile. */ QRegion region() const; /** * Cut the paint device down to the specified rect. If the crop * area is bigger than the paint device, nothing will happen. */ void crop(qint32 x, qint32 y, qint32 w, qint32 h); /// Convience method for the above void crop(const QRect & r); /** * Complete erase the current paint device. Its size will become 0. This * does not take the selection into account. */ virtual void clear(); /** * Clear the given rectangle to transparent black. The paint device will expand to * contain the given rect. */ void clear(const QRect & rc); /** * Frees the memory occupied by the pixels containing default * values. The extents() and exactBounds() of the image will * probably also shrink */ void purgeDefaultPixels(); /** * Sets the default pixel. New data will be initialised with this pixel. The pixel is copied: the * caller still owns the pointer and needs to delete it to avoid memory leaks. */ void setDefaultPixel(const quint8 *defPixel); /** * Get a pointer to the default pixel. */ const quint8 *defaultPixel() const; /** * Fill the given rectangle with the given pixel. The paint device will expand to * contain the given rect. */ void fill(const QRect & rc, const KoColor &color); /** * Overloaded function. For legacy purposes only. * Please use fill(const QRect & rc, const KoColor &color) instead */ void fill(qint32 x, qint32 y, qint32 w, qint32 h, const quint8 *fillPixel); public: /** * Prepares the device for fastBitBlt opreration. It clears * the device, switches x,y shifts and colorspace if needed. * After this call fastBitBltPossible will return true. * May be used for initialization of temporary devices. */ void prepareClone(KisPaintDeviceSP src); /** * Make this device to become a clone of \a src. It will have the same * x,y shifts, colorspace and will share pixels inside \a rect. * After calling this function: * (this->extent() >= this->exactBounds() == rect). */ void makeCloneFrom(KisPaintDeviceSP src, const QRect &rect); /** * Make this device to become a clone of \a src. It will have the same * x,y shifts, colorspace and will share pixels inside \a rect. * Be careful, this function will copy *at least* \a rect * of pixels. Actual copy area will be a bigger - it will * be aligned by tiles borders. So after calling this function: * (this->extent() == this->exactBounds() >= rect). */ void makeCloneFromRough(KisPaintDeviceSP src, const QRect &minimalRect); protected: friend class KisPaintDeviceTest; friend class DataReaderThread; /** * Checks whether a src paint device can be used as source * of fast bitBlt operation. The result of the check may * depend on whether color spaces coinside, whether there is * any shift of tiles between the devices and etc. * * WARNING: This check must be done before performing any * fast bitBlt operation! * * \see fastBitBlt * \see fastBitBltRough */ bool fastBitBltPossible(KisPaintDeviceSP src); /** * Clones rect from another paint device. The cloned area will be * shared between both paint devices as much as possible using * copy-on-write. Parts of the rect that cannot be shared * (cross tiles) are deep-copied, * * \see fastBitBltPossible * \see fastBitBltRough */ void fastBitBlt(KisPaintDeviceSP src, const QRect &rect); /** * The same as \ref fastBitBlt() but reads old data */ void fastBitBltOldData(KisPaintDeviceSP src, const QRect &rect); /** * Clones rect from another paint device in a rough and fast way. * All the tiles touched by rect will be shared, between both * devices, that means it will copy a bigger area than was * requested. This method is supposed to be used for bitBlt'ing * into temporary paint devices. * * \see fastBitBltPossible * \see fastBitBlt */ void fastBitBltRough(KisPaintDeviceSP src, const QRect &rect); /** * The same as \ref fastBitBltRough() but reads old data */ void fastBitBltRoughOldData(KisPaintDeviceSP src, const QRect &rect); public: /** * Read the bytes representing the rectangle described by x, y, w, h into * data. If data is not big enough, Krita will gladly overwrite the rest * of your precious memory. * * Since this is a copy, you need to make sure you have enough memory. * * Reading from areas not previously initialized will read the default * pixel value into data but not initialize that region. */ void readBytes(quint8 * data, qint32 x, qint32 y, qint32 w, qint32 h) const; /** * Read the bytes representing the rectangle rect into * data. If data is not big enough, Krita will gladly overwrite the rest * of your precious memory. * * Since this is a copy, you need to make sure you have enough memory. * * Reading from areas not previously initialized will read the default * pixel value into data but not initialize that region. * @param data The address of the memory to receive the bytes read * @param rect The rectangle in the paint device to read from */ void readBytes(quint8 * data, const QRect &rect) const; /** * Copy the bytes in data into the rect specified by x, y, w, h. If the * data is too small or uninitialized, Krita will happily read parts of * memory you never wanted to be read. * * If the data is written to areas of the paint device not previously initialized, * the paint device will grow. */ void writeBytes(const quint8 * data, qint32 x, qint32 y, qint32 w, qint32 h); /** * Copy the bytes in data into the rectangle rect. If the * data is too small or uninitialized, Krita will happily read parts of * memory you never wanted to be read. * * If the data is written to areas of the paint device not previously initialized, * the paint device will grow. * @param data The address of the memory to write bytes from * @param rect The rectangle in the paint device to write to */ void writeBytes(const quint8 * data, const QRect &rect); /** * Copy the bytes in the paint device into a vector of arrays of bytes, * where the number of arrays is the number of channels in the * paint device. If the specified area is larger than the paint * device's extent, the default pixel will be read. */ QVector readPlanarBytes(qint32 x, qint32 y, qint32 w, qint32 h) const; /** * Write the data in the separate arrays to the channes. If there * are less vectors than channels, the remaining channels will not * be copied. If any of the arrays points to 0, the channel in * that location will not be touched. If the specified area is * larger than the paint device, the paint device will be * extended. There are no guards: if the area covers more pixels * than there are bytes in the arrays, krita will happily fill * your paint device with areas of memory you never wanted to be * read. Krita may also crash. * * XXX: what about undo? */ void writePlanarBytes(QVector planes, qint32 x, qint32 y, qint32 w, qint32 h); /** * Converts the paint device to a different colorspace * * @return a command that can be used to undo the conversion. */ KUndo2Command* convertTo(const KoColorSpace * dstColorSpace, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::InternalRenderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::InternalConversionFlags); /** * Changes the profile of the colorspace of this paint device to the given * profile. If the given profile is 0, nothing happens. */ void setProfile(const KoColorProfile * profile); /** * Fill this paint device with the data from image; starting at (offsetX, offsetY) * @param srcProfileName name of the RGB profile to interpret the image as. 0 is interpreted as sRGB */ void convertFromQImage(const QImage& image, const KoColorProfile *profile, qint32 offsetX = 0, qint32 offsetY = 0); /** * Create an RGBA QImage from a rectangle in the paint device. * * @param x Left coordinate of the rectangle * @param y Top coordinate of the rectangle * @param w Width of the rectangle in pixels * @param h Height of the rectangle in pixels * @param dstProfile RGB profile to use in conversion. May be 0, in which * case it's up to the color strategy to choose a profile (most * like sRGB). */ virtual QImage convertToQImage(const KoColorProfile *dstProfile, qint32 x, qint32 y, qint32 w, qint32 h, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::InternalRenderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::InternalConversionFlags) const; /** * Overridden method for convenience */ QImage convertToQImage(const KoColorProfile *dstProfile, const QRect &rc, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::InternalRenderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::InternalConversionFlags) const; /** * Create an RGBA QImage from a rectangle in the paint device. The * rectangle is defined by the parent image's bounds. * * @param dstProfile RGB profile to use in conversion. May be 0, in which * case it's up to the color strategy to choose a profile (most * like sRGB). */ QImage convertToQImage(const KoColorProfile * dstProfile, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::InternalRenderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::InternalConversionFlags) const; /** * Creates a paint device thumbnail of the paint device, retaining * the aspect ratio. The width and height of the returned device * won't exceed \p maxw and \p maxw, but they may be smaller. * * @param maxw: maximum width * @param maxh: maximum height * @param rect: only this rect will be used for the thumbnail * */ KisPaintDeviceSP createThumbnailDevice(qint32 w, qint32 h, QRect rect = QRect()) const; /** * Creates a thumbnail of the paint device, retaining the aspect ratio. * The width and height of the returned QImage won't exceed \p maxw and \p maxw, but they may be smaller. * The colors are not corrected for display! * * @param maxw: maximum width * @param maxh: maximum height * @param rect: only this rect will be used for the thumbnail */ QImage createThumbnail(qint32 maxw, qint32 maxh, QRect rect, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::InternalRenderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::InternalConversionFlags); /** * Cached version of createThumbnail(qint32 maxw, qint32 maxh, const KisSelection *selection, QRect rect) */ QImage createThumbnail(qint32 maxw, qint32 maxh, KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::InternalRenderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::InternalConversionFlags); /** * Fill c and opacity with the values found at x and y. * * The color values will be transformed from the profile of * this paint device to the display profile. * * @return true if the operation was successful. */ bool pixel(qint32 x, qint32 y, QColor *c) const; /** * Fill kc with the values found at x and y. This method differs * from the above in using KoColor, which can be of any colorspace * * The color values will be transformed from the profile of * this paint device to the display profile. * * @return true if the operation was successful. */ bool pixel(qint32 x, qint32 y, KoColor * kc) const; /** * Set the specified pixel to the specified color. Note that this * bypasses KisPainter. the PaintDevice is here used as an equivalent * to QImage, not QPixmap. This means that this is not undoable; also, * there is no compositing with an existing value at this location. * * The color values will be transformed from the display profile to * the paint device profile. * * Note that this will use 8-bit values and may cause a significant * degradation when used on 16-bit or hdr quality images. * * @return true if the operation was successful */ bool setPixel(qint32 x, qint32 y, const QColor& c); /// Convience method for the above bool setPixel(qint32 x, qint32 y, const KoColor& kc); /** * @return the colorspace of the pixels in this paint device */ const KoColorSpace* colorSpace() const; /** * There is quite a common technique in Krita. It is used in * cases, when we want to paint something over a paint device * using the composition, opacity or selection. E.g. painting a * dab in a paint op, filling the selection in the Fill Tool. * Such work is usually done in the following way: * * 1) Create a paint device * * 2) Fill it with the desired color or data * * 3) Create a KisPainter and set all the properties of the * trasaction: selection, compositeOp, opacity and etc. * * 4) Paint a newly created paint device over the destination * device. * * The following two methods (createCompositionSourceDevice() or * createCompositionSourceDeviceFixed())should be used for the * accomplishing the step 1). The point is that the desired color * space of the temporary device may not coincide with the color * space of the destination. That is the case, for example, for * the alpha8() colorspace used in the selections. So for such * devices the temporary target would have a different (grayscale) * color space. * * So there are two rules of thumb: * * 1) If you need a temporary device which you are going to fill * with some data and then paint over the paint device, create * it with either createCompositionSourceDevice() or * createCompositionSourceDeviceFixed(). * * 2) Do *not* expect that the color spaces of the destination and * the temporary device would coincide. If you need to copy a * single pixel from one device to another, you can use * KisCrossDeviceColorPicker class, that will handle all the * necessary conversions for you. * * \see createCompositionSourceDeviceFixed() * \see compositionSourceColorSpace() * \see KisCrossDeviceColorPicker * \see KisCrossDeviceColorPickerInt */ KisPaintDeviceSP createCompositionSourceDevice() const; /** * The same as createCompositionSourceDevice(), but initializes the * newly created device with the content of \p cloneSource * * \see createCompositionSourceDevice() */ KisPaintDeviceSP createCompositionSourceDevice(KisPaintDeviceSP cloneSource) const; /** * The same as createCompositionSourceDevice(), but initializes * the newly created device with the *rough* \p roughRect of * \p cloneSource. * * "Rough rect" means that it may copy a bit more than * requested. It is expected that the caller will not use the area * outside \p roughRect. * * \see createCompositionSourceDevice() */ KisPaintDeviceSP createCompositionSourceDevice(KisPaintDeviceSP cloneSource, const QRect roughRect) const; /** * This is a convenience method for createCompositionSourceDevice() * * \see createCompositionSourceDevice() */ KisFixedPaintDeviceSP createCompositionSourceDeviceFixed() const; /** * This is a lowlevel method for the principle used in * createCompositionSourceDevice(). In most of the cases the paint * device creation methods should be used instead of this function. * * \see createCompositionSourceDevice() * \see createCompositionSourceDeviceFixed() */ virtual const KoColorSpace* compositionSourceColorSpace() const; /** * @return the internal datamanager that keeps the pixels. */ KisDataManagerSP dataManager() const; /** * Replace the pixel data, color strategy, and profile. */ void setDataManager(KisDataManagerSP data, const KoColorSpace * colorSpace = 0); /** * Return the number of bytes a pixel takes. */ quint32 pixelSize() const; /** * Return the number of channels a pixel takes */ quint32 channelCount() const; public: /** * Add the specified rect to the parent layer's set of dirty rects * (if there is a parent layer) */ void setDirty(const QRect & rc); /** * Add the specified region to the parent layer's dirty region * (if there is a parent layer) */ void setDirty(const QRegion & region); /** * Set the parent layer completely dirty, if this paint device has * as parent layer. */ void setDirty(); void setDirty(const QVector rects); public: KisHLineIteratorSP createHLineIteratorNG(qint32 x, qint32 y, qint32 w); KisHLineConstIteratorSP createHLineConstIteratorNG(qint32 x, qint32 y, qint32 w) const; KisVLineIteratorSP createVLineIteratorNG(qint32 x, qint32 y, qint32 h); KisVLineConstIteratorSP createVLineConstIteratorNG(qint32 x, qint32 y, qint32 h) const; KisRandomAccessorSP createRandomAccessorNG(qint32 x, qint32 y); KisRandomConstAccessorSP createRandomConstAccessorNG(qint32 x, qint32 y) const; /** * Create an iterator that will "artificially" extend the paint device with the * value of the border when trying to access values outside the range of data. * * @param rc indicates the rectangle that truly contains data */ KisRepeatHLineConstIteratorSP createRepeatHLineConstIterator(qint32 x, qint32 y, qint32 w, const QRect& _dataWidth) const; /** * Create an iterator that will "artificially" extend the paint device with the * value of the border when trying to access values outside the range of data. * * @param rc indicates the rectangle that trully contains data */ KisRepeatVLineConstIteratorSP createRepeatVLineConstIterator(qint32 x, qint32 y, qint32 h, const QRect& _dataWidth) const; /** * This function create a random accessor which can easily access to sub pixel values. * @param selection an up-to-date selection that has the same origin as the paint device */ KisRandomSubAccessorSP createRandomSubAccessor() const; /** Clear the selected pixels from the paint device */ void clearSelection(KisSelectionSP selection); Q_SIGNALS: void profileChanged(const KoColorProfile * profile); void colorSpaceChanged(const KoColorSpace *colorspace); public: friend class PaintDeviceCache; /** * Caclculates exact bounds of the device. Used internally * by a transparent caching system. The solution is very slow * because it does a linear scanline search. So the complexity * is n*n at worst. * * \see exactBounds(), nonDefaultPixelArea() */ QRect calculateExactBounds(bool nonDefaultOnly) const; public: struct MemoryReleaseObject : public QObject { ~MemoryReleaseObject(); }; static MemoryReleaseObject* createMemoryReleaseObject(); private: KisPaintDevice& operator=(const KisPaintDevice&); void init(KisDataManagerSP explicitDataManager, const KoColorSpace *colorSpace, KisDefaultBoundsBaseSP defaultBounds, KisNodeWSP parent, const QString& name); // Only KisPainter is allowed to have access to these low-level methods friend class KisPainter; /** * Return a vector with in order the size in bytes of the channels * in the colorspace of this paint device. */ QVector channelSizes() const; protected: friend class KisSelectionTest; KisNodeWSP parentNode() const; private: struct Private; Private * const m_d; }; #endif // KIS_PAINT_DEVICE_IMPL_H_ diff --git a/krita/image/kis_paint_device_writer.h b/krita/image/kis_paint_device_writer.h index 4b64e0c8cc7..f3db00002de 100644 --- a/krita/image/kis_paint_device_writer.h +++ b/krita/image/kis_paint_device_writer.h @@ -1,31 +1,31 @@ /* * Copyright (c) 2013 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_PAINT_DEVICE_WRITER_H #define KIS_PAINT_DEVICE_WRITER_H -#include +#include class KRITAIMAGE_EXPORT KisPaintDeviceWriter { public: virtual ~KisPaintDeviceWriter() {} virtual bool write(const QByteArray &data) = 0; virtual bool write(const char* data, qint64 length) = 0; }; #endif // KIS_PAINT_DEVICE_WRITER_H diff --git a/krita/image/kis_painter.h b/krita/image/kis_painter.h index 6013a786085..a660fe08dea 100644 --- a/krita/image/kis_painter.h +++ b/krita/image/kis_painter.h @@ -1,805 +1,805 @@ /* * Copyright (c) 2002 Patrick Julien * Copyright (c) 2004 Clarence Dang * Copyright (c) 2008-2010 Lukáš Tvrdý * Copyright (c) 2010 José Luis Vergara Toloza * * 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_PAINTER_H_ #define KIS_PAINTER_H_ #include #include #include #include #include "kundo2magicstring.h" #include "kis_distance_information.h" #include "kis_global.h" #include "kis_types.h" -#include +#include class QPen; class KUndo2Command; class QRect; class QRectF; class QBitArray; class QPainterPath; class KoAbstractGradient; class KoUpdater; class KoColor; class KoCompositeOp; class KisUndoAdapter; class KisPostExecutionUndoAdapter; class KisTransaction; class KoPattern; class KisFilterConfiguration; class KisPaintInformation; class KisPaintOp; /** * KisPainter contains the graphics primitives necessary to draw on a * KisPaintDevice. This is the same kind of abstraction as used in Qt * itself, where you have QPainter and QPaintDevice. * * However, KisPainter works on a tiled image and supports different * color models, and that's a lot more complicated. * * KisPainter supports transactions that can group various paint operations * in one undoable step. * * For more complex operations, you might want to have a look at the subclasses * of KisPainter: KisConvolutionPainter, KisFillPainter and KisGradientPainter * * KisPainter sets a number of default values, like COMPOSITE_OVER for compositeop, * OPACITY_OPAQUE for opacity and no selection for selection. */ class KRITAIMAGE_EXPORT KisPainter { public: /// Construct painter without a device KisPainter(); /// Construct a painter, and begin painting on the device KisPainter(KisPaintDeviceSP device); /// Construct a painter, and begin painting on the device. All actions will be masked by the given selection. KisPainter(KisPaintDeviceSP device, KisSelectionSP selection); virtual ~KisPainter(); public: static void copyAreaOptimized(const QPoint &dstPt, KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &originalSrcRect); static void copyAreaOptimizedOldData(const QPoint &dstPt, KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &originalSrcRect); static void copyAreaOptimized(const QPoint &dstPt, KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &originalSrcRect, KisSelectionSP selection); /** * Start painting on the specified device. Not undoable. */ void begin(KisPaintDeviceSP device); /** * Start painting on the specified paint device. All actions will be masked by the given selection. */ void begin(KisPaintDeviceSP device, KisSelectionSP selection); /** * Finish painting on the current device */ void end(); /** * If set, the painter action is cancelable, if the action supports that. */ void setProgress(KoUpdater * progressUpdater); /// Begin an undoable paint operation void beginTransaction(const KUndo2MagicString& transactionName = KUndo2MagicString(),int timedID = -1); /// Cancel all the changes made by the painter void revertTransaction(); /// Finish the undoable paint operation void endTransaction(KisUndoAdapter *undoAdapter); /** * Finish transaction and load it to a special adapter for strokes */ void endTransaction(KisPostExecutionUndoAdapter *undoAdapter); /** * Finishes a transaction and returns a pointer to its undo command */ KUndo2Command* endAndTakeTransaction(); /** * Finish the transaction and delete it's undo information. * NOTE: Be careful, because all the previous transactions * will become non-undoable after execution of this method. */ void deleteTransaction(); /// continue a transaction started somewhere else void putTransaction(KisTransaction* transaction); /// take transaction out of the reach of KisPainter KisTransaction* takeTransaction(); /// Returns the current paint device. const KisPaintDeviceSP device() const; KisPaintDeviceSP device(); /** * Blast a region of srcWidth @param srcWidth and srcHeight @param srcHeight from @param * srcDev onto the current paint device. @param srcX and @param srcY set the x and y * positions of the origin top-left corner, @param dstX and @param dstY those of * the destination. * Any pixel read outside the limits of @param srcDev will return the * default pixel, this is a property of \ref KisPaintDevice. * * @param dstX the destination x-coordinate * @param dstY the destination y-coordinate * @param srcDev the source device * @param srcX the source x-coordinate * @param srcY the source y-coordinate * @param srcWidth the width of the region to be manipulated * @param srcHeight the height of the region to be manipulated */ void bitBlt(qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight); /** * Convenience method that uses QPoint and QRect. * * @param pos the destination coordinate, it replaces @param dstX and @param dstY. * @param srcDev the source device. * @param srcRect the rectangle describing the area to blast from @param srcDev into the current paint device. * @param srcRect replaces @param srcX, @param srcY, @param srcWidth and @param srcHeight. * */ void bitBlt(const QPoint & pos, const KisPaintDeviceSP srcDev, const QRect & srcRect); /** * The same as @ref bitBlt() but reads data from oldData() part of the device * * @param dstX the destination x-coordinate * @param dstY the destination y-coordinate * @param srcDev the source device * @param srcX the source x-coordinate * @param srcY the source y-coordinate * @param srcWidth the width of the region to be manipulated * @param srcHeight the height of the region to be manipulated */ void bitBltOldData(qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight); /** * Convenience method that uses QPoint and QRect. * * @param pos the destination coordinate, it replaces @param dstX and @param dstY. * @param srcDev the source device. * @param srcRect the rectangle describing the area to blast from @param srcDev into the current paint device. * @param srcRect replaces @param srcX, @param srcY, @param srcWidth and @param srcHeight. * */ void bitBltOldData(const QPoint & pos, const KisPaintDeviceSP srcDev, const QRect & srcRect); /** * Blasts a @param selection of srcWidth @param srcWidth and srcHeight @param srcHeight * of @param srcDev on the current paint device. There is parameters * to control where the area begins in each distinct device, explained below. * @param selection can be used as a mask to shape @param srcDev to * something interesting in the same step it is rendered to the current * paint device. @param selection 's colorspace must be alpha8 (the * colorspace for selections/transparency), the rectangle formed by * @param selX, @param selY, @param srcWidth and @param srcHeight must not go * beyond its limits, and they must be different from zero. * @param selection and KisPainter's selection (the user selection) are * fused together through the composite operation COMPOSITE_MULT. * Any pixel read outside the limits of @param srcDev will return the * default pixel, this is a property of \ref KisPaintDevice. * * @param dstX the destination x-coordinate * @param dstY the destination y-coordinate * @param srcDev the source device * @param selection the custom selection to apply on the source device * @param selX the selection x-coordinate * @param selY the selection y-coordinate * @param srcX the source x-coordinate * @param srcY the source y-coordinate * @param srcWidth the width of the region to be manipulated * @param srcHeight the height of the region to be manipulated * */ void bitBltWithFixedSelection(qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, const KisFixedPaintDeviceSP selection, qint32 selX, qint32 selY, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight); /** * Convenience method that assumes @param selX, @param selY, @param srcX and @param srcY are * equal to 0. Best used when @param selection and the desired area of @param srcDev have exactly * the same dimensions and are specially made for each other. * * @param dstX the destination x-coordinate * @param dstY the destination y-coordinate * @param srcDev the source device * @param selection the custom selection to apply on the source device * @param srcWidth the width of the region to be manipulated * @param srcHeight the height of the region to be manipulated */ void bitBltWithFixedSelection(qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, const KisFixedPaintDeviceSP selection, qint32 srcWidth, qint32 srcHeight); /** * Blast a region of srcWidth @param srcWidth and srcHeight @param srcHeight from @param srcDev onto the current * paint device. @param srcX and @param srcY set the x and y positions of the * origin top-left corner, @param dstX and @param dstY those of the destination. * @param srcDev is a \ref KisFixedPaintDevice: this means that @param srcDev must have the same * colorspace as the destination device. * * @param dstX the destination x-coordinate * @param dstY the destination y-coordinate * @param srcDev the source device * @param srcX the source x-coordinate * @param srcY the source y-coordinate * @param srcWidth the width of the region to be manipulated * @param srcHeight the height of the region to be manipulated */ void bltFixed(qint32 dstX, qint32 dstY, const KisFixedPaintDeviceSP srcDev, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight); /** * Convenience method that uses QPoint and QRect. * * @param pos the destination coordinate, it replaces @param dstX and @param dstY. * @param srcDev the source device. * @param srcRect the rectangle describing the area to blast from @param srcDev into the current paint device. * @param srcRect replaces @param srcX, @param srcY, @param srcWidth and @param srcHeight. * */ void bltFixed(const QPoint & pos, const KisFixedPaintDeviceSP srcDev, const QRect & srcRect); /** * Blasts a @param selection of srcWidth @param srcWidth and srcHeight @param srcHeight * of @param srcDev on the current paint device. There is parameters to control * the top-left corner of the area in each respective paint device (@param dstX, * @param dstY, @param srcX, @param srcY). * @param selection can be used as a mask to shape @param srcDev to something * interesting in the same step it is rendered to the current paint device. * @param srcDev is a \ref KisFixedPaintDevice: this means that @param srcDev * must have the same colorspace as the destination device. * @param selection 's colorspace must be alpha8 (the colorspace for * selections/transparency). * The rectangle formed by the respective top-left coordinates of each device * and @param srcWidth and @param srcHeight must not go beyond their limits, and * they must be different from zero. * @param selection and KisPainter's selection (the user selection) are * fused together through the composite operation COMPOSITE_MULT. * * @param dstX the destination x-coordinate * @param dstY the destination y-coordinate * @param srcDev the source device * @param selection the selection stored in fixed device * @param selX the selection x-coordinate * @param selY the selection y-coordinate * @param srcX the source x-coordinate * @param srcY the source y-coordinate * @param srcWidth the width of the region to be manipulated * @param srcHeight the height of the region to be manipulated */ void bltFixedWithFixedSelection(qint32 dstX, qint32 dstY, const KisFixedPaintDeviceSP srcDev, const KisFixedPaintDeviceSP selection, qint32 selX, qint32 selY, qint32 srcX, qint32 srcY, quint32 srcWidth, quint32 srcHeight); /** * Convenience method that assumes @param selX, @param selY, @param srcX and @param srcY are * equal to 0. Best used when @param selection and @param srcDev have exactly the same * dimensions and are specially made for each other. * * @param dstX the destination x-coordinate * @param dstY the destination y-coordinate * @param srcDev the source device * @param selection the custom selection to apply on the source device * @param srcWidth the width of the region to be manipulated * @param srcHeight the height of the region to be manipulated */ void bltFixedWithFixedSelection(qint32 dstX, qint32 dstY, const KisFixedPaintDeviceSP srcDev, const KisFixedPaintDeviceSP selection, quint32 srcWidth, quint32 srcHeight); /** * fills a region of width @param width and height @param height of the current * paint device with the color @param color. @param x and @param y set the x and y positions of the * origin top-left corner. * * @param x the destination x-coordinate * @param y the destination y-coordinate * @param width the width of the region to be manipulated * @param height the height of the region to be manipulated * @param color the color the area is filled with */ void fill(qint32 x, qint32 y, qint32 width, qint32 height, const KoColor& color); /** * First you need to setup the painter with setMirrorInformation, * then these set of methods provide way to render the devices mirrored * according the axesCenter vertically or horizontally or both. * * @param rc rectangle area covered by dab * @param dab this device will be mirrored in-place, it means that it will be changed */ void renderMirrorMask(QRect rc, KisFixedPaintDeviceSP dab); void renderMirrorMask(QRect rc, KisFixedPaintDeviceSP dab, KisFixedPaintDeviceSP mask); void renderMirrorMask(QRect rc, KisPaintDeviceSP dab); void renderMirrorMask(QRect rc, KisPaintDeviceSP dab, int sx, int sy, KisFixedPaintDeviceSP mask); /** * Convenience method for renderMirrorMask(), allows to choose whether * we need to preserve out dab or do the transformations in-place. * * @param rc rectangle area covered by dab * @param dab the device to render * @param preserveDab states whether a temporary device should be * created to do the transformations */ void renderMirrorMaskSafe(QRect rc, KisFixedPaintDeviceSP dab, bool preserveDab); /** * Convenience method for renderMirrorMask(), allows to choose whether * we need to preserve our fixed mask or do the transformations in-place. * * @param rc rectangle area covered by dab * @param dab the device to render * @param mask mask to use for rendering * @param preserveMask states whether a temporary device should be * created to do the transformations */ void renderMirrorMaskSafe(QRect rc, KisPaintDeviceSP dab, int sx, int sy, KisFixedPaintDeviceSP mask, bool preserveMask); /** * A complex method that re-renders a dab on an \p rc area. * The \p rc area and all the dedicated mirroring areas are cleared * before the painting, so this method should be used by paintops * which do not update the canvas incrementally, but instead * regenerate some internal cache \p dab with the COMPOSITE_COPY op. * * \see KisExperimentPaintOp */ void renderDabWithMirroringNonIncremental(QRect rc, KisPaintDeviceSP dab); /** * The methods in this class do not tell the paintdevice to update, but they calculate the * dirty area. This method returns this dirty area and resets it. */ QVector takeDirtyRegion(); /** * Paint a line that connects the dots in points */ void paintPolyline(const QVector &points, int index = 0, int numPoints = -1); /** * Draw a line between pos1 and pos2 using the currently set brush and color. * If savedDist is less than zero, the brush is painted at pos1 before being * painted along the line using the spacing setting. * @return the drag distance, that is the remains of the distance between p1 and p2 not covered * because the currenlty set brush has a spacing greater than that distance. */ void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *curentDistance); /** * Draw a Bezier curve between pos1 and pos2 using control points 1 and 2. * If savedDist is less than zero, the brush is painted at pos1 before being * painted along the curve using the spacing setting. * @return the drag distance, that is the remains of the distance between p1 and p2 not covered * because the currenlty set brush has a spacing greater than that distance. */ void paintBezierCurve(const KisPaintInformation &pi1, const QPointF &control1, const QPointF &control2, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance); /** * Fill the given vector points with the points needed to draw the Bezier curve between * pos1 and pos2 using control points 1 and 2, excluding the final pos2. */ void getBezierCurvePoints(const QPointF &pos1, const QPointF &control1, const QPointF &control2, const QPointF &pos2, vQPointF& points) const; /** * Paint a rectangle. * @param rect the rectangle to paint. */ void paintRect(const QRectF &rect); /** * Paint a rectangle. * * @param x x coordinate of the top-left corner * @param y y coordinate of the top-left corner * @param w the rectangle width * @param h the rectangle height */ void paintRect(const qreal x, const qreal y, const qreal w, const qreal h); /** * Paint the ellipse that fills the given rectangle. * * @param rect the rectangle containing the ellipse to paint. */ void paintEllipse(const QRectF &rect); /** * Paint the ellipse that fills the given rectangle. * * @param x x coordinate of the top-left corner * @param y y coordinate of the top-left corner * @param w the rectangle width * @param h the rectangle height */ void paintEllipse(const qreal x, const qreal y, const qreal w, const qreal h); /** * Paint the polygon with the points given in points. It automatically closes the polygon * by drawing the line from the last point to the first. */ void paintPolygon(const vQPointF& points); /** Draw a spot at pos using the currently set paint op, brush and color */ void paintAt(const KisPaintInformation &pos, KisDistanceInformation *savedDist); /** * Stroke the given QPainterPath. */ void paintPainterPath(const QPainterPath& path); /** * Fills the area enclosed by the given QPainterPath * Convenience method for fillPainterPath(path, rect) */ void fillPainterPath(const QPainterPath& path); /** * Fills the portion of an area enclosed by the given QPainterPath * * \param rect the portion of the path to fill */ void fillPainterPath(const QPainterPath& path, const QRect &requestedRect); /** * Draw the path using the Pen * * if \p requestedRect is null, the entire path is painted */ void drawPainterPath(const QPainterPath& path, const QPen& pen, const QRect &requestedRect); // convenience overload void drawPainterPath(const QPainterPath& path, const QPen& pen); /** * paint an unstroked one-pixel wide line from specified start position to the * specified end position. * */ void drawLine(const QPointF & start, const QPointF & end); /** * paint an unstroked line with thickness from specified start position to the * specified end position. Scanline algorithm is used. */ void drawLine(const QPointF &start, const QPointF &end, qreal width, bool antialias); /** * paints an unstroked, aliased one-pixel line using the DDA algorithm from specified start position to the * specified end position. * */ void drawDDALine(const QPointF & start, const QPointF & end); /** * Paint an unstroked, wobbly one-pixel wide line from the specified start to the specified * end position. * */ void drawWobblyLine(const QPointF & start, const QPointF & end); /** * Paint an unstroked, anti-aliased one-pixel wide line from the specified start to the specified * end position using the Wu algorithm */ void drawWuLine(const QPointF & start, const QPointF & end); /** * Paint an unstroked wide line from the specified start to the specified * end position with width varying from @param w1 at the start to @param w2 at * the end. * * XXX: the width should be set in doubles, not integers. */ void drawThickLine(const QPointF & start, const QPointF & end, int startWidth, int endWidth); /** * Set the channelflags: a bit array where true means that the * channel corresponding in position with the bit will be read * by the operation, and false means that it will not be affected. * * An empty channelFlags parameter means that all channels are * affected. * * @param the bit array that masks the source channels; only * the channels where the corresponding bit is true will will be * composited onto the destination device. */ void setChannelFlags(QBitArray channelFlags); /// @return the channel flags QBitArray channelFlags(); /** * Set the paintop preset to use. If @param image is given, * the paintop will be created using this image as parameter. * Some paintops really want to know about the image they work * for, e.g. the clone paintop. */ void setPaintOpPreset(KisPaintOpPresetSP preset, KisNodeSP node, KisImageSP image); /// Return the paintop preset KisPaintOpPresetSP preset() const; /** * Return the active paintop (which is created based on the specified preset and * will be deleted as soon as the KisPainter instance dies). */ KisPaintOp* paintOp() const; void setMirrorInformation(const QPointF &axesCenter, bool mirrorHorizontaly, bool mirrorVerticaly); /** * copy the mirror information to other painter */ void copyMirrorInformation(KisPainter * painter); /** * Returns whether the mirroring methods will do any * work when called */ bool hasMirroring() const; /// Set the current pattern void setPattern(const KoPattern * pattern); /// Returns the currently set pattern const KoPattern * pattern() const; /** * Set the color that will be used to paint with, and convert it * to the color space of the current paint device. */ void setPaintColor(const KoColor& color); /// Returns the color that will be used to paint with const KoColor &paintColor() const; /** * Set the current background color, and convert it * to the color space of the current paint device. */ void setBackgroundColor(const KoColor& color); /// Returns the current background color const KoColor &backgroundColor() const; /// Set the current generator (a generator can be used to fill an area void setGenerator(const KisFilterConfiguration * generator); /// @return the current generator configuration const KisFilterConfiguration * generator() const; /// This enum contains the styles with which we can fill things like polygons and ellipses enum FillStyle { FillStyleNone, FillStyleForegroundColor, FillStyleBackgroundColor, FillStylePattern, FillStyleGradient, FillStyleStrokes, FillStyleGenerator }; /// Set the current style with which to fill void setFillStyle(FillStyle fillStyle); /// Returns the current fill style FillStyle fillStyle() const; /// Set whether a polygon's filled area should be anti-aliased or not. The default is true. void setAntiAliasPolygonFill(bool antiAliasPolygonFill); /// Return whether a polygon's filled area should be anti-aliased or not bool antiAliasPolygonFill(); /// The style of the brush stroke around polygons and so enum StrokeStyle { StrokeStyleNone, StrokeStyleBrush }; /// Set the current brush stroke style void setStrokeStyle(StrokeStyle strokeStyle); /// Returns the current brush stroke style StrokeStyle strokeStyle() const; void setFlow(quint8 flow); quint8 flow() const; /** * Sets the opacity of the painting and recalculates the * mean opacity of the stroke. This mean value is used to * make ALPHA_DARKEN painting look correct */ void setOpacityUpdateAverage(quint8 opacity); /// Set the opacity which is used in painting (like filling polygons) void setOpacity(quint8 opacity); /// Returns the opacity that is used in painting quint8 opacity() const; /// Set the composite op for this painter void setCompositeOp(const KoCompositeOp * op); const KoCompositeOp * compositeOp(); /// Set the composite op for this painter by string. /// Note: the colorspace must be set previously! void setCompositeOp(const QString& op); /** * Add the r to the current dirty rect. */ void addDirtyRect(const QRect & r); /** * Reset the selection to the given selection. All painter actions will be * masked by the specified selection. */ void setSelection(KisSelectionSP selection); /** * @return the selection set on this painter. */ KisSelectionSP selection(); void setGradient(const KoAbstractGradient* gradient); const KoAbstractGradient* gradient() const; /** * Set the size of the tile in fillPainterPath, useful when optimizing the use of fillPainterPath * e.g. Spray paintop uses more small tiles, although selections uses bigger tiles. QImage::fill * is quite expensive so with smaller images you can save instructions * Default and maximum size is 256x256 image */ void setMaskImageSize(qint32 width, qint32 height); // /** // * If the alpha channel is locked, the alpha values of the paint device we are painting on // * will not change. // */ // void setLockAlpha(bool protect); // bool alphaLocked() const; /** * set the rendering intent in case pixels need to be converted before painting */ void setRenderingIntent(KoColorConversionTransformation::Intent intent); /** * set the conversion flags in case pixels need to be converted before painting */ void setColorConversionFlags(KoColorConversionTransformation::ConversionFlags conversionFlags); protected: /// Initialize, set everything to '0' or defaults void init(); /// Fill the polygon defined by points with the fillStyle void fillPolygon(const vQPointF& points, FillStyle fillStyle); private: KisPainter(const KisPainter&); KisPainter& operator=(const KisPainter&); float frac(float value) { float tmp = 0; return modff(value , &tmp); } float invertFrac(float value) { float tmp = 0; return 1.0f - modff(value , &tmp); } protected: KoUpdater * progressUpdater(); private: template void bitBltImpl(qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight); inline void compositeOnePixel(quint8 *dst, const KoColor &color); private: struct Private; Private* const d; }; #endif // KIS_PAINTER_H_ diff --git a/krita/image/kis_perspective_grid.h b/krita/image/kis_perspective_grid.h index 4e4d71b7b99..91a18400d8e 100644 --- a/krita/image/kis_perspective_grid.h +++ b/krita/image/kis_perspective_grid.h @@ -1,138 +1,138 @@ /* * This file is part of Krita * * Copyright (c) 2006 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_PERSPECTIVE_GRID_H #define KIS_PERSPECTIVE_GRID_H #include #include #include #include #include -#include +#include class KisPerspectiveGridNode; typedef KisSharedPtr KisPerspectiveGridNodeSP; class KisSubPerspectiveGrid; /** * This class is the corner of sub perspective grid, it can be shared between various grid. */ class KRITAIMAGE_EXPORT KisPerspectiveGridNode : public QPointF, public KisShared { friend class KisSubPerspectiveGrid; public: KisPerspectiveGridNode(double x, double y); KisPerspectiveGridNode(QPointF p); KisPerspectiveGridNode(const KisPerspectiveGridNode&); ~KisPerspectiveGridNode(); void mergeWith(KisPerspectiveGridNodeSP); private: void registerSubPerspectiveGrid(KisSubPerspectiveGrid*); void unRegisterSubPerspectiveGrid(KisSubPerspectiveGrid*); bool containsSubPerspectiveGrid(KisSubPerspectiveGrid*); private: struct Private; Private* const d; }; /** * This class contains the information of a sub perspective grid. */ class KRITAIMAGE_EXPORT KisSubPerspectiveGrid { public: KisSubPerspectiveGrid(KisPerspectiveGridNodeSP topLeft, KisPerspectiveGridNodeSP topRight, KisPerspectiveGridNodeSP bottomRight, KisPerspectiveGridNodeSP bottomLeft); ~KisSubPerspectiveGrid(); QPointF topBottomVanishingPoint(); QPointF leftRightVanishingPoint(); /** * @return the top left corner of the grid */ const KisPerspectiveGridNodeSP topLeft() const; KisPerspectiveGridNodeSP topLeft(); void setTopLeft(KisPerspectiveGridNodeSP); const KisPerspectiveGridNodeSP topRight() const; KisPerspectiveGridNodeSP topRight(); void setTopRight(KisPerspectiveGridNodeSP); const KisPerspectiveGridNodeSP bottomLeft() const; KisPerspectiveGridNodeSP bottomLeft(); void setBottomLeft(KisPerspectiveGridNodeSP); const KisPerspectiveGridNodeSP bottomRight() const; KisPerspectiveGridNodeSP bottomRight(); void setBottomRight(KisPerspectiveGridNodeSP); int subdivisions() const; /** * @return the center of the sub perspective grid */ QPointF center() const; /** * Return the index of the subgrid, the value is automatically set when the KisSubPerspectiveGrid, it is useful for * drawing the perspective grid, to avoid drawing twice the same border, or points */ int index() const; /** * @return true if the point p is contain by the grid */ bool contains(const QPointF p) const; private: inline QPointF computeVanishingPoint(KisPerspectiveGridNodeSP p11, KisPerspectiveGridNodeSP p12, KisPerspectiveGridNodeSP p21, KisPerspectiveGridNodeSP p22); private: struct Private; Private* const d; }; /** * This class contains the list of sub perspective grid */ class KRITAIMAGE_EXPORT KisPerspectiveGrid { public: KisPerspectiveGrid(); ~KisPerspectiveGrid(); /** * @return false if the grid wasn't added, note that subgrids must be attached to an other grid, except if it's the first grid */ bool addNewSubGrid(KisSubPerspectiveGrid* ng); QList::const_iterator begin() const; QList::const_iterator end() const; bool hasSubGrids() const; void clearSubGrids(); int countSubGrids() const; /** * Delete the grid given as argument and remove it from the list of grids. */ void deleteSubGrid(KisSubPerspectiveGrid* grid); /** * @return the first grid hit by the point p */ KisSubPerspectiveGrid* gridAt(QPointF p); private: struct Private; Private* const d; }; #endif diff --git a/krita/image/kis_perspective_math.h b/krita/image/kis_perspective_math.h index f4bf96f6588..9ccfe4fd3a1 100644 --- a/krita/image/kis_perspective_math.h +++ b/krita/image/kis_perspective_math.h @@ -1,53 +1,53 @@ /* * This file is part of Krita * * Copyright (c) 2006 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_PERSPECTIVE_MATH_H_ #define _KIS_PERSPECTIVE_MATH_H_ #include "kis_vec.h" #include #include typedef Eigen::Matrix Matrix3qreal; typedef Eigen::Matrix Matrix9qreal; typedef Eigen::Matrix Vector9qreal; typedef Eigen::Hyperplane LineEquation; -#include +#include class QRect; class KRITAIMAGE_EXPORT KisPerspectiveMath { private: KisPerspectiveMath() { } public: static Matrix3qreal computeMatrixTransfo(const QPointF& topLeft1, const QPointF& topRight1, const QPointF& bottomLeft1, const QPointF& bottomRight1, const QPointF& topLeft2, const QPointF& topRight2, const QPointF& bottomLeft2, const QPointF& bottomRight2); static Matrix3qreal computeMatrixTransfoToPerspective(const QPointF& topLeft, const QPointF& topRight, const QPointF& bottomLeft, const QPointF& bottomRight, const QRect& r); static Matrix3qreal computeMatrixTransfoFromPerspective(const QRect& r, const QPointF& topLeft, const QPointF& topRight, const QPointF& bottomLeft, const QPointF& bottomRight); /// TODO: get rid of this in 2.0 static inline QPointF matProd(const Matrix3qreal& m, const QPointF& p) { qreal s = qreal(1) / (p.x() * m.coeff(2, 0) + p.y() * m.coeff(2, 1) + 1.0); return QPointF((p.x() * m.coeff(0, 0) + p.y() * m.coeff(0, 1) + m.coeff(0, 2)) * s, (p.x() * m.coeff(1, 0) + p.y() * m.coeff(1, 1) + m.coeff(1, 2)) * s); } }; #endif diff --git a/krita/image/kis_perspectivetransform_worker.h b/krita/image/kis_perspectivetransform_worker.h index 796fd24c3ae..f148ea61a2d 100644 --- a/krita/image/kis_perspectivetransform_worker.h +++ b/krita/image/kis_perspectivetransform_worker.h @@ -1,69 +1,69 @@ /* * This file is part of Krita * * Copyright (c) 2006 Cyrille Berger * Copyright (c) 2010 Marc Pegon * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1 of the License. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_PERSPECTIVETRANSFORM_WORKER_H #define KIS_PERSPECTIVETRANSFORM_WORKER_H #include "kis_types.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include #include #include #include class KRITAIMAGE_EXPORT KisPerspectiveTransformWorker { public: KisPerspectiveTransformWorker(KisPaintDeviceSP dev, QPointF center, double aX, double aY, double distance, KoUpdaterPtr progress); KisPerspectiveTransformWorker(KisPaintDeviceSP dev, const QTransform &transform, KoUpdaterPtr progress); ~KisPerspectiveTransformWorker(); void run(); void runPartialDst(KisPaintDeviceSP srcDev, KisPaintDeviceSP dstDev, const QRect &dstRect); void setForwardTransform(const QTransform &transform); QTransform forwardTransform() const; QTransform backwardTransform() const; private: void init(const QTransform &transform); void fillParams(const QRectF &srcRect, const QRect &dstBaseClipRect, QRegion *dstRegion, QPolygonF *dstClipPolygon); private: KisPaintDeviceSP m_dev; KoUpdaterPtr m_progressUpdater; QRegion m_dstRegion; QRectF m_srcRect; QTransform m_backwardTransform; QTransform m_forwardTransform; bool m_isIdentity; }; #endif diff --git a/krita/image/kis_pixel_selection.h b/krita/image/kis_pixel_selection.h index da78ef2a861..3178d3236b2 100644 --- a/krita/image/kis_pixel_selection.h +++ b/krita/image/kis_pixel_selection.h @@ -1,161 +1,161 @@ /* * Copyright (c) 2004 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_PIXEL_SELECTION_H_ #define KIS_PIXEL_SELECTION_H_ #include #include #include "kis_types.h" #include "kis_paint_device.h" #include "kis_selection_component.h" #include "kis_selection.h" -#include +#include /** * KisPixelSelection contains a byte-map representation of a layer, where * the value of a byte signifies whether a corresponding pixel is selected, or not. */ class KRITAIMAGE_EXPORT KisPixelSelection : public KisPaintDevice, public KisSelectionComponent { public: /** * Create a new KisPixelSelection. This selection will not have a * parent paint device. */ KisPixelSelection(KisDefaultBoundsBaseSP defaultBounds = 0, KisSelectionWSP parentSelection = 0); /** * Copy the selection */ KisPixelSelection(const KisPixelSelection& rhs); virtual ~KisPixelSelection(); KisSelectionComponent* clone(KisSelection*); const KoColorSpace* compositionSourceColorSpace() const; bool read(QIODevice *stream); /** * Fill the specified rect with the specified selectedness. */ void select(const QRect & r, quint8 selectedness = MAX_SELECTED); /** * Invert the total selection. This will also invert the default value * of the selection paint device, from MIN_SELECTED to MAX_SELECTED or * back. */ void invert(); /** * Set the specified rect to MIN_SELECTED. */ void clear(const QRect & r); /** * Reset the entire selection. The selectedRect and selectedExactRect * will be empty. The selection will be completely deselected. */ void clear(); /** * Apply a selection to the selection using the specified selection mode */ void applySelection(KisPixelSelectionSP selection, SelectionAction action); /// Tests if the rect is totally outside the selection bool isTotallyUnselected(const QRect & r) const; /** * Rough, but fastish way of determining the area * of the tiles used by the selection. */ QRect selectedRect() const; /** * Slow, but exact way of determining the rectangle * that encloses the selection. */ QRect selectedExactRect() const; /** * @brief outline returns the outline of the current selection * @return a vector of polygons that can be used to draw the outline */ QVector outline() const; /** * Overridden from KisPaintDevice to handle outline cache moves */ void move(const QPoint& pt); using KisPaintDevice::move; bool isEmpty() const; QPainterPath outlineCache() const; bool outlineCacheValid() const; void recalculateOutlineCache(); void setOutlineCache(const QPainterPath &cache); void invalidateOutlineCache(); bool thumbnailImageValid() const; QImage thumbnailImage() const; QTransform thumbnailImageTransform() const; void recalculateThumbnailImage(const QColor &maskColor); void setParentSelection(KisSelectionWSP selection); KisSelectionWSP parentSelection() const; virtual void renderToProjection(KisPaintDeviceSP projection); virtual void renderToProjection(KisPaintDeviceSP projection, const QRect& r); private: /** * Add a selection */ void addSelection(KisPixelSelectionSP selection); /** * Subtracts a selection */ void subtractSelection(KisPixelSelectionSP selection); /** * Intersects a selection using min-T-norm for this. */ void intersectSelection(KisPixelSelectionSP selection); private: // We don't want these methods to be used on selections: using KisPaintDevice::extent; using KisPaintDevice::exactBounds; private: struct Private; Private * const m_d; }; #endif // KIS_PIXEL_SELECTION_H_ diff --git a/krita/image/kis_polygonal_gradient_shape_strategy.h b/krita/image/kis_polygonal_gradient_shape_strategy.h index 8c32ecbecb0..3808ed57a0e 100644 --- a/krita/image/kis_polygonal_gradient_shape_strategy.h +++ b/krita/image/kis_polygonal_gradient_shape_strategy.h @@ -1,50 +1,50 @@ /* * Copyright (c) 2014 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_POLYGONAL_GRADIENT_SHAPE_STRATEGY_H #define __KIS_POLYGONAL_GRADIENT_SHAPE_STRATEGY_H #include "kis_gradient_shape_strategy.h" #include #include -#include "krita_export.h" +#include "kritaimage_export.h" class KRITAIMAGE_EXPORT KisPolygonalGradientShapeStrategy : public KisGradientShapeStrategy { public: KisPolygonalGradientShapeStrategy(const QPainterPath &selectionPath, qreal exponent); ~KisPolygonalGradientShapeStrategy(); double valueAt(double x, double y) const; static QPointF testingCalculatePathCenter(int numSamples, const QPainterPath &path, qreal exponent, bool searchForMax); private: QPainterPath m_selectionPath; qreal m_exponent; qreal m_minWeight; qreal m_maxWeight; qreal m_scaleCoeff; }; #endif /* __KIS_POLYGONAL_GRADIENT_SHAPE_STRATEGY_H */ diff --git a/krita/image/kis_post_execution_undo_adapter.h b/krita/image/kis_post_execution_undo_adapter.h index 504e93bb9ef..12bb6d243cc 100644 --- a/krita/image/kis_post_execution_undo_adapter.h +++ b/krita/image/kis_post_execution_undo_adapter.h @@ -1,58 +1,58 @@ /* * Copyright (c) 2011 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_POST_EXECUTION_UNDO_ADAPTER_H #define __KIS_POST_EXECUTION_UNDO_ADAPTER_H -#include +#include #include "kis_types.h" class KUndo2MagicString; class KisUndoStore; class KisSavedMacroCommand; class KisStrokesFacade; /** * KisPostExecutionUndoAdapter -- used by the strokes. It doesn't * call redo() when you add a command. It is assumed, that you have * already executed the command yourself and now just notify * the system about it. Warning: it doesn't inherit KisUndoAdapter * because it doesn't fit the contract of this class. And, more * important, KisTransaction should work differently with this class. */ class KRITAIMAGE_EXPORT KisPostExecutionUndoAdapter { public: KisPostExecutionUndoAdapter(KisUndoStore *undoStore, KisStrokesFacade *strokesFacade); void addCommand(KUndo2CommandSP command); KisSavedMacroCommand* createMacro(const KUndo2MagicString& macroName); void addMacro(KisSavedMacroCommand *macro); inline void setUndoStore(KisUndoStore *undoStore) { m_undoStore = undoStore; } private: KisUndoStore *m_undoStore; KisStrokesFacade *m_strokesFacade; }; #endif /* __KIS_POST_EXECUTION_UNDO_ADAPTER_H */ diff --git a/krita/image/kis_processing_applicator.h b/krita/image/kis_processing_applicator.h index be3c27d67a8..bdc52c61246 100644 --- a/krita/image/kis_processing_applicator.h +++ b/krita/image/kis_processing_applicator.h @@ -1,94 +1,94 @@ /* * Copyright (c) 2011 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_PROCESSING_APPLICATOR_H #define __KIS_PROCESSING_APPLICATOR_H -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" #include "kis_stroke_job_strategy.h" #include "kis_image_signal_router.h" #include "kundo2magicstring.h" #include "kundo2commandextradata.h" class KRITAIMAGE_EXPORT KisProcessingApplicator { public: enum ProcessingFlag { NONE = 0x0, RECURSIVE = 0x1, NO_UI_UPDATES = 0x2, SUPPORTS_WRAPAROUND_MODE = 0x4 }; Q_DECLARE_FLAGS(ProcessingFlags, ProcessingFlag) public: KisProcessingApplicator(KisImageWSP image, KisNodeSP node, ProcessingFlags flags = NONE, KisImageSignalVector emitSignals = KisImageSignalVector(), const KUndo2MagicString &name = KUndo2MagicString(), KUndo2CommandExtraData *extraData = 0); ~KisProcessingApplicator(); void applyVisitor(KisProcessingVisitorSP visitor, KisStrokeJobData::Sequentiality sequentiality = KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::Exclusivity exclusivity = KisStrokeJobData::NORMAL); void applyCommand(KUndo2Command *command, KisStrokeJobData::Sequentiality sequentiality = KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::Exclusivity exclusivity = KisStrokeJobData::NORMAL); /** * This method emits all the final update signals of the stroke * without actually ending the stroke. This can be used for * long-running strokes which are kept open to implement preview * of the actions. * * WARNING: you cannot add new commands/processings after the * final signals has been emitted. You should either call end() or * cancel(). */ void explicitlyEmitFinalSignals(); void end(); void cancel(); private: void visitRecursively(KisNodeSP node, KisProcessingVisitorSP visitor, KisStrokeJobData::Sequentiality sequentiality, KisStrokeJobData::Exclusivity exclusivity); private: KisImageWSP m_image; KisNodeSP m_node; ProcessingFlags m_flags; KisImageSignalVector m_emitSignals; KisStrokeId m_strokeId; bool m_finalSignalsEmitted; }; Q_DECLARE_OPERATORS_FOR_FLAGS(KisProcessingApplicator::ProcessingFlags) #endif /* __KIS_PROCESSING_APPLICATOR_H */ diff --git a/krita/image/kis_processing_information.h b/krita/image/kis_processing_information.h index 87e75b82ce4..9b14dbe22ec 100644 --- a/krita/image/kis_processing_information.h +++ b/krita/image/kis_processing_information.h @@ -1,78 +1,78 @@ /* * 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_PROCESSING_INFORMATION_H_ #define _KIS_PROCESSING_INFORMATION_H_ #include "kis_types.h" -#include "krita_export.h" +#include "kritaimage_export.h" /** * This class is used in KisFilter to contain information needed to apply a filter * on a paint device. * This one have only a const paint device and holds information about the source. */ class KRITAIMAGE_EXPORT KisConstProcessingInformation { public: KisConstProcessingInformation(const KisPaintDeviceSP device, const QPoint& topLeft, const KisSelectionSP selection = 0); KisConstProcessingInformation(const KisConstProcessingInformation& _rhs); KisConstProcessingInformation& operator=(const KisConstProcessingInformation& _rhs); ~KisConstProcessingInformation(); /** * @return the paint device */ const KisPaintDeviceSP paintDevice() const; /** * @return the active selection */ const KisSelectionSP selection() const; /** * @return the top left pixel that need to process */ const QPoint& topLeft() const; private: struct Private; Private* const d; }; /** * This class is used in KisFilter to contain information needed to apply a filter * on a paint device. * This one can have a non const paint device and holds information about the destination. */ class KRITAIMAGE_EXPORT KisProcessingInformation : public KisConstProcessingInformation { public: KisProcessingInformation(KisPaintDeviceSP device, const QPoint& topLeft, const KisSelectionSP selection = 0); KisProcessingInformation(const KisProcessingInformation& _rhs); KisProcessingInformation& operator=(const KisProcessingInformation& _rhs); ~KisProcessingInformation(); /** * @return the paint device */ KisPaintDeviceSP paintDevice(); private: struct Private; Private* const d; }; #endif diff --git a/krita/image/kis_processing_visitor.h b/krita/image/kis_processing_visitor.h index 2c03dd6f8ed..9a187a4da9d 100644 --- a/krita/image/kis_processing_visitor.h +++ b/krita/image/kis_processing_visitor.h @@ -1,77 +1,77 @@ /* * Copyright (c) 2011 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_PROCESSING_VISITOR_H #define __KIS_PROCESSING_VISITOR_H -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_shared.h" #include class KisNode; class KoUpdater; class KoProgressUpdater; class KisUndoAdapter; class KisPaintLayer; class KisGroupLayer; class KisAdjustmentLayer; class KisExternalLayer; class KisCloneLayer; class KisFilterMask; class KisTransformMask; class KisTransparencyMask; class KisSelectionMask; class KisGeneratorLayer; /** * A visitor that processes a single layer; it does not recurse into the * layer's children. Classes inheriting KisProcessingVisitor must not * emit signals or ask the image to update the projection. */ class KRITAIMAGE_EXPORT KisProcessingVisitor : public KisShared { public: virtual ~KisProcessingVisitor(); virtual void visit(KisNode *node, KisUndoAdapter *undoAdapter) = 0; virtual void visit(KisPaintLayer *layer, KisUndoAdapter *undoAdapter) = 0; virtual void visit(KisGroupLayer *layer, KisUndoAdapter *undoAdapter) = 0; virtual void visit(KisAdjustmentLayer *layer, KisUndoAdapter *undoAdapter) = 0; virtual void visit(KisExternalLayer *layer, KisUndoAdapter *undoAdapter) = 0; virtual void visit(KisGeneratorLayer *layer, KisUndoAdapter *undoAdapter) = 0; virtual void visit(KisCloneLayer *layer, KisUndoAdapter *undoAdapter) = 0; virtual void visit(KisFilterMask *mask, KisUndoAdapter *undoAdapter) = 0; virtual void visit(KisTransformMask *mask, KisUndoAdapter *undoAdapter) = 0; virtual void visit(KisTransparencyMask *mask, KisUndoAdapter *undoAdapter) = 0; virtual void visit(KisSelectionMask *mask, KisUndoAdapter *undoAdapter) = 0; public: class KRITAIMAGE_EXPORT ProgressHelper { public: ProgressHelper(const KisNode *node); ~ProgressHelper(); KoUpdater* updater() const; private: KoProgressUpdater *m_progressUpdater; mutable QMutex m_progressMutex; }; }; #endif /* __KIS_PROCESSING_VISITOR_H */ diff --git a/krita/image/kis_progress_interface.h b/krita/image/kis_progress_interface.h index 704274717a8..e60facd4afe 100644 --- a/krita/image/kis_progress_interface.h +++ b/krita/image/kis_progress_interface.h @@ -1,37 +1,37 @@ /* * This file is part of KimageShop^WKrayon^WKrita * * Copyright (c) 2009 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_PROGRESS_INTERFACE_H #define KIS_PROGRESS_INTERFACE_H -#include +#include class KoProgressUpdater; class KRITAIMAGE_EXPORT KisProgressInterface { public: virtual ~KoProgressInterface(); virtual void detachUpdater(KoProgressUpdater* updater) = 0; virtual void attachUpdater(KoProgressUpdater* updater) = 0; }; #endif // KIS_PROGRESS_INTERFACE_H diff --git a/krita/image/kis_progress_updater.h b/krita/image/kis_progress_updater.h index 21744ce80c8..23234ee422c 100644 --- a/krita/image/kis_progress_updater.h +++ b/krita/image/kis_progress_updater.h @@ -1,53 +1,53 @@ /* * This file is part of KimageShop^WKrayon^WKrita * * Copyright (c) 2009 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_PROGRESS_UPDATER_H #define KIS_PROGRESS_UPDATER_H #include -#include +#include class KRITAIMAGE_EXPORT KisProgressInterface { public: virtual ~KisProgressInterface() {}; virtual void detachUpdater(KoProgressUpdater* updater) = 0; virtual void attachUpdater(KoProgressUpdater* updater) = 0; }; /** * KisProgressUpdater is an updater that disengages itself automatically * from the updater widget when done. */ class KRITAIMAGE_EXPORT KisProgressUpdater : public KoProgressUpdater { public: KisProgressUpdater(KisProgressInterface* progressInterface, KoProgressProxy* proxy, KoProgressUpdater::Mode mode = KoProgressUpdater::Threaded); virtual ~KisProgressUpdater(); private: KisProgressInterface* m_interface; }; #endif // KIS_PROGRESS_UPDATER_H diff --git a/krita/image/kis_projection_leaf.h b/krita/image/kis_projection_leaf.h index 83ad1c485bd..a18b1c746cf 100644 --- a/krita/image/kis_projection_leaf.h +++ b/krita/image/kis_projection_leaf.h @@ -1,70 +1,70 @@ /* * 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_PROJECTION_LEAF_H #define __KIS_PROJECTION_LEAF_H #include #include "kis_types.h" -#include "krita_export.h" +#include "kritaimage_export.h" class KisNodeVisitor; class KRITAIMAGE_EXPORT KisProjectionLeaf { public: KisProjectionLeaf(KisNode *node); virtual ~KisProjectionLeaf(); KisProjectionLeafSP parent() const; KisProjectionLeafSP firstChild() const; KisProjectionLeafSP lastChild() const; KisProjectionLeafSP prevSibling() const; KisProjectionLeafSP nextSibling() const; bool hasChildren() const; KisNodeSP node() const; KisAbstractProjectionPlaneSP projectionPlane() const; bool accept(KisNodeVisitor &visitor); KisPaintDeviceSP original(); KisPaintDeviceSP projection(); bool isRoot() const; bool isLayer() const; bool isMask() const; bool canHaveChildLayers() const; bool dependsOnLowerNodes() const; bool visible() const; quint8 opacity() const; QBitArray channelFlags() const; bool isStillInGraph() const; bool isDroppedMask() const; private: struct Private; const QScopedPointer m_d; }; #endif /* __KIS_PROJECTION_LEAF_H */ diff --git a/krita/image/kis_properties_configuration.h b/krita/image/kis_properties_configuration.h index 523d300ee75..7db74f64af0 100644 --- a/krita/image/kis_properties_configuration.h +++ b/krita/image/kis_properties_configuration.h @@ -1,157 +1,157 @@ /* * Copyright (c) 2006 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_PROPERTIES_CONFIGURATION_H_ #define _KIS_PROPERTIES_CONFIGURATION_H_ #include #include #include #include #include #include class QDomElement; class QDomDocument; #include "kis_serializable_configuration.h" -#include "krita_export.h" +#include "kritaimage_export.h" /** * KisPropertiesConfiguration is a map-based properties class that can * be serialized and deserialized. * * It differs from the base class KisSerializableConfiguration in that * it provides a number of convenience methods to get at the data and */ class KRITAIMAGE_EXPORT KisPropertiesConfiguration : public KisSerializableConfiguration { public: /** * Create a new properties config. */ KisPropertiesConfiguration(); virtual ~KisPropertiesConfiguration(); /** * Deep copy the properties configFile */ KisPropertiesConfiguration(const KisPropertiesConfiguration& rhs); public: /** * Fill the properties configuration object from the XML encoded representation in s. * This function use the "Legacy" style XML of the 1.x .kra file format. */ virtual void fromXML(const QString&); /** * Fill the properties configuration object from the XML encoded representation in s. * This function use the "Legacy" style XML of the 1.x .kra file format. */ virtual void fromXML(const QDomElement&); /** * Create a serialized version of this properties config * This function use the "Legacy" style XML of the 1.x .kra file format. */ virtual void toXML(QDomDocument&, QDomElement&) const; /** * Create a serialized version of this properties config * This function use the "Legacy" style XML of the 1.x .kra file format. */ virtual QString toXML() const; /** * @return true if the map contains a property with the specified name */ bool hasProperty(const QString& name) const; /** * Set the property with name to value. */ virtual void setProperty(const QString & name, const QVariant & value); /** * Set value to the value associated with property name * * XXX: API alert: a setter that is prefixed with get? * * @return false if the specified property did not exist. */ virtual bool getProperty(const QString & name, QVariant & value) const; virtual QVariant getProperty(const QString & name) const; template T getPropertyLazy(const QString & name, const T &defaultValue) const { QVariant value = getProperty(name); return value.isValid() ? value.value() : defaultValue; } int getInt(const QString & name, int def = 0) const; double getDouble(const QString & name, double def = 0.0) const; float getFloat(const QString& name, float def = 0.0) const; bool getBool(const QString & name, bool def = false) const; QString getString(const QString & name, const QString & def = QString()) const; KisCubicCurve getCubicCurve(const QString & name, const KisCubicCurve & curve = KisCubicCurve()) const; KoColor getColor(const QString& name, const KoColor& color = KoColor()) const; QMap getProperties() const; /// Clear the map of properties void clearProperties(); ///Marks a property that should not be saved by toXML void setPropertyNotSaved(const QString & name); void removeProperty(const QString & name); public: void dump() const; private: struct Private; Private* const d; }; class KRITAIMAGE_EXPORT KisPropertiesConfigurationFactory : public KisSerializableConfigurationFactory { public: KisPropertiesConfigurationFactory(); virtual ~KisPropertiesConfigurationFactory(); virtual KisSerializableConfiguration* createDefault(); virtual KisSerializableConfiguration* create(const QDomElement& e); private: struct Private; Private* const d; }; #endif diff --git a/krita/image/kis_psd_layer_style.h b/krita/image/kis_psd_layer_style.h index 07215df3dca..7110f8b50bb 100644 --- a/krita/image/kis_psd_layer_style.h +++ b/krita/image/kis_psd_layer_style.h @@ -1,98 +1,98 @@ /* * Copyright (c) 2014 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_PSD_LAYER_STYLE_H #define KIS_PSD_LAYER_STYLE_H class QIODevice; struct QUuid; #include #include #include "kis_types.h" -#include "krita_export.h" +#include "kritaimage_export.h" /** * @brief The KisPSDLayerStyle class implements loading, saving and applying * the PSD layer effects. * * See http://www.tonton-pixel.com/Photoshop%20Additional%20File%20Formats/styles-file-format.html * */ class KRITAIMAGE_EXPORT KisPSDLayerStyle { public: explicit KisPSDLayerStyle(); virtual ~KisPSDLayerStyle(); KisPSDLayerStyle(const KisPSDLayerStyle& rhs); KisPSDLayerStyle operator=(const KisPSDLayerStyle& rhs); KisPSDLayerStyleSP clone() const; void clear(); QString name() const; void setName(const QString &value); QUuid uuid() const; void setUuid(const QUuid &value) const; QString psdUuid() const; void setPsdUuid(const QString &value) const; /** * \return true if all the styles are disabled */ bool isEmpty() const; bool isEnabled() const; void setEnabled(bool value); const psd_layer_effects_context* context() const; const psd_layer_effects_drop_shadow* dropShadow() const; const psd_layer_effects_inner_shadow* innerShadow() const; const psd_layer_effects_outer_glow* outerGlow() const; const psd_layer_effects_inner_glow* innerGlow() const; const psd_layer_effects_satin* satin() const; const psd_layer_effects_color_overlay* colorOverlay() const; const psd_layer_effects_gradient_overlay* gradientOverlay() const; const psd_layer_effects_pattern_overlay* patternOverlay() const; const psd_layer_effects_stroke* stroke() const; const psd_layer_effects_bevel_emboss* bevelAndEmboss() const; psd_layer_effects_context* context(); psd_layer_effects_drop_shadow* dropShadow(); psd_layer_effects_inner_shadow* innerShadow(); psd_layer_effects_outer_glow* outerGlow(); psd_layer_effects_inner_glow* innerGlow(); psd_layer_effects_satin* satin(); psd_layer_effects_color_overlay* colorOverlay(); psd_layer_effects_gradient_overlay* gradientOverlay(); psd_layer_effects_pattern_overlay* patternOverlay(); psd_layer_effects_stroke* stroke(); psd_layer_effects_bevel_emboss* bevelAndEmboss(); private: struct Private; Private * const d; }; #endif // KIS_PSD_LAYER_STYLE_H diff --git a/krita/image/kis_queues_progress_updater.h b/krita/image/kis_queues_progress_updater.h index 17e060f541a..953207648f2 100644 --- a/krita/image/kis_queues_progress_updater.h +++ b/krita/image/kis_queues_progress_updater.h @@ -1,47 +1,47 @@ /* * Copyright (c) 2011 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_QUEUES_PROGRESS_UPDATER_H #define __KIS_QUEUES_PROGRESS_UPDATER_H #include -#include "krita_export.h" +#include "kritaimage_export.h" class KoProgressProxy; class KRITAIMAGE_EXPORT KisQueuesProgressUpdater : public QObject { Q_OBJECT public: KisQueuesProgressUpdater(KoProgressProxy *progressProxy); ~KisQueuesProgressUpdater(); void updateProgress(int queueSizeMetric, const QString &jobName); void hide(); private Q_SLOTS: void updateProxy(); private: struct Private; Private * const m_d; }; #endif /* __KIS_QUEUES_PROGRESS_UPDATER_H */ diff --git a/krita/image/kis_random_generator.h b/krita/image/kis_random_generator.h index 7bfb27b2d0f..08b2b2d12bd 100644 --- a/krita/image/kis_random_generator.h +++ b/krita/image/kis_random_generator.h @@ -1,58 +1,58 @@ /* * This file is part of the KDE project * * Copyright (c) 2008 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_RANDOM_GENERATOR_H_ #define _KIS_RANDOM_GENERATOR_H_ -#include +#include #include /** * This is a class that return a pseudo-random number that will be constant for a given * pixel coordinate. * The rational is that filters that use random number (such as noises, or raindrops) * needs to always get the same random value at each run, or else the result will constantly * changes when used as an adjustement layer. */ class KRITAIMAGE_EXPORT KisRandomGenerator { public: /** * Creates a new instance of a random generator with the given seed. */ KisRandomGenerator(quint64 seed); ~KisRandomGenerator(); /** * @return the constant random value corresponding to a given pixel, the value is between 0 * and RAND_MAX */ quint64 randomAt(qint64 x, qint64 y); /** * @return the constant random value correspoding to a given pixel, the value is between 0 * and 1.0 */ double doubleRandomAt(qint64 x, qint64 y); private: struct Private; Private* const d; }; #endif diff --git a/krita/image/kis_random_sub_accessor.h b/krita/image/kis_random_sub_accessor.h index 6b664e3a287..2b3cca8c632 100644 --- a/krita/image/kis_random_sub_accessor.h +++ b/krita/image/kis_random_sub_accessor.h @@ -1,62 +1,62 @@ /* * This file is part of the KDE project * * Copyright (c) 2006 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_RANDOM_SUB_ACCESSOR_H #define KIS_RANDOM_SUB_ACCESSOR_H #include "kis_random_accessor_ng.h" #include "kis_types.h" -#include +#include #include "kis_shared.h" /** * Gives a random access to the sampled subpixels of an image. Use the * moveTo function to select the pixel. And then rawData to access the * value of a pixel. */ class KRITAIMAGE_EXPORT KisRandomSubAccessor : public KisShared { public: KisRandomSubAccessor(KisPaintDeviceSP device); ~KisRandomSubAccessor(); /** * Copy the sampled old value to destination */ void sampledOldRawData(quint8* dst); /** * Copy the sampled value to destination */ void sampledRawData(quint8* dst); inline void moveTo(double x, double y) { m_currentPoint.setX(x); m_currentPoint.setY(y); } inline void moveTo(const QPointF& p) { m_currentPoint = p; } private: KisPaintDeviceSP m_device; QPointF m_currentPoint; KisRandomConstAccessorSP m_randomAccessor; }; #endif diff --git a/krita/image/kis_rect_mask_generator.h b/krita/image/kis_rect_mask_generator.h index ac483c8c93d..f1d027a9b49 100644 --- a/krita/image/kis_rect_mask_generator.h +++ b/krita/image/kis_rect_mask_generator.h @@ -1,48 +1,48 @@ /* * Copyright (c) 2008-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_RECT_MASK_GENERATOR_H_ #define _KIS_RECT_MASK_GENERATOR_H_ -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_mask_generator.h" /** * Represent, serialize and deserialize a rectangular 8-bit mask. */ class KRITAIMAGE_EXPORT KisRectangleMaskGenerator : public KisMaskGenerator { public: KisRectangleMaskGenerator(qreal radius, qreal ratio, qreal fh, qreal fv, int spikes, bool antialiasEdges); virtual ~KisRectangleMaskGenerator(); virtual bool shouldSupersample() const; virtual quint8 valueAt(qreal x, qreal y) const; void setScale(qreal scaleX, qreal scaleY); void setSoftness(qreal softness); private: struct Private; Private* const d; }; #endif diff --git a/krita/image/kis_runnable.h b/krita/image/kis_runnable.h index 291cc8aa840..8d87b051785 100644 --- a/krita/image/kis_runnable.h +++ b/krita/image/kis_runnable.h @@ -1,31 +1,31 @@ /* * 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_RUNNABLE_H #define __KIS_RUNNABLE_H -#include "krita_export.h" +#include "kritaimage_export.h" class KRITAIMAGE_EXPORT KisRunnable { public: virtual ~KisRunnable() {}; virtual void run() = 0; }; #endif /* __KIS_RUNNABLE_H */ diff --git a/krita/image/kis_safe_transform.h b/krita/image/kis_safe_transform.h index b958c67b5a9..fda50bddeac 100644 --- a/krita/image/kis_safe_transform.h +++ b/krita/image/kis_safe_transform.h @@ -1,58 +1,58 @@ /* * Copyright (c) 2014 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_SAFE_TRANSFORM_H #define __KIS_SAFE_TRANSFORM_H #include -#include "krita_export.h" +#include "kritaimage_export.h" class QTransform; class QRect; class QRectF; class QPolygonF; class KRITAIMAGE_EXPORT KisSafeTransform { public: KisSafeTransform(const QTransform &transform, const QRect &bounds, const QRect &srcInterestRect); ~KisSafeTransform(); QPolygonF srcClipPolygon() const; QPolygonF dstClipPolygon() const; QPolygonF mapForward(const QPolygonF &p); QPolygonF mapBackward(const QPolygonF &p); QRectF mapRectForward(const QRectF &rc); QRectF mapRectBackward(const QRectF &rc); QRect mapRectForward(const QRect &rc); QRect mapRectBackward(const QRect &rc); private: struct Private; const QScopedPointer m_d; }; #endif /* __KIS_SAFE_TRANSFORM_H */ diff --git a/krita/image/kis_selection.h b/krita/image/kis_selection.h index b2679d81606..fd0656481e2 100644 --- a/krita/image/kis_selection.h +++ b/krita/image/kis_selection.h @@ -1,217 +1,217 @@ /* * Copyright (c) 2004 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_SELECTION_H_ #define KIS_SELECTION_H_ #include #include "kis_types.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_paint_device.h" enum SelectionMode { PIXEL_SELECTION, SHAPE_PROTECTION }; enum SelectionAction { SELECTION_REPLACE, SELECTION_ADD, SELECTION_SUBTRACT, SELECTION_INTERSECT, SELECTION_DEFAULT }; #include "kis_pixel_selection.h" class KisSelectionComponent; /** * KisSelection is a composite object. It may contain an instance * of KisPixelSelection and a KisShapeSelection object. Both these * selections are merged into a projection of the KisSelection. * * Every pixel in the paint device can indicate a degree of selectedness, varying * between MIN_SELECTED and MAX_SELECTED. * * The projection() paint device itself is only a projection: you can * read from it, but not write to it. You need to keep track of * the need for updating the projection yourself: there is no * automatic updating after changing the contents of one or more * of the selection components. */ class KRITAIMAGE_EXPORT KisSelection : public KisShared { public: /** * Create a new KisSelection. * * @param defaultBounds defines the bounds of the selection when * Select All is initiated. */ KisSelection(KisDefaultBoundsBaseSP defaultBounds = 0); /** * Copy the selection. The selection components are copied, too. */ KisSelection(const KisSelection& rhs); KisSelection& operator=(const KisSelection &rhs); /** * Delete the selection. The shape selection component is deleted, the * pixel selection component is contained in a shared pointer, so that * may still be valid. */ virtual ~KisSelection(); /** * The paint device of the pixel selection should report * about it's setDirty events to its parent. The creator * should set the parent manually if it wants to get the * signals */ void setParentNode(KisNodeWSP node); bool hasPixelSelection() const; bool hasShapeSelection() const; bool outlineCacheValid() const; QPainterPath outlineCache() const; void recalculateOutlineCache(); /** * Tells whether the cached thumbnail of the selection is still valid */ bool thumbnailImageValid() const; /** * Recalculates the thumbnail of the selection */ void recalculateThumbnailImage(const QColor &maskColor); /** * Returns the thumbnail of the selection. */ QImage thumbnailImage() const; /** * Returns the transformation which should be applied to the thumbnail before * being painted over the image */ QTransform thumbnailImageTransform() const; /** * return the pixel selection component of this selection. Pixel * selection component is always present in the selection. In case * the user wants a vector selection, pixel selection will store * the pixelated version of it. * * NOTE: use pixelSelection() for changing the selection only. For * reading the selection and passing the data to bitBlt function use * projection(). Although projection() and pixelSelection() currently * point ot the same paint device, this behavior may change in the * future. */ KisPixelSelectionSP pixelSelection() const; /** * return the vector selection component of this selection or zero * if hasShapeSelection() returns false. */ KisSelectionComponent* shapeSelection() const; void setShapeSelection(KisSelectionComponent* shapeSelection); /** * Returns the projection of the selection. It may be the same * as pixel selection. You must read selection data from this * paint device only */ KisPixelSelectionSP projection() const; /** * Updates the projection of the selection. You should call this * method after the every change of the selection components. * There is no automatic updates framework present */ void updateProjection(const QRect& rect); void updateProjection(); void setVisible(bool visible); bool isVisible(); /** * Convenience functions. Just call the corresponding methods * of the underlying projection */ bool isTotallyUnselected(const QRect & r) const; QRect selectedRect() const; /** * @brief Slow, but exact way of determining the rectangle * that encloses the selection. * * Default pixel of the selection device may vary and you would get wrong bounds. * selectedExactRect() handles all these cases. * */ QRect selectedExactRect() const; void setX(qint32 x); void setY(qint32 y); qint32 x() const; qint32 y() const; void setDefaultBounds(KisDefaultBoundsBaseSP bounds); void clear(); /** * @brief flatten creates a new pixel selection component from the shape selection * and throws away the shape selection. This has no effect if there is no * shape selection. */ KUndo2Command* flatten(); void notifySelectionChanged(); /// XXX: This method was marked KDE_DEPRECATED but without information on what to /// replace it with. Undeprecate, therefore. quint8 selected(qint32 x, qint32 y) const; private: friend class KisSelectionTest; friend class KisMaskTest; friend class KisAdjustmentLayerTest; KisNodeWSP parentNode() const; void copyFrom(const KisSelection &rhs); private: struct Private; Private * const m_d; }; #endif // KIS_SELECTION_H_ diff --git a/krita/image/kis_selection_based_layer.h b/krita/image/kis_selection_based_layer.h index 43d2979cc9a..42cb6bb2f12 100644 --- a/krita/image/kis_selection_based_layer.h +++ b/krita/image/kis_selection_based_layer.h @@ -1,208 +1,208 @@ /* * Copyright (c) 2006 Boudewijn Rempt * (c) 2009 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_SELECTION_BASED_LAYER_H_ #define KIS_SELECTION_BASED_LAYER_H_ #include #include "kis_types.h" #include "kis_layer.h" #include "kis_indirect_painting_support.h" -#include +#include #include "kis_node_filter_interface.h" class KisFilterConfiguration; /** * @class KisSelectionBasedLayer describes base behaviour for * selection base classes like KisAdjustmentLayer and KisGeneratorLayer. * These classes should have a persistent selection that controls * the area where filter/generators are applied. The area outside * this selection is not affected by the layer */ class KRITAIMAGE_EXPORT KisSelectionBasedLayer : public KisLayer, public KisIndirectPaintingSupport, public KisNodeFilterInterface { Q_OBJECT public: /** * creates a new layer with the given selection. * Note that the selection will be _copied_ (with COW, though). * @param image the image to set this layer to * @param name name of the layer * @param selection is a mask used by the layer to know * where to apply the filter/generator. */ KisSelectionBasedLayer(KisImageWSP image, const QString &name, KisSelectionSP selection, KisFilterConfiguration *filterConfig, bool useGeneratorRegistry = false); KisSelectionBasedLayer(const KisSelectionBasedLayer& rhs); virtual ~KisSelectionBasedLayer(); /** * tells whether the @node can be a child of this layer * @param node to be connected node * @return tells if to be connected is a child of KisMask */ bool allowAsChild(KisNodeSP node) const; void setImage(KisImageWSP image); KisPaintDeviceSP original() const; KisPaintDeviceSP paintDevice() const; bool needProjection() const; /** * resets cached projection of lower layer to a new device * @return void */ void resetCache(const KoColorSpace *colorSpace = 0); /** * for KisLayer::setDirty(const QRegion&) */ using KisLayer::setDirty; /** * Mark a layer as dirty. We can't use KisLayer's one * as our extent() function doesn't fit for this */ void setDirty(); void setDirty(const QRect & rect); public: /** * Returns the selection of the layer * * Do not mix it with selection() which returns * the currently active selection of the image */ KisSelectionSP internalSelection() const; /** * sets the selection of this layer to a copy of * selection * @param selection the selection to set * @return void */ void setInternalSelection(KisSelectionSP selection); /** * When painted in indirect painting mode, the internal selection * might not contain actual selection, because a part of it is * stored on an indirect painting device. This method returns the * merged copy of the real selection. The area in \p rect only is * guaranteed to be prepared. The content of the rest of the * selection is undefined. */ KisSelectionSP fetchComposedInternalSelection(const QRect &rect) const; /** * gets this layer's x coordinate, taking selection into account * @return x-coordinate value */ qint32 x() const; /** * gets this layer's y coordinate, taking selection into account * @return y-coordinate value */ qint32 y() const; /** * sets this layer's y coordinate, taking selection into account * @param x x coordinate */ void setX(qint32 x); /** * sets this layer's y coordinate, taking selection into account * @param y y coordinate */ void setY(qint32 y); public: /** * gets an approximation of where the bounds on actual data * are in this layer, taking selection into account */ QRect extent() const; /** * returns the exact bounds of where the actual data resides * in this layer, taking selection into account */ QRect exactBounds() const; /** * copies the image and reformats it to thumbnail size * and returns the new thumbnail image. * @param w width of the thumbnail to create * @param h height of the thumbnail to create * @return the thumbnail image created. */ QImage createThumbnail(qint32 w, qint32 h); protected: // override from KisLayer void copyOriginalToProjection(const KisPaintDeviceSP original, KisPaintDeviceSP projection, const QRect& rect) const; // override from KisNode QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const; protected: void initSelection(); QRect cropChangeRectBySelection(const QRect &rect) const; /** * Sets if the selection should be used in * copyOriginalToProjection() method. * * Default value is 'true'. The descendants should override it to * get desired behaviour. * * Must be called only once in the child's constructor */ void setUseSelectionInProjection(bool value) const; public Q_SLOTS: /** * gets this layer. Overriddes function in * KisIndirectPaintingSupport * @return this AdjustmentLayer */ KisLayer* layer() { return this; } private: struct Private; Private * const m_d; }; #endif /* KIS_SELECTION_BASED_LAYER_H_ */ diff --git a/krita/image/kis_selection_component.h b/krita/image/kis_selection_component.h index a5b26cf14a3..d0fbc9e5569 100644 --- a/krita/image/kis_selection_component.h +++ b/krita/image/kis_selection_component.h @@ -1,58 +1,58 @@ /* * Copyright (c) 2007 Sven Langkamp * * 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_SELECTION_COMPONENT_H #define KIS_SELECTION_COMPONENT_H -#include +#include #include class QRect; class KUndo2Command; class KisSelection; #include "kis_types.h" class KRITAIMAGE_EXPORT KisSelectionComponent { public: KisSelectionComponent() {} virtual ~KisSelectionComponent() {} virtual KisSelectionComponent* clone(KisSelection* selection) = 0; virtual void renderToProjection(KisPaintDeviceSP projection) = 0; virtual void renderToProjection(KisPaintDeviceSP projection, const QRect& r) = 0; virtual void moveX(qint32 x) { Q_UNUSED(x); } virtual void moveY(qint32 y) { Q_UNUSED(y); } virtual KUndo2Command* transform(const QTransform &transform) { Q_UNUSED(transform); return 0; } virtual bool isEmpty() const = 0; virtual QPainterPath outlineCache() const = 0; virtual bool outlineCacheValid() const = 0; virtual void recalculateOutlineCache() = 0; virtual KUndo2Command* resetToEmpty() { return 0; } }; #endif diff --git a/krita/image/kis_selection_filters.h b/krita/image/kis_selection_filters.h index 796db921a3c..1f39fa776bc 100644 --- a/krita/image/kis_selection_filters.h +++ b/krita/image/kis_selection_filters.h @@ -1,154 +1,154 @@ /* * Copyright (c) 2005 Michael Thaler * Copyright (c) 2011 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_SELECTION_FILTERS_H #define KIS_SELECTION_FILTERS_H #include "kis_types.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include #include class KUndo2MagicString; class KRITAIMAGE_EXPORT KisSelectionFilter { public: virtual ~KisSelectionFilter(); virtual void process(KisPixelSelectionSP pixelSelection, const QRect &rect) = 0; virtual KUndo2MagicString name(); virtual QRect changeRect(const QRect &rect); protected: void computeBorder(qint32 *circ, qint32 xradius, qint32 yradius); void rotatePointers(quint8 **p, quint32 n); void computeTransition(quint8* transition, quint8** buf, qint32 width); }; class KRITAIMAGE_EXPORT KisErodeSelectionFilter : public KisSelectionFilter { public: KUndo2MagicString name(); QRect changeRect(const QRect &rect); void process(KisPixelSelectionSP pixelSelection, const QRect &rect); }; class KRITAIMAGE_EXPORT KisDilateSelectionFilter : public KisSelectionFilter { public: KUndo2MagicString name(); QRect changeRect(const QRect &rect); void process(KisPixelSelectionSP pixelSelection, const QRect &rect); }; class KRITAIMAGE_EXPORT KisBorderSelectionFilter : public KisSelectionFilter { public: KisBorderSelectionFilter(qint32 xRadius, qint32 yRadius); KUndo2MagicString name(); QRect changeRect(const QRect &rect); void process(KisPixelSelectionSP pixelSelection, const QRect &rect); private: qint32 m_xRadius; qint32 m_yRadius; }; class KRITAIMAGE_EXPORT KisFeatherSelectionFilter : public KisSelectionFilter { public: KisFeatherSelectionFilter(qint32 radius); KUndo2MagicString name(); QRect changeRect(const QRect &rect); void process(KisPixelSelectionSP pixelSelection, const QRect &rect); private: qint32 m_radius; }; class KRITAIMAGE_EXPORT KisGrowSelectionFilter : public KisSelectionFilter { public: KisGrowSelectionFilter(qint32 xRadius, qint32 yRadius); KUndo2MagicString name(); QRect changeRect(const QRect &rect); void process(KisPixelSelectionSP pixelSelection, const QRect &rect); private: qint32 m_xRadius; qint32 m_yRadius; }; class KRITAIMAGE_EXPORT KisShrinkSelectionFilter : public KisSelectionFilter { public: KisShrinkSelectionFilter(qint32 xRadius, qint32 yRadius, bool edgeLock); KUndo2MagicString name(); QRect changeRect(const QRect &rect); void process(KisPixelSelectionSP pixelSelection, const QRect &rect); private: qint32 m_xRadius; qint32 m_yRadius; qint32 m_edgeLock; }; class KRITAIMAGE_EXPORT KisSmoothSelectionFilter : public KisSelectionFilter { public: KUndo2MagicString name(); QRect changeRect(const QRect &rect); void process(KisPixelSelectionSP pixelSelection, const QRect &rect); }; class KRITAIMAGE_EXPORT KisInvertSelectionFilter : public KisSelectionFilter { KUndo2MagicString name(); QRect changeRect(const QRect &rect); void process(KisPixelSelectionSP pixelSelection, const QRect &rect); }; #endif // KIS_SELECTION_FILTERS_H diff --git a/krita/image/kis_serializable_configuration.h b/krita/image/kis_serializable_configuration.h index 8decbd28573..dec4d5a97cd 100644 --- a/krita/image/kis_serializable_configuration.h +++ b/krita/image/kis_serializable_configuration.h @@ -1,76 +1,77 @@ /* * 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_SERIALIZABLE_CONFIGURATION_H_ #define _KIS_SERIALIZABLE_CONFIGURATION_H_ class QDomElement; class QDomDocument; +class QString; -#include "krita_export.h" +#include "kritaimage_export.h" /** * This is an interface for objects that are serializable and unserializable. * It can be used together with the factory in case the type of configuration object * is also unknown at creation time. */ class KRITAIMAGE_EXPORT KisSerializableConfiguration { public: virtual ~KisSerializableConfiguration() {}; /** * Fill the object from the XML encoded representation in s. */ virtual void fromXML(const QString&); /** * Fill the object from the XML encoded representation in s. */ virtual void fromXML(const QDomElement&) = 0; /** * Create a serialized version of this object */ virtual void toXML(QDomDocument&, QDomElement&) const = 0; /** * Create a serialized version of this object */ virtual QString toXML() const; }; /** * This is an interface for a factory of serializable configuration objects. */ class KRITAIMAGE_EXPORT KisSerializableConfigurationFactory { public: virtual ~KisSerializableConfigurationFactory(); /** * @return an empty object with a sane default configuration */ virtual KisSerializableConfiguration* createDefault() = 0; /** * @return an unserialied version of the configuration */ virtual KisSerializableConfiguration* create(const QDomElement&) = 0; }; #endif diff --git a/krita/image/kis_shared.h b/krita/image/kis_shared.h index 6d87c3f83e6..59f6d95603f 100644 --- a/krita/image/kis_shared.h +++ b/krita/image/kis_shared.h @@ -1,60 +1,60 @@ /* * Copyright (c) 2006 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_SHARED_H_ #define _KIS_SHARED_H_ #include -#include +#include class KRITAIMAGE_EXPORT KisShared { private: KisShared(const KisShared& ); KisShared& operator=(const KisShared& ); protected: KisShared(); ~KisShared(); public: int refCount() { return _ref; } bool ref() { return _ref.ref(); } bool deref() { Q_ASSERT(_ref > 0); return _ref.deref(); } // see note in kis_shared.cc QAtomicInt* sharedWeakReference() { if(!_sharedWeakReference) { _sharedWeakReference = new QAtomicInt(); _sharedWeakReference->ref(); } return _sharedWeakReference; } private: QAtomicInt _ref; QAtomicInt *_sharedWeakReference; }; #endif diff --git a/krita/image/kis_signal_compressor.h b/krita/image/kis_signal_compressor.h index 5f1798b1a7b..e66b5c37e09 100644 --- a/krita/image/kis_signal_compressor.h +++ b/krita/image/kis_signal_compressor.h @@ -1,59 +1,59 @@ /* * 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_SIGNAL_COMPRESSOR_H #define __KIS_SIGNAL_COMPRESSOR_H #include -#include "krita_export.h" +#include "kritaimage_export.h" class QTimer; class KRITAIMAGE_EXPORT KisSignalCompressor : public QObject { Q_OBJECT public: enum Mode { POSTPONE, /* every start() porspones event by \p delay ms */ FIRST_ACTIVE, /* fist call to start() emits a signal, the latter will happen not earlier after \p delay ms */ FIRST_INACTIVE /* the first signal will be emitted not earlier that after \p delay ms after the first call to start() */ }; public: KisSignalCompressor(int delay, Mode mode, QObject *parent = 0); bool isActive() const; void setDelay(int delay); public Q_SLOTS: void start(); void stop(); private Q_SLOTS: void slotTimerExpired(); Q_SIGNALS: void timeout(); private: QTimer *m_timer; Mode m_mode; bool m_gotSignals; }; #endif /* __KIS_SIGNAL_COMPRESSOR_H */ diff --git a/krita/image/kis_stroke.h b/krita/image/kis_stroke.h index 9880f6e483e..6b7ad6c3b7a 100644 --- a/krita/image/kis_stroke.h +++ b/krita/image/kis_stroke.h @@ -1,87 +1,87 @@ /* * Copyright (c) 2011 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_STROKE_H #define __KIS_STROKE_H #include #include -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_stroke_job.h" class KisStrokeStrategy; class KUndo2MagicString; class KRITAIMAGE_EXPORT KisStroke { public: KisStroke(KisStrokeStrategy *strokeStrategy); ~KisStroke(); void addJob(KisStrokeJobData *data); KUndo2MagicString name() const; bool hasJobs() const; qint32 numJobs() const; KisStrokeJob* popOneJob(); void endStroke(); void cancelStroke(); bool isInitialized() const; bool isEnded() const; bool isExclusive() const; bool supportsWrapAroundMode() const; bool prevJobSequential() const; bool nextJobSequential() const; bool nextJobBarrier() const; private: void enqueue(KisStrokeJobStrategy *strategy, KisStrokeJobData *data); KisStrokeJob* dequeue(); void clearQueue(); private: // for testing use only, do not use in real code friend class KisStrokeTest; friend class KisStrokeStrategyUndoCommandBasedTest; QQueue& testingGetQueue() { return m_jobsQueue; } private: // the strategies are owned by the stroke KisStrokeStrategy *m_strokeStrategy; KisStrokeJobStrategy *m_initStrategy; KisStrokeJobStrategy *m_dabStrategy; KisStrokeJobStrategy *m_cancelStrategy; KisStrokeJobStrategy *m_finishStrategy; QQueue m_jobsQueue; bool m_strokeInitialized; bool m_strokeEnded; bool m_isCancelled; // cancelled strokes are always 'ended' as well bool m_prevJobSequential; }; #endif /* __KIS_STROKE_H */ diff --git a/krita/image/kis_stroke_job_strategy.h b/krita/image/kis_stroke_job_strategy.h index 64d1debd2cd..f66f6266195 100644 --- a/krita/image/kis_stroke_job_strategy.h +++ b/krita/image/kis_stroke_job_strategy.h @@ -1,69 +1,69 @@ /* * Copyright (c) 2011 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_STROKE_JOB_STRATEGY_H #define __KIS_STROKE_JOB_STRATEGY_H -#include "krita_export.h" +#include "kritaimage_export.h" class KRITAIMAGE_EXPORT KisStrokeJobData { public: enum Sequentiality { CONCURRENT, SEQUENTIAL, BARRIER }; enum Exclusivity { NORMAL, EXCLUSIVE }; public: KisStrokeJobData(Sequentiality sequentiality = SEQUENTIAL, Exclusivity exclusivity = NORMAL); virtual ~KisStrokeJobData(); bool isBarrier() const; bool isSequential() const; bool isExclusive() const; Sequentiality sequentiality() { return m_sequentiality; }; Exclusivity exclusivity() { return m_exclusivity; }; private: Sequentiality m_sequentiality; Exclusivity m_exclusivity; }; class KRITAIMAGE_EXPORT KisStrokeJobStrategy { public: KisStrokeJobStrategy(); virtual ~KisStrokeJobStrategy(); virtual void run(KisStrokeJobData *data) = 0; private: }; #endif /* __KIS_STROKE_JOB_STRATEGY_H */ diff --git a/krita/image/kis_strokes_queue.h b/krita/image/kis_strokes_queue.h index 46c53ff8085..94e80d1a24d 100644 --- a/krita/image/kis_strokes_queue.h +++ b/krita/image/kis_strokes_queue.h @@ -1,66 +1,66 @@ /* * Copyright (c) 2011 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_STROKES_QUEUE_H #define __KIS_STROKES_QUEUE_H -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" #include "kis_stroke_job_strategy.h" #include "kis_stroke_strategy.h" class KisUpdaterContext; class KisStroke; class KRITAIMAGE_EXPORT KisStrokesQueue { public: KisStrokesQueue(); ~KisStrokesQueue(); KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy); void addJob(KisStrokeId id, KisStrokeJobData *data); void endStroke(KisStrokeId id); bool cancelStroke(KisStrokeId id); bool tryCancelCurrentStrokeAsync(); void processQueue(KisUpdaterContext &updaterContext, bool externalJobsPending); bool needsExclusiveAccess() const; bool isEmpty() const; qint32 sizeMetric() const; KUndo2MagicString currentStrokeName() const; bool hasOpenedStrokes() const; bool wrapAroundModeSupported() const; private: bool processOneJob(KisUpdaterContext &updaterContext, bool externalJobsPending); bool checkStrokeState(bool hasStrokeJobsRunning); bool checkExclusiveProperty(qint32 numMergeJobs, qint32 numStrokeJobs); bool checkSequentialProperty(qint32 numMergeJobs, qint32 numStrokeJobs); bool checkBarrierProperty(qint32 numMergeJobs, qint32 numStrokeJobs, bool externalJobsPending); private: struct Private; Private * const m_d; }; #endif /* __KIS_STROKES_QUEUE_H */ diff --git a/krita/image/kis_thread_safe_signal_compressor.h b/krita/image/kis_thread_safe_signal_compressor.h index 547c805eaa2..f2cc646ace0 100644 --- a/krita/image/kis_thread_safe_signal_compressor.h +++ b/krita/image/kis_thread_safe_signal_compressor.h @@ -1,56 +1,56 @@ /* * Copyright (c) 2014 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_THREAD_SAFE_SIGNAL_COMPRESSOR_H #define __KIS_THREAD_SAFE_SIGNAL_COMPRESSOR_H #include -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_signal_compressor.h" /** * A special class which works exactly like KisSignalCompressor, but * supports calling \p start() method from within the context of * another thread. If it happens, it posts a message to Qt's event * loop and the \p start() signal is delivered when event loop gets * executes again. * * WARNING: After creation this object moves itself into the main * thread, so one must *not* delete it explicitly. Use * deleteLater() instead. Moving into another thread is * another reason why it cannot have parent QObject. */ class KRITAIMAGE_EXPORT KisThreadSafeSignalCompressor : public QObject { Q_OBJECT public: KisThreadSafeSignalCompressor(int delay, KisSignalCompressor::Mode mode); public Q_SLOTS: void start(); Q_SIGNALS: void timeout(); void internalRequestSignal(); private: KisSignalCompressor *m_compressor; }; #endif /* __KIS_THREAD_SAFE_SIGNAL_COMPRESSOR_H */ diff --git a/krita/image/kis_transaction.h b/krita/image/kis_transaction.h index 118929eec66..cefeb81c8f9 100644 --- a/krita/image/kis_transaction.h +++ b/krita/image/kis_transaction.h @@ -1,138 +1,137 @@ /* * Copyright (c) 2010 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_TRANSACTION_H_ #define KIS_TRANSACTION_H_ #include #include "kis_types.h" -#include #include "kis_transaction_data.h" #include "kis_paint_device.h" #include "kis_pixel_selection.h" #include "kis_undo_adapter.h" #include "kis_post_execution_undo_adapter.h" class KisTransaction { public: KisTransaction(KisPaintDeviceSP device, KUndo2Command* parent = 0,int timedID = -1) { m_transactionData = new KisTransactionData(KUndo2MagicString(), device, true, parent); m_transactionData->setTimedID(timedID); } KisTransaction(const KUndo2MagicString& name, KisPaintDeviceSP device, KUndo2Command* parent = 0,int timedID = -1) { m_transactionData = new KisTransactionData(name, device, true, parent); m_transactionData->setTimedID(timedID); } virtual ~KisTransaction() { delete m_transactionData; } KUndo2Command* undoCommand() { return m_transactionData; } void commit(KisUndoAdapter* undoAdapter) { Q_ASSERT_X(m_transactionData, "KisTransaction::commit()", "the transaction has been tried to be committed twice"); m_transactionData->endTransaction(); undoAdapter->addCommand(m_transactionData); m_transactionData = 0; } void commit(KisPostExecutionUndoAdapter* undoAdapter) { Q_ASSERT_X(m_transactionData, "KisTransaction::commit()", "the transaction has been tried to be committed twice"); m_transactionData->endTransaction(); m_transactionData->redo(); undoAdapter->addCommand(KUndo2CommandSP(m_transactionData)); m_transactionData = 0; } KUndo2Command* endAndTake() { Q_ASSERT_X(m_transactionData, "KisTransaction::endAndTake()", "the transaction has been tried to be committed twice"); KisTransactionData *transactionData = m_transactionData; m_transactionData = 0; transactionData->endTransaction(); return transactionData; } void end() { Q_ASSERT_X(m_transactionData, "KisTransaction::end()", "nothing to end!"); /** * We will not call endTransaction for m_transactionData, * we'll just kill it, and it'll report about it's death to * the memento manager, so no commit will be made */ delete m_transactionData; m_transactionData = 0; } void revert() { Q_ASSERT_X(m_transactionData, "KisTransaction::reverted()", "the transaction is tried to be reverted()" "after it has already been added to undo adapter"); m_transactionData->endTransaction(); /** * FIXME: Should we emulate first redo() here? */ m_transactionData->undo(); delete m_transactionData; m_transactionData = 0; } KUndo2MagicString text() const { Q_ASSERT_X(m_transactionData, "KisTransaction::text()", "the name has been requested after the transaction" "has already been ended"); return m_transactionData->text(); } protected: KisTransaction() : m_transactionData(0) {} KisTransactionData* m_transactionData; }; class KisSelectionTransaction : public KisTransaction { public: KisSelectionTransaction(KisPixelSelectionSP pixelSelection, KUndo2Command* parent = 0) { m_transactionData = new KisTransactionData(KUndo2MagicString(), pixelSelection, false, parent); } KisSelectionTransaction(const KUndo2MagicString& name, KisPixelSelectionSP pixelSelection, KUndo2Command* parent = 0) { m_transactionData = new KisTransactionData(name, pixelSelection, false, parent); } }; #endif /* KIS_TRANSACTION_H_ */ diff --git a/krita/image/kis_transaction_data.h b/krita/image/kis_transaction_data.h index c6b86e18533..bbc56d9ba95 100644 --- a/krita/image/kis_transaction_data.h +++ b/krita/image/kis_transaction_data.h @@ -1,64 +1,64 @@ /* * Copyright (c) 2002 Patrick Julien * * 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_TRANSACTION_DATA_H_ #define KIS_TRANSACTION_DATA_H_ #include #include "kis_types.h" -#include +#include /** * A tile based undo command. * * Ordinary KUndo2Command subclasses store parameters and apply the action in * the redo() command, however, Krita doesn't work like this. Undo replaces * the current tiles in a paint device with the old tiles, redo replaces them * again with the new tiles without actually executing the command that changed * the image data again. */ class KRITAIMAGE_EXPORT KisTransactionData : public KUndo2Command { public: KisTransactionData(const KUndo2MagicString& name, KisPaintDeviceSP device, bool resetSelectionOutlineCache, KUndo2Command* parent); virtual ~KisTransactionData(); public: virtual void redo(); virtual void undo(); virtual void endTransaction(); protected: virtual void saveSelectionOutlineCache(); virtual void restoreSelectionOutlineCache(bool undo); private: void init(KisPaintDeviceSP device); void startUpdates(); void possiblyNotifySelectionChanged(); void possiblyResetOutlineCache(); private: class Private; Private * const m_d; }; #endif /* KIS_TRANSACTION_DATA_H_ */ diff --git a/krita/image/kis_transform_mask_params_factory_registry.h b/krita/image/kis_transform_mask_params_factory_registry.h index 14cb8420dc2..27bbca1b7c9 100644 --- a/krita/image/kis_transform_mask_params_factory_registry.h +++ b/krita/image/kis_transform_mask_params_factory_registry.h @@ -1,53 +1,53 @@ /* * Copyright (c) 2014 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_TRANSFORM_MASK_PARAMS_FACTORY_REGISTRY_H #define __KIS_TRANSFORM_MASK_PARAMS_FACTORY_REGISTRY_H #include #include #include #include "kis_types.h" -#include "krita_export.h" +#include "kritaimage_export.h" class QDomElement; typedef boost::function KisTransformMaskParamsFactory; typedef QMap KisTransformMaskParamsFactoryMap; class KRITAIMAGE_EXPORT KisTransformMaskParamsFactoryRegistry { private: KisTransformMaskParamsFactoryRegistry(); ~KisTransformMaskParamsFactoryRegistry(); public: void addFactory(const QString &id, const KisTransformMaskParamsFactory &factory); KisTransformMaskParamsInterfaceSP createParams(const QString &id, const QDomElement &e); static KisTransformMaskParamsFactoryRegistry* instance(); private: KisTransformMaskParamsFactoryMap m_map; }; #endif /* __KIS_TRANSFORM_MASK_PARAMS_FACTORY_REGISTRY_H */ diff --git a/krita/image/kis_transform_mask_params_interface.h b/krita/image/kis_transform_mask_params_interface.h index 709b3b50df7..397aa6650f9 100644 --- a/krita/image/kis_transform_mask_params_interface.h +++ b/krita/image/kis_transform_mask_params_interface.h @@ -1,80 +1,80 @@ /* * Copyright (c) 2014 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_TRANSFORM_MASK_PARAMS_INTERFACE_H #define __KIS_TRANSFORM_MASK_PARAMS_INTERFACE_H -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" #include class QTransform; class QDomElement; class KRITAIMAGE_EXPORT KisTransformMaskParamsInterface { public: virtual ~KisTransformMaskParamsInterface(); virtual QTransform finalAffineTransform() const = 0; virtual bool isAffine() const = 0; virtual bool isHidden() const = 0; virtual void transformDevice(KisNodeSP node, KisPaintDeviceSP src, KisPaintDeviceSP dst) const = 0; virtual QString id() const = 0; virtual void toXML(QDomElement *e) const = 0; virtual void translate(const QPointF &offset) = 0; }; class QDomElement; class KRITAIMAGE_EXPORT KisDumbTransformMaskParams : public KisTransformMaskParamsInterface { public: KisDumbTransformMaskParams(); KisDumbTransformMaskParams(const QTransform &transform); KisDumbTransformMaskParams(bool isHidden); ~KisDumbTransformMaskParams(); QTransform finalAffineTransform() const; bool isAffine() const; bool isHidden() const; void transformDevice(KisNodeSP node, KisPaintDeviceSP src, KisPaintDeviceSP dst) const; QString id() const; void toXML(QDomElement *e) const; static KisTransformMaskParamsInterfaceSP fromXML(const QDomElement &e); void translate(const QPointF &offset); // for tesing purposes only QTransform testingGetTransform() const; void testingSetTransform(const QTransform &t); private: struct Private; const QScopedPointer m_d; }; #endif /* __KIS_TRANSFORM_MASK_PARAMS_INTERFACE_H */ diff --git a/krita/image/kis_transform_worker.h b/krita/image/kis_transform_worker.h index d02ed4f7785..5599b30da6f 100644 --- a/krita/image/kis_transform_worker.h +++ b/krita/image/kis_transform_worker.h @@ -1,160 +1,160 @@ /* * Copyright (c) 2004 Michael Thaler * Copyright (c) 2005 C. Boemann * Copyright (c) 2010 Marc Pegon * * 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_TRANSFORM_WORKER_H_ #define KIS_TRANSFORM_WORKER_H_ #include "kis_types.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include #include class KisPaintDevice; class KisFilterStrategy; class QTransform; class KRITAIMAGE_EXPORT KisTransformWorker { /* What are xshearOrigin, yshearOrigin : * * let's keep it simple and say we only have horizontal shearing (it's similar with vertical shearing) * that means we will apply the transformation : * x' = x + xshear * y and y' = y, where x,y are the old coordinates of the pixels, and x' y' the new coordinates * that means, the more we go down in the image (y++), the more x' is different from x * most of the times, we want to shear a part of the image centered at y = y0 != 0. * i.e. we want x' = x at y = y0 * in that case, it's good to apply instead x' = x + xshear * (y - yshearOrigin), y' = y. * please note that it's still possible to obtain the same result by copying the part you want to shear at * in another paintDevice at y = -y0 and use the transformWorker with yshearOrigin = 0. */ public: KisTransformWorker(KisPaintDeviceSP dev, double xscale, double yscale, double xshear, double yshear, double xshearOrigin, double yshearOrigin, double rotation, qint32 xtranslate, qint32 ytranslate, KoUpdaterPtr progress, KisFilterStrategy *filter); ~KisTransformWorker(); /** * Mirror the specified device along the X or Y axis at the * coordinate \p axis. */ static void mirror(KisPaintDeviceSP dev, qreal axis, Qt::Orientation orientation); /** * Convenience methods for mirror(dev, axis, orientation) */ static void mirrorX(KisPaintDeviceSP dev, qreal axis); static void mirrorY(KisPaintDeviceSP dev, qreal axis); /** * Mirror the device relative to the center of its exactBounds() */ static void mirrorX(KisPaintDeviceSP dev); static void mirrorY(KisPaintDeviceSP dev); /** * Offset the specified device with wraping around edges of rect specified as QRect(0,0,wrapSize.width, wrapSize.height)* * @param device device to be offset * @param offsetPosition position where the new origin will be * @param wrapSize width and height of the wrap edge, usual scenario is to use canvas width&height * **/ static void offset(KisPaintDeviceSP device, const QPoint &offsetPosition, const QRect &wrapRect); public: // returns false if interrupted bool run(); bool runPartial(const QRect &processRect); /** * Returns a matrix of the transformation executed by the worker. * Resulting transformation has the following form (in Qt's matrix * notation (all the matrices are trasposed)): * * transform = TS.inverted() * S * TS * SC * R * T * * ,where: * TS - shear origin transpose * S - shear itself (shearX * shearY) * SC - scale * R - rotation (@rotation parameter) * T - transpose (@xtranslate, @ytranslate) * * WARNING: due to some rounding problems in the worker * the work it does does not correspond to the matrix exactly! * The result always differs 1-3 pixel. So be careful with it * (or fix it) */ QTransform transform() const; /** * Transforms the outline of the pixel selection (if it is valid) */ void transformPixelSelectionOutline(KisPixelSelectionSP pixelSelection) const; private: // XXX (BSAR): Why didn't we use the shared-pointer versions of the paint device classes? // CBR: because the template functions used within don't work if it's not true pointers template void transformPass(KisPaintDevice* src, KisPaintDevice* dst, double xscale, double shear, double dx, KisFilterStrategy *filterStrategy, int portion); friend class KisTransformWorkerTest; static QRect rotateRight90(KisPaintDeviceSP dev, QRect boundRect, KoUpdaterPtr progressUpdater, int portion); static QRect rotateLeft90(KisPaintDeviceSP dev, QRect boundRect, KoUpdaterPtr progressUpdater, int portion); static QRect rotate180(KisPaintDeviceSP dev, QRect boundRect, KoUpdaterPtr progressUpdater, int portion); private: KisPaintDeviceSP m_dev; double m_xscale, m_yscale; double m_xshear, m_yshear, m_rotation; double m_xshearOrigin, m_yshearOrigin; qint32 m_xtranslate, m_ytranslate; KoUpdaterPtr m_progressUpdater; KisFilterStrategy *m_filter; QRect m_boundRect; }; #endif // KIS_TRANSFORM_VISITOR_H_ diff --git a/krita/image/kis_undo_adapter.h b/krita/image/kis_undo_adapter.h index 850c105256a..86f88d8bf68 100644 --- a/krita/image/kis_undo_adapter.h +++ b/krita/image/kis_undo_adapter.h @@ -1,65 +1,65 @@ /* * Copyright (c) 2003 Patrick Julien * * 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_UNDO_ADAPTER_H_ #define KIS_UNDO_ADAPTER_H_ #include -#include +#include #include "kis_types.h" #include "kis_undo_store.h" class KRITAIMAGE_EXPORT KisUndoAdapter : public QObject { Q_OBJECT public: KisUndoAdapter(KisUndoStore *undoStore); virtual ~KisUndoAdapter(); public: void emitSelectionChanged(); virtual const KUndo2Command* presentCommand() = 0; virtual void undoLastCommand() = 0; virtual void addCommand(KUndo2Command *cmd) = 0; virtual void beginMacro(const KUndo2MagicString& macroName) = 0; virtual void endMacro() = 0; inline void setUndoStore(KisUndoStore *undoStore) { m_undoStore = undoStore; } Q_SIGNALS: void selectionChanged(); protected: inline KisUndoStore* undoStore() { return m_undoStore; } private: Q_DISABLE_COPY(KisUndoAdapter) KisUndoStore *m_undoStore; }; #endif // KIS_UNDO_ADAPTER_H_ diff --git a/krita/image/kis_undo_store.h b/krita/image/kis_undo_store.h index af1b81bb085..ca8f2696454 100644 --- a/krita/image/kis_undo_store.h +++ b/krita/image/kis_undo_store.h @@ -1,82 +1,82 @@ /* * Copyright (c) 2003 Patrick Julien * * 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_UNDO_STORE_H_ #define KIS_UNDO_STORE_H_ #include #include -#include +#include #include "kis_types.h" class KUndo2Command; class KUndo2MagicString; /** * See also: http://community.kde.org/Krita/Undo_adapter_vs_Undo_store * * Split the functionality of KisUndoAdapter into two classes: * KisUndoStore and KisUndoAdapter. The former one works as an * interface to an external storage of the undo information: * undo stack, KisDocument, /dev/null. The latter one defines the * behavior of the system when someone wants to add a command. There * are three variants: * 1) KisSurrogateUndoAdapter -- saves commands directly to the * internal stack. Used for wrapping around legacy code into * a single command. * 2) KisLegacyUndoAdapter -- blocks the strokes and updates queue, * and then adds the command to a store * 3) KisPostExecutionUndoAdapter -- used by the strokes. It doesn't * call redo() when you add a command. It is assumed, that you have * already executed the command yourself and now just notify * the system about it. Warning: it doesn't inherit KisUndoAdapter * because it doesn't fit the contract of this class. And, more * important, KisTransaction should work differently with this class. * * The ownership on the KisUndoStore (that substituted KisUndoAdapter * in the document's code) now belongs to the image. It means that * KisDocument::createUndoStore() is just a factory method, the document * doesn't store the undo store itself. */ class KRITAIMAGE_EXPORT KisUndoStore { public: KisUndoStore(); virtual ~KisUndoStore(); public: /** * WARNING: All these methods are not considered as thread-safe */ virtual const KUndo2Command* presentCommand() = 0; virtual void undoLastCommand() = 0; virtual void addCommand(KUndo2Command *cmd) = 0; virtual void beginMacro(const KUndo2MagicString& macroName) = 0; virtual void endMacro() = 0; virtual void purgeRedoState() = 0; private: Q_DISABLE_COPY(KisUndoStore) }; #endif // KIS_UNDO_STORE_H_ diff --git a/krita/image/kis_update_scheduler.h b/krita/image/kis_update_scheduler.h index ab0f1f36954..6378ae9a94a 100644 --- a/krita/image/kis_update_scheduler.h +++ b/krita/image/kis_update_scheduler.h @@ -1,190 +1,190 @@ /* * Copyright (c) 2010 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_UPDATE_SCHEDULER_H #define __KIS_UPDATE_SCHEDULER_H #include -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" #include "kis_image_interfaces.h" class QRect; class KoProgressProxy; class KisProjectionUpdateListener; class KisSpontaneousJob; class KRITAIMAGE_EXPORT KisUpdateScheduler : public QObject, public KisStrokesFacade { Q_OBJECT public: KisUpdateScheduler(KisProjectionUpdateListener *projectionUpdateListener); virtual ~KisUpdateScheduler(); /** * Sets the proxy that is going to be notified about the progress * of processing of the queues. If you want to switch the proxy * on runtime, you should do it under the lock held. * * \see lock(), unlock() */ void setProgressProxy(KoProgressProxy *progressProxy); /** * Blocks processing of the queues. * The function will wait until all the executing jobs * are finished. * NOTE: you may add new jobs while the block held, but they * will be delayed until unlock() is called. * * \see unlock() */ void lock(); /** * Unblocks the process and calls processQueues() * * \see processQueues() */ void unlock(); /** * Called when it is necessary to reread configuration */ void updateSettings(); /** * Waits until all the running jobs are finished. * * If some other thread adds jobs in parallel, then you may * wait forever. If you you don't want it, consider lock() instead. * * \see lock() */ void waitForDone(); /** * Waits until the queues become empty, then blocks the processing. * To unblock processing you should use unlock(). * * If some other thread adds jobs in parallel, then you may * wait forever. If you you don't want it, consider lock() instead. * * \see unlock(), lock() */ void barrierLock(); /** * Works like barrier lock, but returns false immediately if barrierLock * can't be acquired. * * \see barrierLock() */ bool tryBarrierLock(); /** * Blocks all the updates from execution. It doesn't affect * strokes execution in any way. This tipe of lock is supposed * to be held by the strokes themselves when they need a short * access to some parts of the projection of the image. * From all the other places you should use usual lock()/unlock() * methods * * \see lock(), unlock() */ void blockUpdates(); /** * Unblocks updates from execution previously locked by blockUpdates() * * \see blockUpdates() */ void unblockUpdates(); void updateProjection(KisNodeSP node, const QRect& rc, const QRect &cropRect); void updateProjectionNoFilthy(KisNodeSP node, const QRect& rc, const QRect &cropRect); void fullRefreshAsync(KisNodeSP root, const QRect& rc, const QRect &cropRect); void fullRefresh(KisNodeSP root, const QRect& rc, const QRect &cropRect); void addSpontaneousJob(KisSpontaneousJob *spontaneousJob); KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy); void addJob(KisStrokeId id, KisStrokeJobData *data); void endStroke(KisStrokeId id); bool cancelStroke(KisStrokeId id); /** * tryCancelCurrentStrokeAsync() checks whether there is a * *running* stroke (which is being executed at this very moment) * which is not still open by the owner (endStroke() or * cancelStroke() have already been called) and cancels it. * * \return true if some stroke has been found and cancelled * * \note This method is *not* part of KisStrokesFacade! It is too * low level for KisImage. In KisImage it is combined with * more high level requestStrokeCancellation(). */ bool tryCancelCurrentStrokeAsync(); bool wrapAroundModeSupported() const; protected: // Trivial constructor for testing support KisUpdateScheduler(); void connectSignals(); void processQueues(); private Q_SLOTS: void continueUpdate(const QRect &rect); void doSomeUsefulWork(); void spareThreadAppeared(); private: friend class UpdatesBlockTester; bool haveUpdatesRunning(); void tryProcessUpdatesQueue(); void wakeUpWaitingThreads(); void progressUpdate(); protected: struct Private; Private * const m_d; }; class KisTestableUpdaterContext; class KisTestableSimpleUpdateQueue; class KRITAIMAGE_EXPORT KisTestableUpdateScheduler : public KisUpdateScheduler { public: KisTestableUpdateScheduler(KisProjectionUpdateListener *projectionUpdateListener, qint32 threadCount); KisTestableUpdaterContext* updaterContext(); KisTestableSimpleUpdateQueue* updateQueue(); using KisUpdateScheduler::processQueues; }; #endif /* __KIS_UPDATE_SCHEDULER_H */ diff --git a/krita/image/kis_update_time_monitor.h b/krita/image/kis_update_time_monitor.h index b56930ad697..dc47a80da8d 100644 --- a/krita/image/kis_update_time_monitor.h +++ b/krita/image/kis_update_time_monitor.h @@ -1,56 +1,56 @@ /* * Copyright (c) 2011 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_UPDATE_TIME_MONITOR_H #define __KIS_UPDATE_TIME_MONITOR_H -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_types.h" #include class QPointF; class QRect; class KRITAIMAGE_EXPORT KisUpdateTimeMonitor { public: static KisUpdateTimeMonitor* instance(); ~KisUpdateTimeMonitor(); void startStrokeMeasure(); void endStrokeMeasure(); void reportPaintOpPreset(KisPaintOpPresetSP preset); void reportMouseMove(const QPointF &pos); void printValues(); void reportJobStarted(void *key); void reportJobFinished(void *key, const QVector &rects); void reportUpdateFinished(const QRect &rect); private: KisUpdateTimeMonitor(); private: struct Private; Private * const m_d; }; #endif /* __KIS_UPDATE_TIME_MONITOR_H */ diff --git a/krita/image/kis_warptransform_worker.h b/krita/image/kis_warptransform_worker.h index 084620be433..d95d698455d 100644 --- a/krita/image/kis_warptransform_worker.h +++ b/krita/image/kis_warptransform_worker.h @@ -1,83 +1,83 @@ /* * kis_warptransform_worker.h - part of Krita * * Copyright (c) 2010 Marc Pegon * * 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_WARPTRANSFORM_WORKER_H #define KIS_WARPTRANSFORM_WORKER_H #include "kis_types.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_paint_device.h" #include #include #include #include #include #include /** * Class to apply a transformation (affine, similitude, MLS) to a paintDevice * or a QImage according an original set of points p, a new set of points q, * and the constant alpha. * The algorithms are based a paper entitled "Image Deformation Using * Moving Least Squares", by Scott Schaefer (Texas A&M University), Travis * McPhail (Rice University) and Joe Warren (Rice University) */ class KRITAIMAGE_EXPORT KisWarpTransformWorker : public QObject { Q_OBJECT public: typedef enum WarpType_ {AFFINE_TRANSFORM = 0, SIMILITUDE_TRANSFORM, RIGID_TRANSFORM, N_MODES} WarpType; static QPointF affineTransformMath(QPointF v, QVector p, QVector q, qreal alpha); static QPointF similitudeTransformMath(QPointF v, QVector p, QVector q, qreal alpha); static QPointF rigidTransformMath(QPointF v, QVector p, QVector q, qreal alpha); static QImage transformQImage(WarpType warpType, const QVector &origPoint, const QVector &transfPoint, qreal alpha, const QImage& srcImage, const QPointF &srcQImageOffset, QPointF *newOffset); // Prepare the transformation on dev KisWarpTransformWorker(WarpType warpType, KisPaintDeviceSP dev, QVector origPoint, QVector transfPoint, qreal alpha, KoUpdater *progress); ~KisWarpTransformWorker(); // Perform the prepated transformation void run(); private: struct FunctionTransformOp; typedef QPointF (*WarpMathFunction)(QPointF, QVector, QVector, qreal); private: WarpMathFunction m_warpMathFunction; QVector m_origPoint; QVector m_transfPoint; qreal m_alpha; KisPaintDeviceSP m_dev; KoUpdater *m_progress; }; #endif diff --git a/krita/image/krita_utils.h b/krita/image/krita_utils.h index 07b9fb6f85a..4bc9a7c543a 100644 --- a/krita/image/krita_utils.h +++ b/krita/image/krita_utils.h @@ -1,67 +1,67 @@ /* * Copyright (c) 2011 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 __KRITA_UTILS_H #define __KRITA_UTILS_H class QRect; class QRectF; class QSize; class QPen; class QPointF; class QPainterPath; class QBitArray; #include -#include "krita_export.h" +#include "kritaimage_export.h" namespace KritaUtils { QSize KRITAIMAGE_EXPORT optimalPatchSize(); QVector KRITAIMAGE_EXPORT splitRectIntoPatches(const QRect &rc, const QSize &patchSize); QRegion KRITAIMAGE_EXPORT splitTriangles(const QPointF ¢er, const QVector &points); QRegion KRITAIMAGE_EXPORT splitPath(const QPainterPath &path); void KRITAIMAGE_EXPORT initAntsPen(QPen *antsPen, QPen *outlinePen, int antLength = 4, int antSpace = 4); QString KRITAIMAGE_EXPORT prettyFormatReal(qreal value); qreal KRITAIMAGE_EXPORT maxDimensionPortion(const QRectF &bounds, qreal portion, qreal minValue); QPainterPath KRITAIMAGE_EXPORT trySimplifyPath(const QPainterPath &path, qreal lengthThreshold); /** * Split a path \p path into a set of disjoint (non-intersectable) * paths if possible. * * It tries to follow odd-even fill rule, but has a small problem: * If you have three selections included into each other twice, * then the smallest selection will be included into the final subpath, * although it shouldn't according to odd-even-fill rule. It is still * to be fixed. */ QList KRITAIMAGE_EXPORT splitDisjointPaths(const QPainterPath &path); quint8 KRITAIMAGE_EXPORT mergeOpacity(quint8 opacity, quint8 parentOpacity); QBitArray KRITAIMAGE_EXPORT mergeChannelFlags(const QBitArray &flags, const QBitArray &parentFlags); } #endif /* __KRITA_UTILS_H */ diff --git a/krita/image/krita_export.h b/krita/image/kritaimage_export.h similarity index 95% rename from krita/image/krita_export.h rename to krita/image/kritaimage_export.h index 48ed22de137..1e88d86fc50 100644 --- a/krita/image/krita_export.h +++ b/krita/image/kritaimage_export.h @@ -1,59 +1,59 @@ /* This file is part of krita Copyright (c) 2008 Boudewijn Rempt Copyright (c) 2008 Thomas Zander This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ -#ifndef KRITA_EXPORT_H -#define KRITA_EXPORT_H +#ifndef KRITAIMAGE_EXPORT_H +#define KRITAIMAGE_EXPORT_H #include /* We use _WIN32/_WIN64 instead of Q_OS_WIN so that this header can be used from C files too */ #if defined(_WIN32) || defined(_WIN64) #ifndef KRITAIMAGE_EXPORT # ifdef MAKE_KRITAIMAGE_LIB # define KRITAIMAGE_EXPORT KDE_EXPORT # else # define KRITAIMAGE_EXPORT KDE_IMPORT # endif #endif #else // not windows #define KRITAIMAGE_EXPORT KDE_EXPORT #endif /* not windows */ /* Now the same for Krita*_TEST_EXPORT, if compiling with unit tests enabled */ #ifdef COMPILING_TESTS # if defined _WIN32 || defined _WIN64 # if defined(MAKE_KRITAIMAGE_LIB) # define KRITAIMAGE_TEST_EXPORT KDE_EXPORT # else # define KRITAIMAGE_TEST_EXPORT KDE_IMPORT # endif # else /* not windows */ # define KRITAIMAGE_TEST_EXPORT KDE_EXPORT # endif #else /* not compiling tests */ # define KRITAIMAGE_TEST_EXPORT #endif -#endif /* KRITA_EXPORT_H */ +#endif /* KRITAIMAGE_EXPORT_H */ diff --git a/krita/image/layerstyles/gimp_bump_map.h b/krita/image/layerstyles/gimp_bump_map.h index aa8ee80ca63..358c21df99b 100644 --- a/krita/image/layerstyles/gimp_bump_map.h +++ b/krita/image/layerstyles/gimp_bump_map.h @@ -1,77 +1,77 @@ /* * Copyright (c) 2015 Dmitry Kazakov * * gimp_bump_map contains code taken from gimp-bumpmap.c, original copyright: * * Copyright (C) 1997 Federico Mena Quintero * Copyright (C) 1997-2000 Jens Lautenbacher * Copyright (C) 2000 Sven Neumann * * 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 __GIMP_BUMP_MAP_H #define __GIMP_BUMP_MAP_H #include #include "kis_types.h" enum BumpmapType { LINEAR = 0, SPHERICAL, SINUSOIDAL }; struct bumpmap_vals_t { bumpmap_vals_t() : bumpmap_id(0), azimuth(0), elevation(30), depth(50), xofs(0), yofs(0), waterlevel(0), ambient(10), compensate(true), invert(false), type(0), tiled(false) { } const qint32 bumpmap_id; double azimuth; double elevation; int depth; const int xofs; const int yofs; const int waterlevel; int ambient; bool compensate; bool invert; int type; const bool tiled; }; -void KDE_EXPORT bumpmap (KisPixelSelectionSP device, - const QRect &selectionRect, - const bumpmap_vals_t &bmvals); +void KRITAIMAGE_EXPORT bumpmap (KisPixelSelectionSP device, + const QRect &selectionRect, + const bumpmap_vals_t &bmvals); #endif /* __GIMP_BUMP_MAP_H */ diff --git a/krita/image/layerstyles/kis_layer_style_filter.h b/krita/image/layerstyles/kis_layer_style_filter.h index 3efa51bbc1c..194b0b1c622 100644 --- a/krita/image/layerstyles/kis_layer_style_filter.h +++ b/krita/image/layerstyles/kis_layer_style_filter.h @@ -1,67 +1,68 @@ /* * 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_LAYER_STYLE_FILTER_H #define __KIS_LAYER_STYLE_FILTER_H #include "kis_types.h" #include "kis_shared.h" +#include "kritaimage_export.h" #include class KisPSDLayerStyle; class KisLayerStyleFilterEnvironment; -class KDE_EXPORT KisLayerStyleFilter : public KisShared +class KRITAIMAGE_EXPORT KisLayerStyleFilter : public KisShared { public: KisLayerStyleFilter(const KoID &id); virtual ~KisLayerStyleFilter(); /** * \return Unique identifier for this filter */ QString id() const; virtual void processDirectly(KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &applyRect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const = 0; /** * Some filters need pixels outside the current processing rect to compute the new * value (for instance, convolution filters) */ virtual QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style) const = 0; /** * Similar to \ref neededRect: some filters will alter a lot of pixels that are * near to each other at the same time. So when you changed a single rectangle * in a device, the actual rectangle that will feel the influence of this change * might be bigger. Use this function to determine that rect. */ virtual QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style) const = 0; private: struct Private; const QScopedPointer m_d; }; #endif /* __KIS_LAYER_STYLE_FILTER_H */ diff --git a/krita/image/layerstyles/kis_layer_style_filter_environment.h b/krita/image/layerstyles/kis_layer_style_filter_environment.h index 0866e02d716..b5ba9cdb954 100644 --- a/krita/image/layerstyles/kis_layer_style_filter_environment.h +++ b/krita/image/layerstyles/kis_layer_style_filter_environment.h @@ -1,53 +1,53 @@ /* * 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_LAYER_STYLE_FILTER_ENVIRONMENT_H #define __KIS_LAYER_STYLE_FILTER_ENVIRONMENT_H #include #include -#include +#include class KisPainter; class KisLayer; class QPainterPath; class QBitArray; -class KDE_EXPORT KisLayerStyleFilterEnvironment +class KRITAIMAGE_EXPORT KisLayerStyleFilterEnvironment { public: KisLayerStyleFilterEnvironment(KisLayer *sourceLayer); ~KisLayerStyleFilterEnvironment(); QRect layerBounds() const; QRect defaultBounds() const; QPainterPath layerOutlineCache() const; void setupFinalPainter(KisPainter *gc, quint8 opacity, const QBitArray &channelFlags) const; private: struct Private; const QScopedPointer m_d; }; #endif /* __KIS_LAYER_STYLE_FILTER_ENVIRONMENT_H */ diff --git a/krita/image/layerstyles/kis_layer_style_projection_plane.h b/krita/image/layerstyles/kis_layer_style_projection_plane.h index 9f1aab44b10..6cd1de216f3 100644 --- a/krita/image/layerstyles/kis_layer_style_projection_plane.h +++ b/krita/image/layerstyles/kis_layer_style_projection_plane.h @@ -1,58 +1,59 @@ /* * 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_LAYER_STYLE_PROJECTION_PLANE_H #define __KIS_LAYER_STYLE_PROJECTION_PLANE_H #include "kis_abstract_projection_plane.h" #include #include "kis_types.h" +#include class KRITAIMAGE_EXPORT KisLayerStyleProjectionPlane : public KisAbstractProjectionPlane { public: KisLayerStyleProjectionPlane(KisLayer *sourceLayer); ~KisLayerStyleProjectionPlane(); QRect recalculate(const QRect& rect, KisNodeSP filthyNode); void apply(KisPainter *painter, const QRect &rect); QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos) const; QRect changeRect(const QRect &rect, KisLayer::PositionToFilthy pos) const; QRect accessRect(const QRect &rect, KisLayer::PositionToFilthy pos) const; // a method for registering on KisLayerStyleProjectionPlaneFactory static KisAbstractProjectionPlaneSP factoryObject(KisLayer *sourceLayer); private: friend class KisLayerStyleProjectionPlaneTest; KisLayerStyleProjectionPlane(KisLayer *sourceLayer, KisPSDLayerStyleSP style); void init(KisLayer *sourceLayer, KisPSDLayerStyleSP layerStyle); private: struct Private; const QScopedPointer m_d; }; #endif /* __KIS_LAYER_STYLE_PROJECTION_PLANE_H */ diff --git a/krita/image/layerstyles/kis_ls_bevel_emboss_filter.h b/krita/image/layerstyles/kis_ls_bevel_emboss_filter.h index 43c19152b56..ffbf36e1c58 100644 --- a/krita/image/layerstyles/kis_ls_bevel_emboss_filter.h +++ b/krita/image/layerstyles/kis_ls_bevel_emboss_filter.h @@ -1,52 +1,53 @@ /* * Copyright (c) 2014 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_LS_BEVEL_EMBOSS_FILTER_H #define KIS_LS_BEVEL_EMBOSS_FILTER_H #include #include "kis_layer_style_filter.h" +#include struct psd_layer_effects_bevel_emboss; struct psd_layer_effects_context; -class KDE_EXPORT KisLsBevelEmbossFilter : public KisLayerStyleFilter +class KRITAIMAGE_EXPORT KisLsBevelEmbossFilter : public KisLayerStyleFilter { public: KisLsBevelEmbossFilter(); void processDirectly(KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &applyRect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const; QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style) const; QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style) const; private: void applyBevelEmboss(KisPaintDeviceSP srcDevice, KisPaintDeviceSP dstDevice, const QRect &applyRect, const psd_layer_effects_bevel_emboss *config, KisLayerStyleFilterEnvironment *env) const; }; #endif diff --git a/krita/image/layerstyles/kis_ls_drop_shadow_filter.h b/krita/image/layerstyles/kis_ls_drop_shadow_filter.h index c75fdfb78ea..2b75e0dbf36 100644 --- a/krita/image/layerstyles/kis_ls_drop_shadow_filter.h +++ b/krita/image/layerstyles/kis_ls_drop_shadow_filter.h @@ -1,58 +1,59 @@ /* * Copyright (c) 2014 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_LS_DROP_SHADOW_FILTER_H #define KIS_LS_DROP_SHADOW_FILTER_H #include #include "kis_layer_style_filter.h" +#include struct psd_layer_effects_shadow_base; -class KDE_EXPORT KisLsDropShadowFilter : public KisLayerStyleFilter +class KRITAIMAGE_EXPORT KisLsDropShadowFilter : public KisLayerStyleFilter { public: enum Mode { DropShadow, InnerShadow, OuterGlow, InnerGlow }; KisLsDropShadowFilter(Mode mode = DropShadow); void processDirectly(KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &applyRect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const; QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style) const; QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style) const; private: const psd_layer_effects_shadow_base* getShadowStruct(KisPSDLayerStyleSP style) const; private: const Mode m_mode; }; #endif diff --git a/krita/image/layerstyles/kis_ls_overlay_filter.h b/krita/image/layerstyles/kis_ls_overlay_filter.h index 9ce0d12255f..81eb52c8fca 100644 --- a/krita/image/layerstyles/kis_ls_overlay_filter.h +++ b/krita/image/layerstyles/kis_ls_overlay_filter.h @@ -1,64 +1,65 @@ /* * Copyright (c) 2014 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_LS_OVERLAY_FILTER_H #define KIS_LS_OVERLAY_FILTER_H #include #include "kis_layer_style_filter.h" +#include struct psd_layer_effects_overlay_base; struct psd_layer_effects_context; -class KDE_EXPORT KisLsOverlayFilter : public KisLayerStyleFilter +class KRITAIMAGE_EXPORT KisLsOverlayFilter : public KisLayerStyleFilter { public: enum Mode { Color, Gradient, Pattern }; public: KisLsOverlayFilter(Mode mode); void processDirectly(KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &applyRect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const; QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style) const; QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style) const; private: const psd_layer_effects_overlay_base* getOverlayStruct(KisPSDLayerStyleSP style) const; void applyOverlay(KisPaintDeviceSP srcDevice, KisPaintDeviceSP dstDevice, const QRect &applyRect, const psd_layer_effects_overlay_base *config, KisLayerStyleFilterEnvironment *env) const; private: Mode m_mode; }; #endif diff --git a/krita/image/layerstyles/kis_ls_satin_filter.h b/krita/image/layerstyles/kis_ls_satin_filter.h index e680c73b14f..d39753a52a9 100644 --- a/krita/image/layerstyles/kis_ls_satin_filter.h +++ b/krita/image/layerstyles/kis_ls_satin_filter.h @@ -1,44 +1,45 @@ /* * Copyright (c) 2014 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_LS_SATIN_FILTER_H #define KIS_LS_SATIN_FILTER_H #include #include "kis_layer_style_filter.h" +#include struct psd_layer_effects_shadow_base; -class KDE_EXPORT KisLsSatinFilter : public KisLayerStyleFilter +class KRITAIMAGE_EXPORT KisLsSatinFilter : public KisLayerStyleFilter { public: KisLsSatinFilter(); void processDirectly(KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &applyRect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const; QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style) const; QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style) const; }; #endif diff --git a/krita/image/layerstyles/kis_ls_stroke_filter.h b/krita/image/layerstyles/kis_ls_stroke_filter.h index 430c5ff0928..d8d22280d01 100644 --- a/krita/image/layerstyles/kis_ls_stroke_filter.h +++ b/krita/image/layerstyles/kis_ls_stroke_filter.h @@ -1,52 +1,53 @@ /* * Copyright (c) 2014 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_LS_STROKE_FILTER_H #define KIS_LS_STROKE_FILTER_H #include +#include #include "kis_layer_style_filter.h" struct psd_layer_effects_stroke; struct psd_layer_effects_context; -class KDE_EXPORT KisLsStrokeFilter : public KisLayerStyleFilter +class KRITAIMAGE_EXPORT KisLsStrokeFilter : public KisLayerStyleFilter { public: KisLsStrokeFilter(); void processDirectly(KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &applyRect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const; QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style) const; QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style) const; private: void applyStroke(KisPaintDeviceSP srcDevice, KisPaintDeviceSP dstDevice, const QRect &applyRect, const psd_layer_effects_stroke *config, KisLayerStyleFilterEnvironment *env) const; }; #endif diff --git a/krita/image/metadata/kis_meta_data_entry.h b/krita/image/metadata/kis_meta_data_entry.h index 2eef10639d7..178a5f9743c 100644 --- a/krita/image/metadata/kis_meta_data_entry.h +++ b/krita/image/metadata/kis_meta_data_entry.h @@ -1,96 +1,97 @@ /* * Copyright (c) 2007 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_META_DATA_ENTRY_H_ #define _KIS_META_DATA_ENTRY_H_ -#include +#include +#include class QString; namespace KisMetaData { class Value; class Store; class Schema; /** * Represent a metadata entry, a name and a value (\ref KisMetaData::Value). */ class KRITAIMAGE_EXPORT Entry { struct Private; friend class Store; public: /** * Create an invalid entry */ Entry(); /** * Create a new entry. * @param name * @param namespacePrefix * @param value */ Entry(const KisMetaData::Schema* schema, QString name, const KisMetaData::Value& value); Entry(const Entry&); ~Entry(); /** * @return the name of this entry */ QString name() const; /** * @return the namespace of this entry */ const KisMetaData::Schema* schema() const; /** * @return the qualified name of this entry, which is the concatenation of the * namespace and of the name */ QString qualifiedName() const; /** * @return the value of this entry */ const KisMetaData::Value& value() const; /** * @return the value of this entry */ KisMetaData::Value& value(); /** * @return true if this entry is valid */ bool isValid() const; /** * @return true if the name in argument is valid entry name. */ static bool isValidName(const QString& _name); /** * Affect the content of entry to this entry if entry is valid */ Entry& operator=(const Entry& entry); bool operator==(const Entry&) const; private: void setSchema(const KisMetaData::Schema* schema); private: Private* const d; }; } KRITAIMAGE_EXPORT QDebug operator<<(QDebug debug, const KisMetaData::Entry &c); #endif diff --git a/krita/image/metadata/kis_meta_data_filter.h b/krita/image/metadata/kis_meta_data_filter.h index 9ad5b5af6d8..dadab01fdf1 100644 --- a/krita/image/metadata/kis_meta_data_filter.h +++ b/krita/image/metadata/kis_meta_data_filter.h @@ -1,51 +1,52 @@ /* * Copyright (c) 2007-2008 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_META_DATA_FILTER_H_ #define _KIS_META_DATA_FILTER_H_ -#include +#include +class QString; namespace KisMetaData { class Store; /** * This class is a base class for filtering a meta data store to alter some * information. For instance, remove author information or change edition * date. */ class Filter { public: virtual ~Filter(); /// @return true if the filter is enabled by default when exporting virtual bool defaultEnabled() const = 0; /// @return the id of this filter virtual QString id() const = 0; /// @return the name of this filter virtual QString name() const = 0; /// @return a description of this filter virtual QString description() const = 0; /** * Apply a filter on a meta data store. */ virtual void filter(KisMetaData::Store*) const = 0; }; } #endif diff --git a/krita/image/metadata/kis_meta_data_filter_registry.h b/krita/image/metadata/kis_meta_data_filter_registry.h index 1709735ff83..3630d6f1018 100644 --- a/krita/image/metadata/kis_meta_data_filter_registry.h +++ b/krita/image/metadata/kis_meta_data_filter_registry.h @@ -1,43 +1,43 @@ /* * Copyright (c) 2008 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_META_DATA_FILTER_REGISTRY_H_ #define _KIS_META_DATA_FILTER_REGISTRY_H_ -#include +#include #include "KoGenericRegistry.h" #include "kis_meta_data_filter.h" namespace KisMetaData { class KRITAIMAGE_EXPORT FilterRegistry : public KoGenericRegistry { public: virtual ~FilterRegistry(); static FilterRegistry* instance(); private: FilterRegistry(); FilterRegistry(const FilterRegistry&); FilterRegistry& operator=(const FilterRegistry&); }; } #endif diff --git a/krita/image/metadata/kis_meta_data_io_backend.h b/krita/image/metadata/kis_meta_data_io_backend.h index 2201a843dc8..d1b34fb5c71 100644 --- a/krita/image/metadata/kis_meta_data_io_backend.h +++ b/krita/image/metadata/kis_meta_data_io_backend.h @@ -1,117 +1,117 @@ /* * Copyright (c) 2007 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_META_DATA_IO_BACKEND_H_ #define _KIS_META_DATA_IO_BACKEND_H_ -#include +#include #include class QIODevice; namespace KisMetaData { class Store; /** * This is a the interface for input or output backend to KisMetaData. * For instance, to add support to exif or xmp or iptc or dublin core * or anything else, it is needed to extend this interface. */ class KRITAIMAGE_EXPORT IOBackend { public: /** * Tell whether the backend input/output from/to binary data * or text (XML or RDF) data. */ enum BackendType { Binary, Text }; enum HeaderType { NoHeader, ///< Don't append any header JpegHeader ///< Append Jpeg-style header }; public: virtual ~IOBackend() {}; virtual QString id() const = 0; virtual QString name() const = 0; /** * @return the type of the backend */ virtual BackendType type() const = 0; /** * @return tell if this backend support saving */ virtual bool supportSaving() const = 0; /** * @param store the list of metadata to save * @param ioDevice the device to where the metadata will be saved * @param headerType determine if an header must be prepend to the binary header, and if it does, * which type of header * @return true if the save was successful (XXX: actually, all backends always return true...) */ virtual bool saveTo(Store* store, QIODevice* ioDevice, HeaderType headerType = NoHeader) const = 0; /** * @param store the list of metadata * @return true if this backend is capable of saving all the metadata * of the store */ virtual bool canSaveAllEntries(Store* store) const = 0; /** * @return true if this backend support loading */ virtual bool supportLoading() const = 0; /** * @param store the list of metadata to load * @param ioDevice the device from where the metadata will be loaded * @return true if the load was successful */ virtual bool loadFrom(Store* store, QIODevice* ioDevice) const = 0; }; class KRITAIMAGE_EXPORT IOBackendRegistry : public KoGenericRegistry { public: static IOBackendRegistry* instance(); private: IOBackendRegistry(); ~IOBackendRegistry(); }; } #endif diff --git a/krita/image/metadata/kis_meta_data_merge_strategy.h b/krita/image/metadata/kis_meta_data_merge_strategy.h index eb7ce1790a0..61b735493e6 100644 --- a/krita/image/metadata/kis_meta_data_merge_strategy.h +++ b/krita/image/metadata/kis_meta_data_merge_strategy.h @@ -1,62 +1,62 @@ /* * Copyright (c) 2008 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_META_DATA_MERGE_STRATEGY_H_ #define _KIS_META_DATA_MERGE_STRATEGY_H_ #include -#include +#include class QString; namespace KisMetaData { class Store; /** * This is an interface which serves as a base class for meta data store merge * strategy. * This is used to decide which entries of a metadata store is kept, or how they * are modified when a list of meta data stores are merged together. */ class KRITAIMAGE_EXPORT MergeStrategy { public: virtual ~MergeStrategy(); /// @return the id of this merge strategy virtual QString id() const = 0; /// @return the name of this merge strategy virtual QString name() const = 0; /// @return a description of this merge strategy virtual QString description() const = 0; /** * Call this function to merge a list of meta data stores in one. * @param dst the destination store * @param srcs the list of source meta data store * @param scores a list of score which defines the importance of each store compared to the other * the sum of score is expected to be equal to 1.0. * One way to attribute a score is to compute the area of each layer and then * to give a higher score to the biggest layer. * srcs and scores list must have the same size. */ virtual void merge(Store* dst, QList srcs, QList scores) const = 0; }; } #endif diff --git a/krita/image/metadata/kis_meta_data_merge_strategy_registry.h b/krita/image/metadata/kis_meta_data_merge_strategy_registry.h index 1f2b643c206..8d0320506b3 100644 --- a/krita/image/metadata/kis_meta_data_merge_strategy_registry.h +++ b/krita/image/metadata/kis_meta_data_merge_strategy_registry.h @@ -1,43 +1,43 @@ /* * Copyright (c) 2008 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_META_DATA_MERGE_STRATEGY_REGISTRY_H_ #define _KIS_META_DATA_MERGE_STRATEGY_REGISTRY_H_ -#include +#include #include "KoGenericRegistry.h" #include "kis_meta_data_merge_strategy.h" namespace KisMetaData { class KRITAIMAGE_EXPORT MergeStrategyRegistry : public KoGenericRegistry { public: virtual ~MergeStrategyRegistry(); static MergeStrategyRegistry* instance(); private: MergeStrategyRegistry(); MergeStrategyRegistry(const MergeStrategyRegistry&); MergeStrategyRegistry& operator=(const MergeStrategyRegistry&); }; } #endif diff --git a/krita/image/metadata/kis_meta_data_parser.h b/krita/image/metadata/kis_meta_data_parser.h index ed255ed881a..591a91ed854 100644 --- a/krita/image/metadata/kis_meta_data_parser.h +++ b/krita/image/metadata/kis_meta_data_parser.h @@ -1,42 +1,42 @@ /* * Copyright (c) 2009 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_META_DATA_PARSER_H_ #define _KIS_META_DATA_PARSER_H_ -#include +#include #include namespace KisMetaData { class TypeInfo; class Value; /** * This class allow to parse from a string and return a value. */ class KRITAIMAGE_EXPORT Parser { friend class TypeInfo; public: virtual ~Parser(); virtual Value parse(const QString&) const = 0; }; } #endif diff --git a/krita/image/metadata/kis_meta_data_schema.h b/krita/image/metadata/kis_meta_data_schema.h index edb982cef0c..1f0431eea45 100644 --- a/krita/image/metadata/kis_meta_data_schema.h +++ b/krita/image/metadata/kis_meta_data_schema.h @@ -1,74 +1,75 @@ /* * Copyright (c) 2007 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_META_DATA_SCHEMA_H_ #define _KIS_META_DATA_SCHEMA_H_ -#include +#include +#include class QString; namespace KisMetaData { class SchemaRegistry; class TypeInfo; class KRITAIMAGE_EXPORT Schema { friend class SchemaRegistry; public: virtual ~Schema(); static const QString TIFFSchemaUri; static const QString EXIFSchemaUri; static const QString DublinCoreSchemaUri; static const QString XMPSchemaUri; static const QString XMPRightsSchemaUri; static const QString XMPMediaManagementUri; static const QString MakerNoteSchemaUri; static const QString IPTCSchemaUri; static const QString PhotoshopSchemaUri; private: Schema(); Schema(const QString & _uri, const QString & _ns); public: /** * @return the \ref TypeInfo associated with a given a property ( @p _propertyName ). */ const TypeInfo* propertyType(const QString& _propertyName) const; /** * @return the \ref TypeInfo describing a given structure of that scheam */ const TypeInfo* structure(const QString& _structureName) const; public: QString uri() const; QString prefix() const; QString generateQualifiedName(const QString &) const; private: struct Private; Private* const d; }; } KRITAIMAGE_EXPORT QDebug operator<<(QDebug debug, const KisMetaData::Schema &c); #endif diff --git a/krita/image/metadata/kis_meta_data_schema_registry.h b/krita/image/metadata/kis_meta_data_schema_registry.h index bc5361a0552..42dd7f7216a 100644 --- a/krita/image/metadata/kis_meta_data_schema_registry.h +++ b/krita/image/metadata/kis_meta_data_schema_registry.h @@ -1,68 +1,69 @@ /* * Copyright (c) 2007 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_META_DATA_SCHEMA_REGISTRY_H_ #define _KIS_META_DATA_SCHEMA_REGISTRY_H_ -#include +#include class QString; +class QDebug; namespace KisMetaData { class Schema; class KRITAIMAGE_EXPORT SchemaRegistry { struct Private; SchemaRegistry(); ~SchemaRegistry(); public: /** * Creates a new schema. * @param uri the name of the schema * @param prefix the namespace prefix used for this schema * @return the schema associated with the uri (it can return 0, if no schema exist * for the uri, but the prefix was already used, and it can be an already existing * schema if the uri was already included) */ const KisMetaData::Schema* create(const QString & uri, const QString & prefix); /** * @return the schema for this uri */ const Schema* schemaFromUri(const QString & uri) const; /** * @return the schema for this prefix */ const Schema* schemaFromPrefix(const QString & prefix) const; /** * Return an instance of the SchemaRegistry. * Creates an instance if that has never happened before and returns * the singleton instance. * Initialize it with default schemas. */ static KisMetaData::SchemaRegistry* instance(); private: Private* const d; }; } KRITAIMAGE_EXPORT QDebug operator<<(QDebug debug, const KisMetaData::Schema &c); #endif diff --git a/krita/image/metadata/kis_meta_data_store.h b/krita/image/metadata/kis_meta_data_store.h index 87f3dc57d60..2275d61c7f2 100644 --- a/krita/image/metadata/kis_meta_data_store.h +++ b/krita/image/metadata/kis_meta_data_store.h @@ -1,182 +1,182 @@ /* * Copyright (c) 2007 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_META_DATA_STORE_H_ #define _KIS_META_DATA_STORE_H_ -#include +#include #include namespace KisMetaData { class Schema; class Entry; class Filter; class Value; /** * This class holds the list of metadata entries and schemas (for instance the * author of the image, copyright holder, license, aperture, speed...) */ class KRITAIMAGE_EXPORT Store { struct Private; public: Store(); Store(const Store&); ~Store(); public: /** * Copy the entries from store inside this store */ void copyFrom(const Store* store); /** * @return true if there is no metadata in this store. */ bool empty() const; bool isEmpty() const; /** * Insert a new entry. * * @param entry the new entry to insert in the metadata store, it * must be a key which doesn't already exist * * @return false if the entry couldn't be included whether because the key already * exists */ bool addEntry(const Entry& entry); /** * Give access to a metadata entry * @param entryKey the entryKey as the qualified name of the entry */ Entry& getEntry(const QString & entryKey); /** * Give access to a metadata entry * @param uri the uri of the schema * @param entryName the name of the entry */ Entry& getEntry(const QString & uri, const QString & entryName); /** * Give access to a metadata entry * @param schema the schema * @param entryName the name of the entry */ Entry& getEntry(const KisMetaData::Schema* schema, const QString & entryName); /** * Give access to a metadata entry * @param entryKey the entryKey as the qualified name of the entry */ const Entry& getEntry(const QString & entryKey) const; /** * Give access to a metadata entry * @param uri the uri of the schema * @param entryName the name of the entry */ const Entry& getEntry(const QString & uri, const QString & entryName) const; /** * Give access to a metadata entry * @param schema the schema * @param entryName the name of the entry */ const Entry& getEntry(const KisMetaData::Schema* schema, const QString & entryName) const; /** * Remove an entry. * @param entryKey the entryKey as the qualified name of the entry */ void removeEntry(const QString & entryKey); /** * Remove an entry. * @param uri the uri of the schema * @param entryName the name of the entry */ void removeEntry(const QString & uri, const QString & entryName); /** * Remove an entry. * @param schema the schema * @param entryName the name of the entry */ void removeEntry(const KisMetaData::Schema* schema, const QString & entryName); /** * Return the value associated with this entry name and uri. * @param uri * @param entryName * @return the value */ const Value& getValue(const QString & uri, const QString & entryName) const; QHash::const_iterator begin() const; QHash::const_iterator end() const; /** * @param entryKey the entryKey as the qualified name of the entry * @return true if an entry with the given key exist in the store */ bool containsEntry(const QString & entryKey) const; /** * @return true if the store contains this entry */ bool containsEntry(const KisMetaData::Schema* schema, const QString & entryName) const; /** * @param uri * @param entryName * @return true if an entry with the given uri and entry name exist in the store */ bool containsEntry(const QString & uri, const QString & entryName) const; /** * Dump on kdDebug the metadata store. */ void debugDump() const; /** * Apply a list of filters on a store */ void applyFilters(const QList & filters); /** * @return the list of keys */ QList keys() const; /** * @return the list of entries */ QList entries() const; private: Private* const d; }; } #endif diff --git a/krita/image/metadata/kis_meta_data_type_info.h b/krita/image/metadata/kis_meta_data_type_info.h index 37314b0a9fe..8ee20ed4c75 100644 --- a/krita/image/metadata/kis_meta_data_type_info.h +++ b/krita/image/metadata/kis_meta_data_type_info.h @@ -1,101 +1,101 @@ /* * Copyright (c) 2009 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_META_DATA_TYPE_INFO_H_ #define _KIS_META_DATA_TYPE_INFO_H_ #include #include -#include +#include namespace KisMetaData { class Parser; class Schema; class Value; class KRITAIMAGE_EXPORT TypeInfo { public: enum PropertyType { BooleanType, IntegerType, DateType, TextType, OrderedArrayType, UnorderedArrayType, AlternativeArrayType, LangArrayType, StructureType, RationalType, GPSCoordinateType, OpenedChoice, ClosedChoice }; class KRITAIMAGE_EXPORT Choice { public: Choice(const Value&, const QString& hint); Choice(const Choice&); Choice& operator=(const Choice&); ~Choice(); public: const Value& value() const; const QString& hint() const; private: struct Private; Private* const d; }; private: TypeInfo(PropertyType _propertiesType); /** * Create a \ref TypeInfo for a */ TypeInfo(PropertyType _propertiesType, const TypeInfo* _embedded); /** * Create a \ref TypeInfo for a choice (either open or closed). * @param _propertiesType either OpenedChoice or ClosedChoice */ TypeInfo(PropertyType _propertiesType, const TypeInfo* _embedded, const QList< Choice >&); /** * Create a \ref TypeInfo for a structure. */ TypeInfo(Schema* _structureSchema, const QString& name); ~TypeInfo(); public: PropertyType propertyType() const; const TypeInfo* embeddedPropertyType() const; const QList< Choice >& choices() const; Schema* structureSchema() const; const QString& structureName() const; const Parser* parser() const; /** * @return true if @p value has a type that is correct for this \ref TypeInfo */ bool hasCorrectType(const Value& value) const; /** * @return true if @p value has a value acceptable for this \ref TypeInfo */ bool hasCorrectValue(const Value& value) const; public: struct Private; private: Private* const d; }; } #endif diff --git a/krita/image/metadata/kis_meta_data_validator.h b/krita/image/metadata/kis_meta_data_validator.h index 2672a3c353a..325a86acf66 100644 --- a/krita/image/metadata/kis_meta_data_validator.h +++ b/krita/image/metadata/kis_meta_data_validator.h @@ -1,77 +1,77 @@ /* * Copyright (c) 2009 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_META_DATA_VALIDATION_RESULT_H_ #define _KIS_META_DATA_VALIDATION_RESULT_H_ #include #include -#include +#include namespace KisMetaData { class Store; /** * This class contains information on the validation results of a \ref KisMetaData::Store . */ class KRITAIMAGE_EXPORT Validator { public: class KRITAIMAGE_EXPORT Reason { friend class Validator; friend class QMap; public: enum Type { UNKNOWN_REASON, UNKNOWN_ENTRY, INVALID_TYPE, INVALID_VALUE }; private: Reason(Type type = UNKNOWN_REASON); Reason(const Reason&); Reason& operator=(const Reason&); public: ~Reason(); Type type() const; private: struct Private; Private* const d; }; public: /** * Validate a store. This constructore will call the \ref revalidate function. */ Validator(const Store*); ~Validator(); int countInvalidEntries() const; int countValidEntries() const; const QMap& invalidEntries() const; /** * Call this function to revalidate the store. */ void revalidate(); private: struct Private; Private* const d; }; } #endif diff --git a/krita/image/metadata/kis_meta_data_value.h b/krita/image/metadata/kis_meta_data_value.h index 269bb8ffed5..c38d29b9b5f 100644 --- a/krita/image/metadata/kis_meta_data_value.h +++ b/krita/image/metadata/kis_meta_data_value.h @@ -1,132 +1,132 @@ /* * Copyright (c) 2007 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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_META_DATA_VALUE_H_ #define _KIS_META_DATA_VALUE_H_ #include #include -#include +#include class QVariant; namespace KisMetaData { struct Rational { explicit Rational(qint32 n = 0, qint32 d = 1) : numerator(n), denominator(d) {} qint32 numerator; qint32 denominator; bool operator==(const Rational& ur) const { return numerator == ur.numerator && denominator == ur.denominator; } }; /** * Value is build on top of QVariant to extend it to support the various types * and extensions through property qualifiers. */ class KRITAIMAGE_EXPORT Value { struct Private; public: /// Define the possible value type enum ValueType { Invalid, Variant, OrderedArray, UnorderedArray, AlternativeArray, LangArray, Structure, Rational }; public: Value(); Value(const QVariant& value); /** * @param type is one of OrderedArray, UnorderedArray, AlternativeArray * or LangArray */ Value(const QList& array, ValueType type = OrderedArray); Value(const QMap& structure); Value(const KisMetaData::Rational& rational); Value(const Value& v); Value& operator=(const Value& v); ~Value(); public: void addPropertyQualifier(const QString& _name, const Value&); const QMap& propertyQualifiers() const; public: /// @return the type of this Value ValueType type() const; /** * @return the value as a double, or null if it's not possible, rationals are evaluated */ double asDouble() const; /** * @return the value as an integer, or null if it's not possible, rationals are evaluated */ int asInteger() const; /** * @return the Variant hold by this Value, or an empty QVariant if this Value is not a Variant */ QVariant asVariant() const; /** * Set this Value to the given variant, or does nothing if this Value is not a Variant. * @return true if the value was changed */ bool setVariant(const QVariant& variant); bool setStructureVariant(const QString& fieldNAme, const QVariant& variant); bool setArrayVariant(int index, const QVariant& variant); /** * @return the Rational hold by this Value, or a null rational if this Value is not * an Rational */ KisMetaData::Rational asRational() const; /** * @return the array hold by this Value, or an empty array if this Value is not either * an OrderedArray, UnorderedArray or AlternativeArray */ QList asArray() const; /** * @return true if this Value is either an OrderedArray, UnorderedArray or AlternativeArray */ bool isArray() const; /** * @return the structure hold by this Value, or an empty structure if this Value is not a Structure */ QMap asStructure() const; /** * It's a convenient function that build a map from a LangArray using the property * qualifier "xml:lang" for the key of the map. */ QMap asLangArray() const; QString toString() const; public: bool operator==(const Value&) const; Value& operator+=(const Value&); private: Private* const d; }; } KRITAIMAGE_EXPORT QDebug operator<<(QDebug debug, const KisMetaData::Value &v); #endif diff --git a/krita/image/recorder/kis_action_recorder.h b/krita/image/recorder/kis_action_recorder.h index 9f1ca62db2a..4a12bfe709a 100644 --- a/krita/image/recorder/kis_action_recorder.h +++ b/krita/image/recorder/kis_action_recorder.h @@ -1,49 +1,49 @@ /* * 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 "krita_export.h" +#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(); 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/krita/image/recorder/kis_macro.h b/krita/image/recorder/kis_macro.h index 0bf2ae51f84..ecf5f9bb69d 100644 --- a/krita/image/recorder/kis_macro.h +++ b/krita/image/recorder/kis_macro.h @@ -1,75 +1,75 @@ /* * 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 #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(); 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/krita/image/recorder/kis_macro_player.h b/krita/image/recorder/kis_macro_player.h index 3fee80ef094..4444fea4094 100644 --- a/krita/image/recorder/kis_macro_player.h +++ b/krita/image/recorder/kis_macro_player.h @@ -1,49 +1,49 @@ /* * 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 #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); virtual ~KisMacroPlayer(); public Q_SLOTS: void pause(); void resume(); protected: virtual void run(); private: struct Private; Private* const d; }; #endif diff --git a/krita/image/recorder/kis_node_query_path.h b/krita/image/recorder/kis_node_query_path.h index 2debed9e2da..31bad05ae3a 100644 --- a/krita/image/recorder/kis_node_query_path.h +++ b/krita/image/recorder/kis_node_query_path.h @@ -1,60 +1,60 @@ /* * 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_NODE_QUERY_PATH_H_ #define _KIS_NODE_QUERY_PATH_H_ #include -#include +#include /** * This class represent a path to access a node starting from an other node. */ class KRITAIMAGE_EXPORT KisNodeQueryPath { KisNodeQueryPath(); public: ~KisNodeQueryPath(); KisNodeQueryPath(const KisNodeQueryPath&); KisNodeQueryPath& operator=(const KisNodeQueryPath&); QList queryNodes(KisImageWSP image, KisNodeSP currentNode) const; bool isRelative() const; // Use "///" style because of the needed "/*" /// This function return a string representing this path. Which is a list separated by '\' of: /// - '*': represents all layers /// - '..': represents the parent layer /// - number: index of the layer /// - '.': represents the current layer /// /// For instance: "1/*" return all children of the first layer, "../3" return the third layer of the parent /// of the current layer /// If the string starts with "/" then it's an aboslute path, otherwise it's a relative path. QString toString() const; /** * @param path * @param err if non null, it will be filled with an error message * @see toString for an explanation of the string format */ static KisNodeQueryPath fromString(const QString& path); static KisNodeQueryPath absolutePath(KisNodeSP node); private: struct Private; Private* const d; }; #endif diff --git a/krita/image/recorder/kis_play_info.h b/krita/image/recorder/kis_play_info.h index fc70650f250..9f54df938e0 100644 --- a/krita/image/recorder/kis_play_info.h +++ b/krita/image/recorder/kis_play_info.h @@ -1,42 +1,42 @@ /* * 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 +#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/krita/image/recorder/kis_recorded_action.h b/krita/image/recorder/kis_recorded_action.h index 70e898b1a24..c66b79a2982 100644 --- a/krita/image/recorder/kis_recorded_action.h +++ b/krita/image/recorder/kis_recorded_action.h @@ -1,78 +1,78 @@ /* * 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 KisUndoAdapter; class KisNodeQueryPath; 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/krita/image/recorder/kis_recorded_action_factory_registry.h b/krita/image/recorder/kis_recorded_action_factory_registry.h index f87b54174f5..83cd5fdb14f 100644 --- a/krita/image/recorder/kis_recorded_action_factory_registry.h +++ b/krita/image/recorder/kis_recorded_action_factory_registry.h @@ -1,36 +1,36 @@ /* * 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 +#include class KRITAIMAGE_EXPORT KisRecordedActionFactoryRegistry : public KoGenericRegistry { public: KisRecordedActionFactoryRegistry(); ~KisRecordedActionFactoryRegistry(); static KisRecordedActionFactoryRegistry* instance(); }; #endif diff --git a/krita/image/recorder/kis_recorded_action_load_context.h b/krita/image/recorder/kis_recorded_action_load_context.h index 116359ddbde..940fc3123b1 100644 --- a/krita/image/recorder/kis_recorded_action_load_context.h +++ b/krita/image/recorder/kis_recorded_action_load_context.h @@ -1,35 +1,35 @@ /* * 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 "krita_export.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/krita/image/recorder/kis_recorded_action_save_context.h b/krita/image/recorder/kis_recorded_action_save_context.h index 155e0633adf..c52ecf5ce37 100644 --- a/krita/image/recorder/kis_recorded_action_save_context.h +++ b/krita/image/recorder/kis_recorded_action_save_context.h @@ -1,34 +1,34 @@ /* * 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 "krita_export.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/krita/image/recorder/kis_recorded_fill_paint_action.h b/krita/image/recorder/kis_recorded_fill_paint_action.h index 7a443778193..f51475c6960 100644 --- a/krita/image/recorder/kis_recorded_fill_paint_action.h +++ b/krita/image/recorder/kis_recorded_fill_paint_action.h @@ -1,65 +1,65 @@ /* * 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 +#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(); virtual void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const; virtual KisRecordedAction* clone() const; protected: virtual KisPainter* createPainter(KisPaintDeviceSP device) const; virtual void playPaint(const KisPlayInfo& info, KisPainter* painter) const; private: struct Private; Private* const d; }; class KisRecordedFillPaintActionFactory : public KisRecordedPaintActionFactory { public: KisRecordedFillPaintActionFactory(); virtual ~KisRecordedFillPaintActionFactory(); virtual KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*); }; #endif diff --git a/krita/image/recorder/kis_recorded_filter_action.h b/krita/image/recorder/kis_recorded_filter_action.h index d15f34702ca..691b374c4da 100644 --- a/krita/image/recorder/kis_recorded_filter_action.h +++ b/krita/image/recorder/kis_recorded_filter_action.h @@ -1,64 +1,64 @@ /* * 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 +#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 KisFilterConfiguration* config); KisRecordedFilterAction(const KisRecordedFilterAction&); virtual ~KisRecordedFilterAction(); using KisRecordedNodeAction::play; virtual void play(KisNodeSP node, const KisPlayInfo& _info, KoUpdater* _updater = 0) const; virtual void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const; virtual KisRecordedAction* clone() const; const KisFilter* filter() const; const KisFilterConfiguration* filterConfiguration() const; /** * Set the configuration, and takes the ownership of the config object. */ void setFilterConfiguration(KisFilterConfiguration* config); private: struct Private; Private* const d; }; class KisRecordedFilterActionFactory : public KisRecordedActionFactory { public: KisRecordedFilterActionFactory(); virtual ~KisRecordedFilterActionFactory(); virtual KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*); }; #endif diff --git a/krita/image/recorder/kis_recorded_paint_action.h b/krita/image/recorder/kis_recorded_paint_action.h index 1adf0c706d0..7a800ba7d0f 100644 --- a/krita/image/recorder/kis_recorded_paint_action.h +++ b/krita/image/recorder/kis_recorded_paint_action.h @@ -1,110 +1,110 @@ /* * 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 +#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(); virtual void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const; using KisRecordedNodeAction::play; virtual void play(KisNodeSP node, const KisPlayInfo& info, KoUpdater* _updater = 0) const; 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 KisFilterConfiguration * generator); private: struct Private; Private* const d; }; class KisRecordedPaintActionFactory : public KisRecordedActionFactory { public: KisRecordedPaintActionFactory(const QString & id) : KisRecordedActionFactory(id) {} virtual ~KisRecordedPaintActionFactory() {} 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/krita/image/recorder/kis_recorded_path_paint_action.h b/krita/image/recorder/kis_recorded_path_paint_action.h index 494ce16509c..0194c36b3a5 100644 --- a/krita/image/recorder/kis_recorded_path_paint_action.h +++ b/krita/image/recorder/kis_recorded_path_paint_action.h @@ -1,77 +1,77 @@ /* * 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; -#include +#include /** * This class will record the painting of a bezier curve. */ class KRITAIMAGE_EXPORT KisRecordedPathPaintAction : public KisRecordedPaintAction { public: KisRecordedPathPaintAction(const KisNodeQueryPath& path, const KisPaintOpPresetSP paintOpPreset); KisRecordedPathPaintAction(const KisRecordedPathPaintAction&); ~KisRecordedPathPaintAction(); 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); virtual void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const; virtual KisRecordedAction* clone() const; protected: virtual void playPaint(const KisPlayInfo& info, KisPainter* painter) const; private: struct Private; Private* const d; }; class KisRecordedPathPaintActionFactory : public KisRecordedPaintActionFactory { public: KisRecordedPathPaintActionFactory(); virtual ~KisRecordedPathPaintActionFactory(); virtual KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*); }; #endif diff --git a/krita/image/recorder/kis_recorded_shape_paint_action.h b/krita/image/recorder/kis_recorded_shape_paint_action.h index 9ca1634b7bf..af776557c1d 100644 --- a/krita/image/recorder/kis_recorded_shape_paint_action.h +++ b/krita/image/recorder/kis_recorded_shape_paint_action.h @@ -1,72 +1,72 @@ /* * 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 +#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(); virtual void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const; virtual KisRecordedAction* clone() const; protected: virtual void playPaint(const KisPlayInfo& info, KisPainter* painter) const; private: struct Private; Private* const d; }; class KisRecordedShapePaintActionFactory : public KisRecordedPaintActionFactory { public: KisRecordedShapePaintActionFactory(); virtual ~KisRecordedShapePaintActionFactory(); virtual KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*); }; #endif diff --git a/krita/image/tiles3/kis_hline_iterator.h b/krita/image/tiles3/kis_hline_iterator.h index 04d258ab749..034d1ac3b5e 100644 --- a/krita/image/tiles3/kis_hline_iterator.h +++ b/krita/image/tiles3/kis_hline_iterator.h @@ -1,89 +1,89 @@ /* * Copyright (c) 2010 Lukáš Tvrdý * * 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_HLINE_ITERATOR_H_ #define _KIS_HLINE_ITERATOR_H_ #include "kis_base_iterator.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_iterator_ng.h" class KRITAIMAGE_EXPORT KisHLineIterator2 : public KisHLineIteratorNG, public KisBaseIterator { KisHLineIterator2(const KisHLineIterator2&); KisHLineIterator2& operator=(const KisHLineIterator2&); public: struct KisTileInfo { KisTileSP tile; KisTileSP oldtile; quint8* data; quint8* oldData; }; public: KisHLineIterator2(KisDataManager *dataManager, qint32 x, qint32 y, qint32 w, qint32 offsetX, qint32 offsetY, bool writable); ~KisHLineIterator2(); virtual bool nextPixel(); virtual void nextRow(); virtual const quint8* oldRawData() const; virtual const quint8* rawDataConst() const; virtual quint8* rawData(); virtual qint32 nConseqPixels() const; virtual bool nextPixels(qint32 n); virtual qint32 x() const; virtual qint32 y() const; virtual void resetPixelPos(); virtual void resetRowPos(); private: qint32 m_offsetX; qint32 m_offsetY; qint32 m_x; // current x position qint32 m_y; // current y position qint32 m_row; // current row in tilemgr quint32 m_index; // current col in tilemgr quint32 m_tileWidth; quint8 *m_data; quint8 *m_oldData; bool m_havePixels; qint32 m_right; qint32 m_left; qint32 m_top; qint32 m_leftCol; qint32 m_rightCol; qint32 m_rightmostInTile; // limited by the current tile border only qint32 m_leftInLeftmostTile; qint32 m_yInTile; QVector m_tilesCache; quint32 m_tilesCacheSize; private: void switchToTile(qint32 xInTile); void fetchTileDataForCache(KisTileInfo& kti, qint32 col, qint32 row); void preallocateTiles(); }; #endif diff --git a/krita/image/tiles3/kis_tile_data_store.h b/krita/image/tiles3/kis_tile_data_store.h index 396829606a0..f6674cc95de 100644 --- a/krita/image/tiles3/kis_tile_data_store.h +++ b/krita/image/tiles3/kis_tile_data_store.h @@ -1,187 +1,187 @@ /* * Copyright (c) 2009 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_TILE_DATA_STORE_H_ #define KIS_TILE_DATA_STORE_H_ -#include "krita_export.h" +#include "kritaimage_export.h" #include #include "kis_tile_data_interface.h" #include "kis_tile_data_pooler.h" #include "swap/kis_tile_data_swapper.h" #include "swap/kis_swapped_data_store.h" class KisTileDataStoreIterator; class KisTileDataStoreReverseIterator; class KisTileDataStoreClockIterator; /** * Stores tileData objects. When needed compresses them and swaps. */ class KRITAIMAGE_EXPORT KisTileDataStore { private: KisTileDataStore(); public: static KisTileDataStore* instance(); ~KisTileDataStore(); void debugPrintList(); struct MemoryStatistics { qint64 totalMemorySize; qint64 realMemorySize; qint64 historicalMemorySize; qint64 poolSize; qint64 swapSize; }; MemoryStatistics memoryStatistics(); /** * Returns total number of tiles present: in memory * or in a swap file */ inline qint32 numTiles() const { return m_numTiles + m_swappedStore.numTiles(); } /** * Returns the number of tiles present in memory only */ inline qint32 numTilesInMemory() const { return m_numTiles; } inline void checkFreeMemory() { m_swapper.checkFreeMemory(); } /** * \see m_memoryMetric */ inline qint64 memoryMetric() const { return m_memoryMetric; } KisTileDataStoreIterator* beginIteration(); void endIteration(KisTileDataStoreIterator* iterator); KisTileDataStoreReverseIterator* beginReverseIteration(); void endIteration(KisTileDataStoreReverseIterator* iterator); KisTileDataStoreClockIterator* beginClockIteration(); void endIteration(KisTileDataStoreClockIterator* iterator); inline KisTileData* createDefaultTileData(qint32 pixelSize, const quint8 *defPixel) { return allocTileData(pixelSize, defPixel); } // Called by The Memento Manager after every commit inline void kickPooler() { m_pooler.kick(); //FIXME: maybe, rename a function? m_swapper.kick(); } /** * Try swap out the tile data. * It may fail in case the tile is being accessed * at the same moment of time. */ bool trySwapTileData(KisTileData *td); /** * WARN: The following three method are only for usage * in KisTileData. Do not call them directly! */ KisTileData *duplicateTileData(KisTileData *rhs); void freeTileData(KisTileData *td); /** * Ensures that the tile data is totally present in memory * and it's swapping is blocked by holding td->m_swapLock * in a read mode. * PRECONDITIONS: td->m_swapLock is *unlocked* * m_listRWLock is *unlocked* * POSTCONDITIONS: td->m_data is in memory and * td->m_swapLock is locked * m_listRWLock is unlocked */ void ensureTileDataLoaded(KisTileData *td); private: KisTileData *allocTileData(qint32 pixelSize, const quint8 *defPixel); void registerTileData(KisTileData *td); void unregisterTileData(KisTileData *td); inline void registerTileDataImp(KisTileData *td); inline void unregisterTileDataImp(KisTileData *td); void freeRegisteredTiles(); friend class DeadlockyThread; friend class KisLowMemoryTests; void debugSwapAll(); void debugClear(); friend class KisTiledDataManagerTest; void testingSuspendPooler(); void testingResumePooler(); friend class KisLowMemoryBenchmark; void testingRereadConfig(); private: KisTileDataPooler m_pooler; KisTileDataSwapper m_swapper; friend class KisTileDataStoreTest; friend class KisTileDataPoolerTest; KisSwappedDataStore m_swappedStore; KisTileDataListIterator m_clockIterator; QMutex m_listLock; KisTileDataList m_tileDataList; qint32 m_numTiles; /** * This metric is used for computing the volume * of memory occupied by tile data objects. * metric = num_bytes / (KisTileData::WIDTH * KisTileData::HEIGHT) */ qint64 m_memoryMetric; }; template inline T MiB_TO_METRIC(T value) { unsigned long long __MiB = 1ULL << 20; return value * (__MiB / (KisTileData::WIDTH * KisTileData::HEIGHT)); } #endif /* KIS_TILE_DATA_STORE_H_ */ diff --git a/krita/image/tiles3/kis_tiled_data_manager.h b/krita/image/tiles3/kis_tiled_data_manager.h index 014ffaa3fa6..f644a651c6b 100644 --- a/krita/image/tiles3/kis_tiled_data_manager.h +++ b/krita/image/tiles3/kis_tiled_data_manager.h @@ -1,394 +1,394 @@ /* * Copyright (c) 2004 Boudewijn Rempt * (c) 2009 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_TILEDDATAMANAGER_H_ #define KIS_TILEDDATAMANAGER_H_ #include #include #include #include #include //#include "kis_debug.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_tile_hash_table.h" #include "kis_memento_manager.h" #include "kis_memento.h" class KisTiledDataManager; typedef KisSharedPtr KisTiledDataManagerSP; class KisTiledIterator; class KisTiledRandomAccessor; class KisPaintDeviceWriter; class QIODevice; /** * KisTiledDataManager implements the interface that KisDataManager defines * * The interface definition is enforced by KisDataManager calling all the methods * which must also be defined in KisTiledDataManager. It is not allowed to change the interface * as other datamangers may also rely on the same interface. * * * Storing undo/redo data * * Offering ordered and unordered iterators over rects of pixels * * (eventually) efficiently loading and saving data in a format * that may allow deferred loading. * * A datamanager knows nothing about the type of pixel data except * how many quint8's a single pixel takes. */ class KRITAIMAGE_EXPORT KisTiledDataManager : public KisShared { private: static const qint32 LEGACY_VERSION = 1; static const qint32 CURRENT_VERSION = 2; protected: /*FIXME:*/ public: KisTiledDataManager(quint32 pixelSize, const quint8 *defPixel); virtual ~KisTiledDataManager(); KisTiledDataManager(const KisTiledDataManager &dm); KisTiledDataManager & operator=(const KisTiledDataManager &dm); protected: // Allow the baseclass of iterators access to the interior // derived iterator classes must go through KisTiledIterator friend class KisTiledIterator; friend class KisBaseIterator; friend class KisTiledRandomAccessor; friend class KisRandomAccessor2; friend class KisStressJob; public: void setDefaultPixel(const quint8 *defPixel); const quint8 *defaultPixel() const { return m_defaultPixel; } inline KisTileSP getTile(qint32 col, qint32 row, bool writable) { if (writable) { bool newTile; KisTileSP tile = m_hashTable->getTileLazy(col, row, newTile); if (newTile) updateExtent(tile->col(), tile->row()); return tile; } else { return m_hashTable->getReadOnlyTileLazy(col,row); } } inline KisTileSP getOldTile(qint32 col, qint32 row) { KisTileSP tile = m_mementoManager->getCommitedTile(col, row); return tile ? tile : getTile(col, row, false); } KisMementoSP getMemento() { QWriteLocker locker(&m_lock); KisMementoSP memento = m_mementoManager->getMemento(); memento->saveOldDefaultPixel(m_defaultPixel, m_pixelSize); return memento; } /** * Finishes having already started transaction */ void commit() { QWriteLocker locker(&m_lock); KisMementoSP memento = m_mementoManager->currentMemento(); if(memento) { memento->saveNewDefaultPixel(m_defaultPixel, m_pixelSize); } m_mementoManager->commit(); } void rollback(KisMementoSP memento) { commit(); QWriteLocker locker(&m_lock); m_mementoManager->rollback(m_hashTable); const quint8 *defaultPixel = memento->oldDefaultPixel(); if(memcmp(m_defaultPixel, defaultPixel, m_pixelSize)) { setDefaultPixelImpl(defaultPixel); } recalculateExtent(); } void rollforward(KisMementoSP memento) { commit(); QWriteLocker locker(&m_lock); m_mementoManager->rollforward(m_hashTable); const quint8 *defaultPixel = memento->newDefaultPixel(); if(memcmp(m_defaultPixel, defaultPixel, m_pixelSize)) { setDefaultPixelImpl(defaultPixel); } recalculateExtent(); } bool hasCurrentMemento() const { return m_mementoManager->hasCurrentMemento(); //return true; } /** * Removes all the history that preceds the revision * pointed by oldestMemento. That is after calling to * purgeHistory(someMemento) you won't be able to do * rollback(someMemento) anymore. */ void purgeHistory(KisMementoSP oldestMemento) { QWriteLocker locker(&m_lock); m_mementoManager->purgeHistory(oldestMemento); } static void releaseInternalPools(); protected: /** * Reads and writes the tiles */ bool write(KisPaintDeviceWriter &store); bool read(QIODevice *stream); void purge(const QRect& area); inline quint32 pixelSize() const { return m_pixelSize; } /* FIXME:*/ public: void extent(qint32 &x, qint32 &y, qint32 &w, qint32 &h) const; void setExtent(qint32 x, qint32 y, qint32 w, qint32 h); QRect extent() const; void setExtent(QRect newRect); QRegion region() const; void clear(QRect clearRect, quint8 clearValue); void clear(QRect clearRect, const quint8 *clearPixel); void clear(qint32 x, qint32 y, qint32 w, qint32 h, quint8 clearValue); void clear(qint32 x, qint32 y, qint32 w, qint32 h, const quint8 *clearPixel); void clear(); /** * Clones rect from another datamanager. The cloned area will be * shared between both datamanagers as much as possible using * copy-on-write. Parts of the rect that cannot be shared * (cross tiles) are deep-copied, */ void bitBlt(KisTiledDataManager *srcDM, const QRect &rect); /** * The same as \ref bitBlt(), but reads old data */ void bitBltOldData(KisTiledDataManager *srcDM, const QRect &rect); /** * Clones rect from another datamanager in a rough and fast way. * All the tiles touched by rect will be shared, between both * managers, that means it will copy a bigger area than was * requested. This method is supposed to be used for bitBlt'ing * into temporary paint devices. */ void bitBltRough(KisTiledDataManager *srcDM, const QRect &rect); /** * The same as \ref bitBltRough(), but reads old data */ void bitBltRoughOldData(KisTiledDataManager *srcDM, const QRect &rect); /** * write the specified data to x, y. There is no checking on pixelSize! */ void setPixel(qint32 x, qint32 y, const quint8 * data); /** * Copy the bytes in the specified rect to a vector. The caller is responsible * for managing the vector. * * \param dataRowStride is the step (in bytes) which should be * added to \p bytes pointer to get to the * next row */ void readBytes(quint8 * bytes, qint32 x, qint32 y, qint32 w, qint32 h, qint32 dataRowStride = -1) const; /** * Copy the bytes in the vector to the specified rect. If there are bytes left * in the vector after filling the rect, they will be ignored. If there are * not enough bytes, the rest of the rect will be filled with the default value * given (by default, 0); * * \param dataRowStride is the step (in bytes) which should be * added to \p bytes pointer to get to the * next row */ void writeBytes(const quint8 * bytes, qint32 x, qint32 y, qint32 w, qint32 h, qint32 dataRowStride = -1); /** * Copy the bytes in the paint device into a vector of arrays of bytes, * where the number of arrays is the number of channels in the * paint device. If the specified area is larger than the paint * device's extent, the default pixel will be read. */ QVector readPlanarBytes(QVector channelsizes, qint32 x, qint32 y, qint32 w, qint32 h) const; /** * Write the data in the separate arrays to the channels. If there * are less vectors than channels, the remaining channels will not * be copied. If any of the arrays points to 0, the channel in * that location will not be touched. If the specified area is * larger than the paint device, the paint device will be * extended. There are no guards: if the area covers more pixels * than there are bytes in the arrays, krita will happily fill * your paint device with areas of memory you never wanted to be * read. Krita may also crash. */ void writePlanarBytes(QVector planes, QVector channelsizes, qint32 x, qint32 y, qint32 w, qint32 h); /** * Get the number of contiguous columns starting at x, valid for all values * of y between minY and maxY. */ qint32 numContiguousColumns(qint32 x, qint32 minY, qint32 maxY) const; /** * Get the number of contiguous rows starting at y, valid for all values * of x between minX and maxX. */ qint32 numContiguousRows(qint32 y, qint32 minX, qint32 maxX) const; /** * Get the row stride at pixel (x, y). This is the number of bytes to add to a * pointer to pixel (x, y) to access (x, y + 1). */ qint32 rowStride(qint32 x, qint32 y) const; private: KisTileHashTable *m_hashTable; KisMementoManager *m_mementoManager; quint8* m_defaultPixel; qint32 m_pixelSize; /** * Extents stuff */ qint32 m_extentMinX; qint32 m_extentMaxX; qint32 m_extentMinY; qint32 m_extentMaxY; mutable QReadWriteLock m_lock; private: // Allow compression routines to calculate (col,row) coordinates // and pixel size friend class KisAbstractTileCompressor; friend class KisTileDataWrapper; qint32 xToCol(qint32 x) const; qint32 yToRow(qint32 y) const; private: void setDefaultPixelImpl(const quint8 *defPixel); QRect extentImpl() const; bool writeTilesHeader(KisPaintDeviceWriter &store, quint32 numTiles); bool processTilesHeader(QIODevice *stream, quint32 &numTiles); qint32 divideRoundDown(qint32 x, const qint32 y) const; void updateExtent(qint32 col, qint32 row); void recalculateExtent(); quint8* duplicatePixel(qint32 num, const quint8 *pixel); template void bitBltImpl(KisTiledDataManager *srcDM, const QRect &rect); template void bitBltRoughImpl(KisTiledDataManager *srcDM, const QRect &rect); void writeBytesBody(const quint8 *data, qint32 x, qint32 y, qint32 width, qint32 height, qint32 dataRowStride = -1); void readBytesBody(quint8 *data, qint32 x, qint32 y, qint32 width, qint32 height, qint32 dataRowStride = -1) const; template void writePlanarBytesBody(QVector planes, QVector channelsizes, qint32 x, qint32 y, qint32 w, qint32 h); QVector readPlanarBytesBody(QVector channelsizes, qint32 x, qint32 y, qint32 w, qint32 h) const; public: void debugPrintInfo() { m_mementoManager->debugPrintInfo(); } }; inline qint32 KisTiledDataManager::divideRoundDown(qint32 x, const qint32 y) const { /** * Equivalent to the following: * -(( -x + (y-1) ) / y) */ return x >= 0 ? x / y : -(((-x - 1) / y) + 1); } inline qint32 KisTiledDataManager::xToCol(qint32 x) const { return divideRoundDown(x, KisTileData::WIDTH); } inline qint32 KisTiledDataManager::yToRow(qint32 y) const { return divideRoundDown(y, KisTileData::HEIGHT); } // during development the following line helps to check the interface is correct // it should be safe to keep it here even during normal compilation //#include "kis_datamanager.h" #endif // KIS_TILEDDATAMANAGER_H_ diff --git a/krita/image/tiles3/kis_vline_iterator.h b/krita/image/tiles3/kis_vline_iterator.h index d5a6563b9c8..875dffb5799 100644 --- a/krita/image/tiles3/kis_vline_iterator.h +++ b/krita/image/tiles3/kis_vline_iterator.h @@ -1,90 +1,90 @@ /* * Copyright (c) 2010 Lukáš Tvrdý * 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_VLINE_ITERATOR_H_ #define _KIS_VLINE_ITERATOR_H_ #include "kis_base_iterator.h" -#include "krita_export.h" +#include "kritaimage_export.h" #include "kis_iterator_ng.h" class KRITAIMAGE_EXPORT KisVLineIterator2 : public KisVLineIteratorNG, KisBaseIterator { KisVLineIterator2(const KisVLineIterator2&); KisVLineIterator2& operator=(const KisVLineIterator2&); public: struct KisTileInfo { KisTileSP tile; KisTileSP oldtile; quint8* data; quint8* oldData; }; public: KisVLineIterator2(KisDataManager *dataManager, qint32 x, qint32 y, qint32 h, qint32 offsetX, qint32 offsetY, bool writable); ~KisVLineIterator2(); virtual void resetPixelPos(); virtual void resetColumnPos(); virtual bool nextPixel(); virtual void nextColumn(); virtual const quint8* rawDataConst() const; virtual const quint8* oldRawData() const; virtual quint8* rawData(); virtual qint32 nConseqPixels() const; virtual bool nextPixels(qint32 n); virtual qint32 x() const; virtual qint32 y() const; private: qint32 m_offsetX; qint32 m_offsetY; qint32 m_x; // current x position qint32 m_y; // current y position qint32 m_column; // current column in tilemgr qint32 m_index; // current row in tilemgr qint32 m_tileSize; quint8 *m_data; quint8 *m_dataBottom; quint8 *m_oldData; bool m_havePixels; qint32 m_top; qint32 m_bottom; qint32 m_left; qint32 m_topRow; qint32 m_bottomRow; qint32 m_topInTopmostTile; qint32 m_xInTile; qint32 m_lineStride; QVector m_tilesCache; qint32 m_tilesCacheSize; private: void switchToTile(qint32 xInTile); void fetchTileDataForCache(KisTileInfo& kti, qint32 col, qint32 row); void preallocateTiles(); }; #endif diff --git a/krita/image/tiles3/swap/kis_abstract_compression.h b/krita/image/tiles3/swap/kis_abstract_compression.h index b05a6b296dc..31e7ca0a73f 100644 --- a/krita/image/tiles3/swap/kis_abstract_compression.h +++ b/krita/image/tiles3/swap/kis_abstract_compression.h @@ -1,87 +1,88 @@ /* * Copyright (c) 2010 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_ABSTRACT_COMPRESSION_H #define __KIS_ABSTRACT_COMPRESSION_H -#include "krita_export.h" +#include "kritaimage_export.h" +#include /** * Base class for compression operations */ class KRITAIMAGE_EXPORT KisAbstractCompression { public: KisAbstractCompression(); virtual ~KisAbstractCompression(); /** * Compresses \a input buffer into \a output buffer. * WARNING: Be careful, output buffer must be at least * outputBufferSize(inputLength) size! * \param outputLength is not used! * \return number of bytes written to the output buffer * and 0 if error occurred. * * \see outputBufferSize() */ virtual qint32 compress(const quint8* input, qint32 inputLength, quint8* output, qint32 outputLength) = 0; /** * Decompresses \a input buffer into \a output buffer. * WARNING: output buffer must be able to fit the input data * \param outputLength is not used! * \return number of bytes written to the output buffer * and 0 if error occurred. */ virtual qint32 decompress(const quint8* input, qint32 inputLength, quint8* output, qint32 outputLength) = 0; /** * Returns minimal allowed size of output buffer for compression */ virtual qint32 outputBufferSize(qint32 dataSize) = 0; /** * Some algorithms may decide to optimize them work depending on * the usual size of the data. * Default implementation of KisAbstractCompression class does nothing. */ virtual void adjustForDataSize(qint32 dataSize); public: /** * Additional interface for jumbling color channels order */ /** * e.g. RGBARGBARGBA -> RRRGGGBBBAAA * NOTE: performs mixing of bytes, not channels! */ static void linearizeColors(quint8 *input, quint8 *output, qint32 dataSize, qint32 pixelSize); /** * e.g. RRRGGGBBBAAA -> RGBARGBARGBA * NOTE: performs mixing of bytes, not channels! */ static void delinearizeColors(quint8 *input, quint8 *output, qint32 dataSize, qint32 pixelSize); }; #endif /* __KIS_ABSTRACT_COMPRESSION_H */ diff --git a/krita/image/tiles3/swap/kis_abstract_tile_compressor.h b/krita/image/tiles3/swap/kis_abstract_tile_compressor.h index 3124c5aeba3..d5cbdfb6cd4 100644 --- a/krita/image/tiles3/swap/kis_abstract_tile_compressor.h +++ b/krita/image/tiles3/swap/kis_abstract_tile_compressor.h @@ -1,103 +1,103 @@ /* * Copyright (c) 2010 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_ABSTRACT_TILE_COMPRESSOR_H #define __KIS_ABSTRACT_TILE_COMPRESSOR_H -#include "krita_export.h" +#include "kritaimage_export.h" #include "../kis_tile.h" #include "../kis_tiled_data_manager.h" class KisPaintDeviceWriter; /** * Base class for compressing a tile and wrapping it with a header */ class KisAbstractTileCompressor; typedef KisSharedPtr KisAbstractTileCompressorSP; class KRITAIMAGE_EXPORT KisAbstractTileCompressor : public KisShared { public: KisAbstractTileCompressor(); virtual ~KisAbstractTileCompressor(); public: /** * Compresses the \a tile and writes it into the \a stream. * Used by datamanager in load/save routines * * \see compressTile() */ virtual bool writeTile(KisTileSP tile, KisPaintDeviceWriter &store) = 0; /** * Decompresses the \a tile from the \a stream. * Used by datamanager in load/save routines * * \see decompressTile() */ virtual bool readTile(QIODevice *stream, KisTiledDataManager *dm) = 0; /** * Compresses a \a tileData and writes it into the \a buffer. * The buffer must be at least tileDataBufferSize() bytes long. * Actual number of bytes written is returned using out-parameter * \a bytesWritten * * \param tileData an existing tile data. It should be created * and acquired by the caller. * * \see tileDataBufferSize() */ virtual void compressTileData(KisTileData *tileData,quint8 *buffer, qint32 bufferSize, qint32 &bytesWritten) = 0; /** * Decompresses a \a tileData from a given \a buffer. * * \param tileData an existing tile data wrere the result * will be written to. It should be created and acquired * by the caller. * */ virtual bool decompressTileData(quint8 *buffer, qint32 bufferSize, KisTileData *tileData) = 0; /** * Return the number of bytes needed for compressing one tile */ virtual qint32 tileDataBufferSize(KisTileData *tileData) = 0; protected: inline qint32 xToCol(KisTiledDataManager *dm, qint32 x) { return dm->xToCol(x); } inline qint32 yToRow(KisTiledDataManager *dm, qint32 y) { return dm->yToRow(y); } inline qint32 pixelSize(KisTiledDataManager *dm) { return dm->pixelSize(); } }; #endif /* __KIS_ABSTRACT_TILE_COMPRESSOR_H */ diff --git a/krita/image/tiles3/swap/kis_chunk_allocator.h b/krita/image/tiles3/swap/kis_chunk_allocator.h index cec96612d11..084d61acd93 100644 --- a/krita/image/tiles3/swap/kis_chunk_allocator.h +++ b/krita/image/tiles3/swap/kis_chunk_allocator.h @@ -1,164 +1,164 @@ /* * Copyright (c) 2010 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_CHUNK_LIST_H #define __KIS_CHUNK_LIST_H -#include "krita_export.h" +#include "kritaimage_export.h" #include #define MiB (1ULL << 20) #define DEFAULT_STORE_SIZE (4096*MiB) #define DEFAULT_SLAB_SIZE (64*MiB) //#define DEBUG_SLAB_FAILS #ifdef DEBUG_SLAB_FAILS #define WINDOW_SIZE 2000 #define DECLARE_FAIL_COUNTER() quint64 __failCount #define INIT_FAIL_COUNTER() __failCount = 0 #define START_COUNTING() quint64 __numSteps = 0 #define REGISTER_STEP() if(++__numSteps > WINDOW_SIZE) {__numSteps=0; __failCount++;} #define REGISTER_FAIL() __failCount++ #define DEBUG_FAIL_COUNTER() qDebug() << "Slab fail count:\t" << __failCount #else #define DECLARE_FAIL_COUNTER() #define INIT_FAIL_COUNTER() #define START_COUNTING() #define REGISTER_STEP() #define REGISTER_FAIL() #define DEBUG_FAIL_COUNTER() #endif /* DEBUG_SLAB_FAILS */ class KisChunkData; typedef QLinkedList KisChunkDataList; typedef KisChunkDataList::iterator KisChunkDataListIterator; class KisChunkData { public: KisChunkData(quint64 begin, quint64 size) { setChunk(begin, size); } inline void setChunk(quint64 begin, quint64 size) { m_begin = begin; m_end = begin + size - 1; } inline quint64 size() const { return m_end - m_begin +1; } bool operator== (const KisChunkData& other) const { Q_ASSERT(m_begin!=other.m_begin || m_end==other.m_end); /** * Chunks cannot overlap, so it is enough to check * the beginning of the interval only */ return m_begin == other.m_begin; } quint64 m_begin; quint64 m_end; }; class KisChunk { public: KisChunk() {} KisChunk(KisChunkDataListIterator iterator) : m_iterator(iterator) { } inline quint64 begin() const { return m_iterator->m_begin; } inline quint64 end() const { return m_iterator->m_end; } inline quint64 size() const { return m_iterator->size(); } inline KisChunkDataListIterator position() { return m_iterator; } inline const KisChunkData& data() { return *m_iterator; } private: KisChunkDataListIterator m_iterator; }; class KRITAIMAGE_EXPORT KisChunkAllocator { public: KisChunkAllocator(quint64 slabSize = DEFAULT_SLAB_SIZE, quint64 storeSize = DEFAULT_STORE_SIZE); ~KisChunkAllocator(); inline quint64 numChunks() const { return m_list.size(); } KisChunk getChunk(quint64 size); void freeChunk(KisChunk chunk); void debugChunks(); bool sanityCheck(bool pleaseCrash = true); qreal debugFragmentation(bool toStderr = true); private: bool tryInsertChunk(KisChunkDataList &list, KisChunkDataListIterator &iterator, quint64 size); private: quint64 m_storeMaxSize; quint64 m_storeSlabSize; KisChunkDataList m_list; KisChunkDataListIterator m_iterator; quint64 m_storeSize; DECLARE_FAIL_COUNTER() }; #endif /* __KIS_CHUNK_ALLOCATOR_H */ diff --git a/krita/image/tiles3/swap/kis_memory_window.h b/krita/image/tiles3/swap/kis_memory_window.h index c0f8dee92bd..1d8c5649780 100644 --- a/krita/image/tiles3/swap/kis_memory_window.h +++ b/krita/image/tiles3/swap/kis_memory_window.h @@ -1,83 +1,83 @@ /* * Copyright (c) 2010 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_MEMORY_WINDOW_H #define __KIS_MEMORY_WINDOW_H -#include "krita_export.h" +#include "kritaimage_export.h" #include #include "kis_chunk_allocator.h" #define DEFAULT_WINDOW_SIZE (16*MiB) class KRITAIMAGE_EXPORT KisMemoryWindow { public: /** * @param swapDir. If the dir doesn't exist, it'll be created, if it's empty QDir::tempPath will be used. */ KisMemoryWindow(const QString &swapDir, quint64 writeWindowSize = DEFAULT_WINDOW_SIZE); ~KisMemoryWindow(); inline quint8* getReadChunkPtr(KisChunk readChunk) { return getReadChunkPtr(readChunk.data()); } inline quint8* getWriteChunkPtr(KisChunk writeChunk) { return getWriteChunkPtr(writeChunk.data()); } quint8* getReadChunkPtr(const KisChunkData &readChunk); quint8* getWriteChunkPtr(const KisChunkData &writeChunk); private: struct MappingWindow { MappingWindow(quint64 _defaultSize) : chunk(0,0), window(0), defaultSize(_defaultSize) { } quint8* calculatePointer(const KisChunkData &other) const { return window + other.m_begin - chunk.m_begin; } KisChunkData chunk; quint8 *window; const quint64 defaultSize; }; private: void adjustWindow(const KisChunkData &requestedChunk, MappingWindow *adjustingWindow, MappingWindow *otherWindow); private: QTemporaryFile m_file; MappingWindow m_readWindowEx; MappingWindow m_writeWindowEx; }; #endif /* __KIS_MEMORY_WINDOW_H */ diff --git a/krita/image/tiles3/swap/kis_swapped_data_store.h b/krita/image/tiles3/swap/kis_swapped_data_store.h index fd416b8adcc..5862203784d 100644 --- a/krita/image/tiles3/swap/kis_swapped_data_store.h +++ b/krita/image/tiles3/swap/kis_swapped_data_store.h @@ -1,92 +1,92 @@ /* * Copyright (c) 2010 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_SWAPPED_DATA_STORE_H #define __KIS_SWAPPED_DATA_STORE_H -#include "krita_export.h" +#include "kritaimage_export.h" #include #include class QMutex; class KisTileData; class KisAbstractTileCompressor; class KisChunkAllocator; class KisMemoryWindow; class KRITAIMAGE_EXPORT KisSwappedDataStore { public: KisSwappedDataStore(); ~KisSwappedDataStore(); /** * Returns number of swapped out tile data objects */ quint64 numTiles() const; /** * Swap out the data stored in the \a td to the swap file * and free memory occupied by td->data(). * LOCKING: the lock on the tile data should be taken * by the caller before making a call. */ void swapOutTileData(KisTileData *td); /** * Restore the data of a \a td basing on information * stored in the swap file. * LOCKING: the lock on the tile data should be taken * by the caller before making a call. */ void swapInTileData(KisTileData *td); /** * Forget all the information linked with the tile data. * This should be done before deleting of the tile data, * whose actual data is swapped-out */ void forgetTileData(KisTileData *td); /** * Retorns the metric of the total memory stored in the swap * in *uncompressed* form! */ qint64 totalMemoryMetric() const; /** * Some debugging output */ void debugStatistics(); private: QByteArray m_buffer; KisAbstractTileCompressor *m_compressor; KisChunkAllocator *m_allocator; KisMemoryWindow *m_swapSpace; QMutex m_lock; qint64 m_memoryMetric; }; #endif /* __KIS_SWAPPED_DATA_STORE_H */ diff --git a/krita/image/tiles3/swap/kis_tile_data_swapper.h b/krita/image/tiles3/swap/kis_tile_data_swapper.h index 0d2d1dcf41a..7488d7da226 100644 --- a/krita/image/tiles3/swap/kis_tile_data_swapper.h +++ b/krita/image/tiles3/swap/kis_tile_data_swapper.h @@ -1,64 +1,64 @@ /* * Copyright (c) 2010 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_TILE_DATA_SWAPPER_H_ #define KIS_TILE_DATA_SWAPPER_H_ #include #include -#include "krita_export.h" +#include "kritaimage_export.h" class KisTileDataStore; class KisTileData; class KRITAIMAGE_EXPORT KisTileDataSwapper : public QThread { Q_OBJECT public: KisTileDataSwapper(KisTileDataStore *store); virtual ~KisTileDataSwapper(); void kick(); void terminateSwapper(); void checkFreeMemory(); void testingRereadConfig(); private: void waitForWork(); void run(); void doJob(); template qint64 pass(qint64 needToFreeMetric); private: static const qint32 TIMEOUT; static const qint32 DELAY; private: struct Private; Private * const m_d; }; #endif /* KIS_TILE_DATA_SWAPPER_H_ */ diff --git a/krita/libglobal/kis_assert.h b/krita/libglobal/kis_assert.h index 533ad669826..6222e74a2df 100644 --- a/krita/libglobal/kis_assert.h +++ b/krita/libglobal/kis_assert.h @@ -1,108 +1,108 @@ /* * 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_ASSERT_H #define __KIS_ASSERT_H #include -#include +#include KRITAIMAGE_EXPORT void kis_assert_exception(const char *assertion, const char *file, int line); KRITAIMAGE_EXPORT void kis_assert_recoverable(const char *assertion, const char *file, int line); KRITAIMAGE_EXPORT void kis_assert_x_exception(const char *assertion, const char *where, const char *what, const char *file, int line); /** * KIS_ASSERT family of macros allows the user to choose whether to * try to continue working in Krita or to abort an application and see * a backtrace. * * Note, the macro are present in Release mode by default! */ /** * Checks the condition and depending on the user action either aborts * the program or throws an exception, which restarts event loop. */ #define KIS_ASSERT(cond) ((!(cond)) ? kis_assert_exception(#cond,__FILE__,__LINE__) : qt_noop()) /** * Same as KIS_ASSERT, but allows to show more text to the user. * * \see KIS_ASSERT */ #define KIS_ASSERT_X(cond, where, what) ((!(cond)) ? kis_assert_x_exception(#cond,where, what,__FILE__,__LINE__) : qt_noop()) /** * This is a recoverable variant of KIS_ASSERT. It doesn't throw any * exceptions. It checks the condition, and either aborts the * application, or executes user-supplied code. The typical usecase is * the following: * * int fooBar = ...; * KIS_ASSERT_RECOVER (fooBar > 0) { * // the code which is executed in a case of emergency * } * */ #define KIS_ASSERT_RECOVER(cond) if (!(cond) && (kis_assert_recoverable(#cond,__FILE__,__LINE__), true)) /** * Equivalent of the following: * * KIS_ASSERT_RECOVER(cond) { * break; * } * */ #define KIS_ASSERT_RECOVER_BREAK(cond) KIS_ASSERT_RECOVER(cond) { break; } /** * Equivalent of the following: * * KIS_ASSERT_RECOVER(cond) { * return; * } * */ #define KIS_ASSERT_RECOVER_RETURN(cond) KIS_ASSERT_RECOVER(cond) { return; } /** * Equivalent of the following: * * KIS_ASSERT_RECOVER(cond) { * return val; * } * */ #define KIS_ASSERT_RECOVER_RETURN_VALUE(cond, val) KIS_ASSERT_RECOVER(cond) { return (val); } /** * Does nothing in case of a failure. Just continues execution. * * Equivalent of the following: * * KIS_ASSERT_RECOVER(cond) { * qt_noop(); * } * */ #define KIS_ASSERT_RECOVER_NOOP(cond) KIS_ASSERT_RECOVER(cond) { qt_noop(); } #endif /* __KIS_ASSERT_H */