From 63995c6f0a4cf07692b3a53627680715e91896d1 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 20 Oct 2014 22:21:31 -0300 Subject: [PATCH] Merge "raster" namespace into "doc" library --- src/CMakeLists.txt | 5 +- src/README.md | 7 +- src/app/app.cpp | 8 +- src/app/app.h | 6 +- src/app/color.cpp | 8 +- src/app/color.h | 8 +- src/app/color_picker.cpp | 14 +- src/app/color_target.h | 20 +- src/app/color_utils.cpp | 26 +-- src/app/color_utils.h | 12 +- .../commands/cmd_background_from_layer.cpp | 4 +- src/app/commands/cmd_canvas_size.cpp | 6 +- src/app/commands/cmd_cel_properties.cpp | 10 +- src/app/commands/cmd_change_pixel_format.cpp | 6 +- src/app/commands/cmd_clear.cpp | 4 +- src/app/commands/cmd_clear_cel.cpp | 6 +- src/app/commands/cmd_close_file.cpp | 2 +- src/app/commands/cmd_configure_tools.cpp | 2 +- src/app/commands/cmd_copy.cpp | 6 +- src/app/commands/cmd_crop.cpp | 8 +- src/app/commands/cmd_cut.cpp | 6 +- src/app/commands/cmd_deselect_mask.cpp | 4 +- src/app/commands/cmd_duplicate_layer.cpp | 4 +- src/app/commands/cmd_duplicate_sprite.cpp | 2 +- src/app/commands/cmd_export_sprite_sheet.cpp | 16 +- src/app/commands/cmd_eyedropper.cpp | 4 +- src/app/commands/cmd_flatten_layers.cpp | 2 +- src/app/commands/cmd_flip.cpp | 34 ++-- src/app/commands/cmd_flip.h | 6 +- src/app/commands/cmd_frame_properties.cpp | 2 +- src/app/commands/cmd_goto_frame.cpp | 2 +- src/app/commands/cmd_goto_layer.cpp | 4 +- src/app/commands/cmd_import_sprite_sheet.cpp | 16 +- src/app/commands/cmd_invert_mask.cpp | 12 +- .../commands/cmd_layer_from_background.cpp | 4 +- src/app/commands/cmd_layer_properties.cpp | 4 +- src/app/commands/cmd_load_mask.cpp | 4 +- src/app/commands/cmd_load_palette.cpp | 4 +- src/app/commands/cmd_mask_all.cpp | 4 +- src/app/commands/cmd_mask_by_color.cpp | 6 +- src/app/commands/cmd_merge_down_layer.cpp | 18 +- src/app/commands/cmd_move_mask.cpp | 4 +- src/app/commands/cmd_new_file.cpp | 18 +- src/app/commands/cmd_new_frame.cpp | 8 +- src/app/commands/cmd_new_layer.cpp | 4 +- src/app/commands/cmd_new_layer_set.cpp | 4 +- src/app/commands/cmd_open_file.cpp | 2 +- src/app/commands/cmd_options.cpp | 2 +- src/app/commands/cmd_palette_editor.cpp | 14 +- src/app/commands/cmd_paste.cpp | 4 +- src/app/commands/cmd_play_animation.cpp | 6 +- src/app/commands/cmd_preview.cpp | 16 +- src/app/commands/cmd_remove_frame.cpp | 2 +- src/app/commands/cmd_remove_layer.cpp | 4 +- src/app/commands/cmd_reselect_mask.cpp | 4 +- src/app/commands/cmd_rotate.cpp | 14 +- src/app/commands/cmd_save_file.cpp | 2 +- src/app/commands/cmd_save_mask.cpp | 4 +- src/app/commands/cmd_save_palette.cpp | 4 +- src/app/commands/cmd_set_palette.cpp | 2 +- src/app/commands/cmd_set_palette.h | 6 +- src/app/commands/cmd_sprite_properties.cpp | 6 +- src/app/commands/cmd_sprite_size.cpp | 22 +-- src/app/commands/cmd_undo.cpp | 2 +- src/app/commands/filters/cmd_color_curve.cpp | 4 +- .../filters/cmd_convolution_matrix.cpp | 4 +- src/app/commands/filters/cmd_despeckle.cpp | 4 +- src/app/commands/filters/cmd_invert_color.cpp | 6 +- .../commands/filters/cmd_replace_color.cpp | 6 +- .../commands/filters/filter_manager_impl.cpp | 14 +- .../commands/filters/filter_manager_impl.h | 12 +- src/app/commands/filters/filter_preview.cpp | 2 +- .../filters/filter_target_buttons.cpp | 2 +- src/app/commands/filters/filter_worker.cpp | 2 +- src/app/context_flags.cpp | 8 +- src/app/document.cpp | 14 +- src/app/document.h | 8 +- src/app/document_api.cpp | 60 +++--- src/app/document_api.h | 25 ++- src/app/document_exporter.cpp | 16 +- src/app/document_exporter.h | 6 +- src/app/document_location.cpp | 10 +- src/app/document_location.h | 8 +- src/app/document_range.cpp | 2 +- src/app/document_range.h | 6 +- src/app/document_range_ops.cpp | 4 +- src/app/document_range_tests.cpp | 8 +- src/app/document_undo.h | 4 +- src/app/file/ase_format.cpp | 2 +- src/app/file/bmp_format.cpp | 2 +- src/app/file/file.cpp | 4 +- src/app/file/file.h | 8 +- src/app/file/file_tests.cpp | 4 +- src/app/file/fli_format.cpp | 2 +- src/app/file/gif_format.cpp | 14 +- src/app/file/gif_options.h | 10 +- src/app/file/gif_tests.cpp | 16 +- src/app/file/ico_format.cpp | 2 +- src/app/file/jpeg_format.cpp | 2 +- src/app/file/palette_file.cpp | 24 +-- src/app/file/palette_file.h | 6 +- src/app/file/pcx_format.cpp | 2 +- src/app/file/png_format.cpp | 2 +- src/app/file/tga_format.cpp | 2 +- src/app/flatten.cpp | 18 +- src/app/flatten.h | 4 +- src/app/handle_anidir.cpp | 8 +- src/app/handle_anidir.h | 10 +- src/app/modules/gfx.cpp | 6 +- src/app/modules/gfx.h | 2 +- src/app/modules/gui.cpp | 2 +- src/app/modules/palettes.cpp | 8 +- src/app/modules/palettes.h | 4 +- src/app/res/palette_resource.h | 8 +- src/app/res/palettes_loader_delegate.cpp | 4 +- src/app/settings/document_settings.h | 6 +- src/app/settings/settings.h | 4 +- src/app/settings/settings_observers.h | 4 +- src/app/settings/ui_settings_impl.cpp | 14 +- src/app/test_context.h | 2 +- src/app/thumbnail_generator.cpp | 14 +- src/app/tools/ink_processing.h | 6 +- src/app/tools/inks.h | 2 +- src/app/tools/intertwine.cpp | 4 +- src/app/tools/intertwiners.h | 4 +- src/app/tools/point_shape.cpp | 4 +- src/app/tools/point_shapes.h | 2 +- src/app/tools/shade_table.cpp | 2 +- src/app/tools/tool_box.cpp | 10 +- src/app/tools/tool_loop.h | 4 +- src/app/tools/tool_loop_manager.cpp | 8 +- src/app/ui/color_bar.cpp | 4 +- src/app/ui/color_bar.h | 2 +- src/app/ui/color_button.cpp | 2 +- src/app/ui/color_button.h | 2 +- src/app/ui/color_selector.cpp | 14 +- src/app/ui/context_bar.cpp | 12 +- src/app/ui/document_view.cpp | 4 +- src/app/ui/editor/cursor.cpp | 14 +- src/app/ui/editor/drawing_state.cpp | 2 +- src/app/ui/editor/editor.cpp | 4 +- src/app/ui/editor/editor.h | 4 +- src/app/ui/editor/editor_decorator.h | 4 +- src/app/ui/editor/moving_cel_state.cpp | 8 +- src/app/ui/editor/moving_cel_state.h | 2 +- src/app/ui/editor/moving_pixels_state.cpp | 6 +- src/app/ui/editor/moving_pixels_state.h | 2 +- src/app/ui/editor/pixels_movement.cpp | 28 +-- src/app/ui/editor/pixels_movement.h | 10 +- src/app/ui/editor/scrolling_state.cpp | 2 +- src/app/ui/editor/select_box_state.cpp | 12 +- src/app/ui/editor/standby_state.cpp | 8 +- src/app/ui/editor/tool_loop_impl.cpp | 10 +- src/app/ui/editor/zooming_state.cpp | 2 +- src/app/ui/mini_editor.cpp | 2 +- src/app/ui/palette_popup.cpp | 4 +- src/app/ui/palette_popup.h | 2 +- src/app/ui/palette_view.cpp | 6 +- src/app/ui/palettes_listbox.cpp | 16 +- src/app/ui/palettes_listbox.h | 6 +- src/app/ui/resources_listbox.cpp | 8 +- src/app/ui/status_bar.cpp | 10 +- src/app/ui/status_bar.h | 2 +- src/app/ui/timeline.cpp | 4 +- src/app/ui/timeline.h | 10 +- src/app/ui_context.cpp | 2 +- src/app/undo_transaction.cpp | 2 +- src/app/undo_transaction.h | 4 +- src/app/undoers/add_cel.cpp | 6 +- src/app/undoers/add_cel.h | 8 +- src/app/undoers/add_frame.cpp | 2 +- src/app/undoers/add_frame.h | 10 +- src/app/undoers/add_image.cpp | 4 +- src/app/undoers/add_image.h | 6 +- src/app/undoers/add_layer.cpp | 2 +- src/app/undoers/add_layer.h | 8 +- src/app/undoers/add_palette.cpp | 2 +- src/app/undoers/add_palette.h | 8 +- src/app/undoers/close_group.cpp | 2 +- src/app/undoers/close_group.h | 8 +- src/app/undoers/dirty_area.cpp | 10 +- src/app/undoers/dirty_area.h | 6 +- src/app/undoers/flip_image.cpp | 12 +- src/app/undoers/flip_image.h | 8 +- src/app/undoers/image_area.cpp | 2 +- src/app/undoers/image_area.h | 6 +- src/app/undoers/move_layer.cpp | 2 +- src/app/undoers/move_layer.h | 10 +- src/app/undoers/open_group.cpp | 4 +- src/app/undoers/open_group.h | 8 +- src/app/undoers/remap_palette.cpp | 4 +- src/app/undoers/remap_palette.h | 8 +- src/app/undoers/remove_cel.cpp | 14 +- src/app/undoers/remove_cel.h | 6 +- src/app/undoers/remove_frame.cpp | 4 +- src/app/undoers/remove_frame.h | 10 +- src/app/undoers/remove_image.cpp | 12 +- src/app/undoers/remove_image.h | 6 +- src/app/undoers/remove_layer.cpp | 26 +-- src/app/undoers/remove_layer.h | 10 +- src/app/undoers/remove_palette.cpp | 10 +- src/app/undoers/remove_palette.h | 8 +- src/app/undoers/replace_image.cpp | 10 +- src/app/undoers/replace_image.h | 6 +- src/app/undoers/set_cel_frame.cpp | 4 +- src/app/undoers/set_cel_frame.h | 10 +- src/app/undoers/set_cel_opacity.cpp | 2 +- src/app/undoers/set_cel_opacity.h | 6 +- src/app/undoers/set_cel_position.cpp | 2 +- src/app/undoers/set_cel_position.h | 6 +- src/app/undoers/set_frame_duration.cpp | 2 +- src/app/undoers/set_frame_duration.h | 8 +- src/app/undoers/set_layer_flags.cpp | 2 +- src/app/undoers/set_layer_flags.h | 6 +- src/app/undoers/set_layer_name.cpp | 2 +- src/app/undoers/set_layer_name.h | 6 +- src/app/undoers/set_mask.cpp | 8 +- src/app/undoers/set_mask_position.cpp | 2 +- src/app/undoers/set_mask_position.h | 2 +- src/app/undoers/set_palette_colors.cpp | 4 +- src/app/undoers/set_palette_colors.h | 8 +- src/app/undoers/set_sprite_pixel_format.cpp | 2 +- src/app/undoers/set_sprite_pixel_format.h | 6 +- src/app/undoers/set_sprite_size.cpp | 2 +- src/app/undoers/set_sprite_size.h | 6 +- .../undoers/set_sprite_transparent_color.cpp | 2 +- .../undoers/set_sprite_transparent_color.h | 6 +- src/app/undoers/set_total_frames.cpp | 2 +- src/app/undoers/set_total_frames.h | 10 +- src/app/util/autocrop.cpp | 8 +- src/app/util/autocrop.h | 6 +- src/app/util/boundary.cpp | 6 +- src/app/util/boundary.h | 4 +- src/app/util/clipboard.cpp | 4 +- src/app/util/clipboard.h | 4 +- src/app/util/clipboard_win32.h | 4 +- src/app/util/expand_cel_canvas.cpp | 20 +- src/app/util/expand_cel_canvas.h | 4 +- src/app/util/misc.cpp | 4 +- src/app/util/misc.h | 4 +- src/app/util/msk_file.cpp | 6 +- src/app/util/msk_file.h | 6 +- src/app/util/pic_file.cpp | 10 +- src/app/util/pic_file.h | 6 +- src/app/util/range_utils.cpp | 6 +- src/app/util/range_utils.h | 4 +- src/app/util/render.cpp | 6 +- src/app/util/render.h | 6 +- src/doc/CMakeLists.txt | 38 +++- src/doc/LICENSE.txt | 2 +- src/doc/README.md | 2 +- src/{raster => doc}/algo.cpp | 30 +-- src/doc/algo.h | 37 ++++ src/{raster => doc}/algorithm/flip_image.cpp | 34 ++-- src/doc/algorithm/flip_image.h | 31 ++++ src/doc/algorithm/flip_type.h | 22 +++ .../algorithm/floodfill.cpp} | 17 +- src/doc/algorithm/floodfill.h | 28 +++ src/doc/algorithm/hline.h | 17 ++ .../algorithm/polygon.cpp} | 39 ++-- src/doc/algorithm/polygon.h | 22 +++ .../algorithm/resize_image.cpp | 36 ++-- src/{raster => doc}/algorithm/resize_image.h | 28 +-- src/{raster => doc/algorithm}/rotate.cpp | 28 +-- src/doc/algorithm/rotate.h | 30 +++ src/{raster => doc/algorithm}/rotsprite.cpp | 54 +++--- src/doc/algorithm/rotsprite.h | 23 +++ .../algorithm/shrink_bounds.cpp | 30 +-- src/doc/algorithm/shrink_bounds.h | 25 +++ src/{raster => doc}/blend.cpp | 30 +-- src/{raster => doc}/blend.h | 30 +-- src/{raster => doc}/brush.cpp | 37 ++-- src/{raster => doc}/brush.h | 32 +--- src/doc/brush_type.h | 24 +++ src/{raster => doc}/cel.cpp | 38 ++-- src/{raster => doc}/cel.h | 34 ++-- src/{raster => doc}/cel_io.cpp | 28 +-- src/doc/cel_io.h | 22 +++ src/doc/cel_list.h | 23 +++ src/{raster => doc}/color.h | 30 +-- src/{raster => doc}/color_histogram.h | 38 ++-- src/doc/color_mode.h | 2 +- src/{raster => doc}/color_scales.cpp | 26 +-- src/doc/color_scales.h | 23 +++ src/doc/context.cpp | 2 +- src/doc/context.h | 2 +- src/doc/context_observer.h | 2 +- src/doc/context_tests.cpp | 2 +- src/{raster => doc}/conversion_she.cpp | 42 ++--- src/doc/conversion_she.h | 25 +++ src/{raster => doc}/dirty.cpp | 34 ++-- src/{raster => doc}/dirty.h | 32 +--- src/{raster => doc}/dirty_io.cpp | 28 +-- src/doc/dirty_io.h | 22 +++ src/doc/dithering_method.h | 21 +++ src/doc/doc.h | 33 ++++ src/doc/document.cpp | 5 +- src/doc/document.h | 2 +- src/doc/document_event.h | 6 +- src/doc/documents.cpp | 2 +- src/doc/documents.h | 2 +- src/doc/documents_observer.h | 2 +- src/doc/export_data.h | 2 +- src/{raster => doc}/file/col_file.cpp | 32 +--- src/doc/file/col_file.h | 24 +++ src/{raster => doc}/file/gpl_file.cpp | 30 +-- src/doc/file/gpl_file.h | 23 +++ src/{raster => doc}/frame_number.h | 30 +-- src/{raster => doc}/image.cpp | 44 ++--- src/{raster => doc}/image.h | 48 ++--- src/{raster => doc}/image_bits.h | 34 ++-- src/doc/image_buffer.h | 38 ++++ src/{raster => doc}/image_impl.h | 40 ++-- src/{raster => doc}/image_io.cpp | 28 +-- src/doc/image_io.h | 22 +++ src/{raster => doc}/image_iterator.h | 36 ++-- src/{raster => doc}/image_tests.cpp | 30 +-- src/{raster => doc}/image_traits.h | 32 +--- src/{raster => doc}/images_collector.cpp | 44 ++--- src/{raster => doc}/images_collector.h | 32 +--- src/{raster => doc}/layer.cpp | 50 ++--- src/{raster => doc}/layer.h | 48 ++--- src/doc/layer_index.cpp | 17 ++ src/{raster => doc}/layer_index.h | 30 +-- src/{raster => doc}/layer_io.cpp | 44 ++--- src/{raster => doc}/layer_io.h | 30 +-- src/doc/layer_list.h | 23 +++ src/{raster => doc}/mask.cpp | 36 ++-- src/{raster => doc}/mask.h | 36 ++-- src/{raster => doc}/mask_io.cpp | 28 +-- src/doc/mask_io.h | 22 +++ src/{raster => doc}/median_cut.h | 30 +-- src/doc/object.cpp | 12 +- src/doc/object.h | 12 +- src/doc/object_id.h | 2 +- src/doc/object_type.h | 30 +++ src/{raster => doc}/palette.cpp | 32 +--- src/{raster => doc}/palette.h | 36 ++-- src/{raster => doc}/palette_io.cpp | 28 +-- src/doc/palette_io.h | 22 +++ src/{raster => doc}/path.cpp | 32 +--- src/{raster => doc}/path.h | 32 +--- src/doc/pixel_format.h | 22 +++ src/{raster => doc}/primitives.cpp | 42 ++--- src/{raster => doc}/primitives.h | 34 ++-- src/{raster => doc}/primitives_fast.h | 34 ++-- src/{raster => doc}/quantization.cpp | 46 ++--- src/{raster => doc}/quantization.h | 38 ++-- src/{raster => doc}/resize_image_tests.cpp | 12 +- src/{raster => doc}/rgbmap.cpp | 34 ++-- src/doc/rgbmap.h | 39 ++++ src/doc/settings.h | 2 +- src/{raster => doc}/sprite.cpp | 50 ++--- src/doc/sprite.h | 147 ++++++++++++++- src/doc/sprite_position.h | 42 +++++ src/doc/sprites.cpp | 16 +- src/doc/sprites.h | 2 +- src/doc/sprites_observer.h | 2 +- src/{raster => doc}/stock.cpp | 34 ++-- src/{raster => doc}/stock.h | 34 ++-- src/filters/color_curve_filter.cpp | 10 +- src/filters/convolution_matrix_filter.cpp | 10 +- src/filters/filter_indexed_data.h | 6 +- src/filters/filter_manager.h | 4 +- src/filters/invert_color_filter.cpp | 8 +- src/filters/median_filter.cpp | 10 +- src/filters/neighboring_pixels.h | 8 +- src/filters/replace_color_filter.cpp | 4 +- src/raster/CMakeLists.txt | 38 ---- src/raster/algo.h | 56 ------ src/raster/algorithm/flip_image.h | 43 ----- src/raster/algorithm/flip_type.h | 34 ---- src/raster/algorithm/shrink_bounds.h | 37 ---- src/raster/brush_type.h | 36 ---- src/raster/cel_io.h | 34 ---- src/raster/color_scales.h | 35 ---- src/raster/conversion_she.h | 37 ---- src/raster/dirty_io.h | 34 ---- src/raster/dithering_method.h | 33 ---- src/raster/file/col_file.h | 36 ---- src/raster/file/gpl_file.h | 35 ---- src/raster/image_buffer.h | 50 ----- src/raster/image_io.h | 34 ---- src/raster/layer_index.cpp | 29 --- src/raster/mask_io.h | 34 ---- src/raster/object.cpp | 46 ----- src/raster/object.h | 71 -------- src/raster/palette_io.h | 34 ---- src/raster/pixel_format.h | 34 ---- src/raster/raster.h | 46 ----- src/raster/rgbmap.h | 51 ------ src/raster/rotate.h | 40 ---- src/raster/rotsprite.h | 32 ---- src/raster/sprite.h | 171 ------------------ src/raster/sprite_position.h | 54 ------ 395 files changed, 2567 insertions(+), 3511 deletions(-) rename src/{raster => doc}/algo.cpp (94%) create mode 100644 src/doc/algo.h rename src/{raster => doc}/algorithm/flip_image.cpp (69%) create mode 100644 src/doc/algorithm/flip_image.h create mode 100644 src/doc/algorithm/flip_type.h rename src/{raster/algofill.cpp => doc/algorithm/floodfill.cpp} (97%) create mode 100644 src/doc/algorithm/floodfill.h create mode 100644 src/doc/algorithm/hline.h rename src/{raster/algo_polygon.cpp => doc/algorithm/polygon.cpp} (74%) create mode 100644 src/doc/algorithm/polygon.h rename src/{raster => doc}/algorithm/resize_image.cpp (87%) rename src/{raster => doc}/algorithm/resize_image.h (52%) rename src/{raster => doc/algorithm}/rotate.cpp (97%) create mode 100644 src/doc/algorithm/rotate.h rename src/{raster => doc/algorithm}/rotsprite.cpp (82%) create mode 100644 src/doc/algorithm/rotsprite.h rename src/{raster => doc}/algorithm/shrink_bounds.cpp (69%) create mode 100644 src/doc/algorithm/shrink_bounds.h rename src/{raster => doc}/blend.cpp (87%) rename src/{raster => doc}/blend.h (57%) rename src/{raster => doc}/brush.cpp (76%) rename src/{raster => doc}/brush.h (53%) create mode 100644 src/doc/brush_type.h rename src/{raster => doc}/cel.cpp (55%) rename src/{raster => doc}/cel.h (59%) rename src/{raster => doc}/cel_io.cpp (56%) create mode 100644 src/doc/cel_io.h create mode 100644 src/doc/cel_list.h rename src/{raster => doc}/color.h (67%) rename src/{raster => doc}/color_histogram.h (79%) rename src/{raster => doc}/color_scales.cpp (54%) create mode 100644 src/doc/color_scales.h rename src/{raster => doc}/conversion_she.cpp (84%) create mode 100644 src/doc/conversion_she.h rename src/{raster => doc}/dirty.cpp (81%) rename src/{raster => doc}/dirty.h (65%) rename src/{raster => doc}/dirty_io.cpp (72%) create mode 100644 src/doc/dirty_io.h create mode 100644 src/doc/dithering_method.h create mode 100644 src/doc/doc.h rename src/{raster => doc}/file/col_file.cpp (73%) create mode 100644 src/doc/file/col_file.h rename src/{raster => doc}/file/gpl_file.cpp (68%) create mode 100644 src/doc/file/gpl_file.h rename src/{raster => doc}/frame_number.h (65%) rename src/{raster => doc}/image.cpp (53%) rename src/{raster => doc}/image.h (73%) rename src/{raster => doc}/image_bits.h (81%) create mode 100644 src/doc/image_buffer.h rename src/{raster => doc}/image_impl.h (91%) rename src/{raster => doc}/image_io.cpp (64%) create mode 100644 src/doc/image_io.h rename src/{raster => doc}/image_iterator.h (91%) rename src/{raster => doc}/image_tests.cpp (83%) rename src/{raster => doc}/image_traits.h (73%) rename src/{raster => doc}/images_collector.cpp (56%) rename src/{raster => doc}/images_collector.h (63%) rename src/{raster => doc}/layer.cpp (83%) rename src/{raster => doc}/layer.h (78%) create mode 100644 src/doc/layer_index.cpp rename src/{raster => doc}/layer_index.h (65%) rename src/{raster => doc}/layer_io.cpp (73%) rename src/{raster => doc}/layer_io.h (55%) create mode 100644 src/doc/layer_list.h rename src/{raster => doc}/mask.cpp (92%) rename src/{raster => doc}/mask.h (75%) rename src/{raster => doc}/mask_io.cpp (63%) create mode 100644 src/doc/mask_io.h rename src/{raster => doc}/median_cut.h (92%) create mode 100644 src/doc/object_type.h rename src/{raster => doc}/palette.cpp (91%) rename src/{raster => doc}/palette.h (67%) rename src/{raster => doc}/palette_io.cpp (54%) create mode 100644 src/doc/palette_io.h rename src/{raster => doc}/path.cpp (91%) rename src/{raster => doc}/path.h (59%) create mode 100644 src/doc/pixel_format.h rename src/{raster => doc}/primitives.cpp (87%) rename src/{raster => doc}/primitives.h (58%) rename src/{raster => doc}/primitives_fast.h (57%) rename src/{raster => doc}/quantization.cpp (92%) rename src/{raster => doc}/quantization.h (53%) rename src/{raster => doc}/resize_image_tests.cpp (95%) rename src/{raster => doc}/rgbmap.cpp (50%) create mode 100644 src/doc/rgbmap.h rename src/{raster => doc}/sprite.cpp (88%) create mode 100644 src/doc/sprite_position.h rename src/{raster => doc}/stock.cpp (57%) rename src/{raster => doc}/stock.h (60%) delete mode 100644 src/raster/CMakeLists.txt delete mode 100644 src/raster/algo.h delete mode 100644 src/raster/algorithm/flip_image.h delete mode 100644 src/raster/algorithm/flip_type.h delete mode 100644 src/raster/algorithm/shrink_bounds.h delete mode 100644 src/raster/brush_type.h delete mode 100644 src/raster/cel_io.h delete mode 100644 src/raster/color_scales.h delete mode 100644 src/raster/conversion_she.h delete mode 100644 src/raster/dirty_io.h delete mode 100644 src/raster/dithering_method.h delete mode 100644 src/raster/file/col_file.h delete mode 100644 src/raster/file/gpl_file.h delete mode 100644 src/raster/image_buffer.h delete mode 100644 src/raster/image_io.h delete mode 100644 src/raster/layer_index.cpp delete mode 100644 src/raster/mask_io.h delete mode 100644 src/raster/object.cpp delete mode 100644 src/raster/object.h delete mode 100644 src/raster/palette_io.h delete mode 100644 src/raster/pixel_format.h delete mode 100644 src/raster/raster.h delete mode 100644 src/raster/rgbmap.h delete mode 100644 src/raster/rotate.h delete mode 100644 src/raster/rotsprite.h delete mode 100644 src/raster/sprite.h delete mode 100644 src/raster/sprite_position.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 664ecadbf..61f998a54 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,7 +28,6 @@ set(aseprite_libraries cfg-lib css-lib doc-lib - raster-lib scripting-lib undo-lib filters-lib @@ -206,7 +205,6 @@ add_subdirectory(filters) add_subdirectory(fixmath) add_subdirectory(gen) add_subdirectory(gfx) -add_subdirectory(raster) add_subdirectory(scripting) add_subdirectory(she) add_subdirectory(ui) @@ -322,8 +320,7 @@ endfunction() find_tests(base base-lib ${sys_libs}) find_tests(gfx gfx-lib base-lib ${sys_libs}) -find_tests(raster raster-lib gfx-lib base-lib ${libs3rdparty} ${sys_libs}) -find_tests(doc doc-lib raster-lib gfx-lib base-lib ${libs3rdparty} ${sys_libs}) +find_tests(doc doc-lib gfx-lib base-lib ${libs3rdparty} ${sys_libs}) find_tests(css css-lib gfx-lib base-lib ${libs3rdparty} ${sys_libs}) find_tests(ui ui-lib she gfx-lib base-lib ${libs3rdparty} ${sys_libs}) find_tests(app/file ${all_libs}) diff --git a/src/README.md b/src/README.md index 3274f17c8..abab391d9 100644 --- a/src/README.md +++ b/src/README.md @@ -23,16 +23,15 @@ because they don't depend on any other component. ## Level 1 * [cfg](cfg/) (base): Library to load/save .ini files. + * [doc](doc/) (base, gfx): Document model library. * [gen](gen/) (base): Helper utility to generate C++ files from different XMLs. * [net](net/) (base): Networking library to send HTTP requests. - * [raster](raster/) (base, gfx): Library to handle graphics entities like sprites, images, frames. * [she](she/) (base, gfx, allegro): A wrapper for the Allegro library. * [webserver](webserver/) (base): HTTP web server (based on [mongoose](https://github.com/valenok/mongoose)) ## Level 2 - * [doc](doc/) (raster, base, gfx): Document model library. - * [filters](filters/) (base, gfx, raster): FX for raster images. + * [filters](filters/) (base, doc, gfx): Effects for images. * [ui](ui/) (base, gfx, she): Portable UI library (buttons, windows, text fields, etc.) * [updater](updater/) (base, net): Component to check for updates. @@ -42,7 +41,7 @@ because they don't depend on any other component. ## Level 4 - * [app](app/) (allegro, base, doc, filters, gfx, iff, raster, scripting, she, ui, undo, updater, webserver) + * [app](app/) (allegro, base, doc, filters, gfx, iff, scripting, she, ui, undo, updater, webserver) ## Level 5 diff --git a/src/app/app.cpp b/src/app/app.cpp index f11768de8..ee4a4b3fb 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -67,10 +67,10 @@ #include "base/path.h" #include "base/unique_ptr.h" #include "doc/document_observer.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/palette.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/palette.h" +#include "doc/sprite.h" #include "scripting/engine.h" #include "she/display.h" #include "she/error.h" diff --git a/src/app/app.h b/src/app/app.h index 6d4cddd42..7c501cfc3 100644 --- a/src/app/app.h +++ b/src/app/app.h @@ -24,7 +24,7 @@ #include "base/string.h" #include "base/system_console.h" #include "base/unique_ptr.h" -#include "raster/pixel_format.h" +#include "doc/pixel_format.h" #include #include @@ -35,7 +35,7 @@ namespace ui { class Window; } -namespace raster { +namespace doc { class Layer; } @@ -53,7 +53,7 @@ namespace app { class ToolBox; } - using namespace raster; + using namespace doc; class App { public: diff --git a/src/app/color.cpp b/src/app/color.cpp index 0fa7d4672..37822d600 100644 --- a/src/app/color.cpp +++ b/src/app/color.cpp @@ -26,9 +26,9 @@ #include "app/modules/palettes.h" #include "gfx/hsv.h" #include "gfx/rgb.h" -#include "raster/image.h" -#include "raster/palette.h" -#include "raster/primitives.h" +#include "doc/image.h" +#include "doc/palette.h" +#include "doc/primitives.h" #include #include @@ -116,7 +116,7 @@ Color Color::fromImage(PixelFormat pixelFormat, color_t c) Color Color::fromImageGetPixel(Image *image, int x, int y) { if ((x >= 0) && (y >= 0) && (x < image->width()) && (y < image->height())) - return Color::fromImage(image->pixelFormat(), raster::get_pixel(image, x, y)); + return Color::fromImage(image->pixelFormat(), doc::get_pixel(image, x, y)); else return Color::fromMask(); } diff --git a/src/app/color.h b/src/app/color.h index a3b8e7273..11f107c32 100644 --- a/src/app/color.h +++ b/src/app/color.h @@ -20,19 +20,19 @@ #define APP_COLOR_H_INCLUDED #pragma once -#include "raster/color.h" -#include "raster/pixel_format.h" +#include "doc/color.h" +#include "doc/pixel_format.h" #include -namespace raster { +namespace doc { class Image; class Layer; } namespace app { - using namespace raster; + using namespace doc; class Color { public: diff --git a/src/app/color_picker.cpp b/src/app/color_picker.cpp index 6d784cbc7..3e7fe6a6f 100644 --- a/src/app/color_picker.cpp +++ b/src/app/color_picker.cpp @@ -24,9 +24,9 @@ #include "app/document_location.h" #include "gfx/point.h" -#include "raster/image.h" -#include "raster/primitives.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/primitives.h" +#include "doc/sprite.h" namespace app { @@ -48,18 +48,18 @@ void ColorPicker::pickColor(const DocumentLocation& location, int x, int y, Mode } else { // Pick from the current layer int u, v; - raster::Image* image = location.image(&u, &v, NULL); + doc::Image* image = location.image(&u, &v, NULL); gfx::Point pt(x-u, y-v); if (image && image->bounds().contains(pt)) { - raster::color_t imageColor = get_pixel(image, pt.x, pt.y); + doc::color_t imageColor = get_pixel(image, pt.x, pt.y); switch (image->pixelFormat()) { case IMAGE_RGB: - m_alpha = raster::rgba_geta(imageColor); + m_alpha = doc::rgba_geta(imageColor); break; case IMAGE_GRAYSCALE: - m_alpha = raster::graya_geta(imageColor); + m_alpha = doc::graya_geta(imageColor); break; } diff --git a/src/app/color_target.h b/src/app/color_target.h index bce6af34c..a67d3eb34 100644 --- a/src/app/color_target.h +++ b/src/app/color_target.h @@ -20,10 +20,10 @@ #define APP_COLOR_TARGET_H_INCLUDED #pragma once -#include "raster/color.h" -#include "raster/layer.h" -#include "raster/pixel_format.h" -#include "raster/sprite.h" +#include "doc/color.h" +#include "doc/layer.h" +#include "doc/pixel_format.h" +#include "doc/sprite.h" namespace app { @@ -35,13 +35,13 @@ namespace app { TransparentLayer }; - ColorTarget(LayerType layerType, raster::PixelFormat pixelFormat, raster::color_t maskColor) : + ColorTarget(LayerType layerType, doc::PixelFormat pixelFormat, doc::color_t maskColor) : m_layerType(layerType), m_pixelFormat(pixelFormat), m_maskColor(maskColor) { } - ColorTarget(raster::Layer* layer) : + ColorTarget(doc::Layer* layer) : m_layerType(layer->isBackground() ? BackgroundLayer: TransparentLayer), m_pixelFormat(layer->sprite()->pixelFormat()), m_maskColor(layer->sprite()->transparentColor()) { @@ -50,13 +50,13 @@ namespace app { bool isBackground() const { return m_layerType == BackgroundLayer; } bool isTransparent() const { return m_layerType == TransparentLayer; } LayerType layerType() const { return m_layerType; } - raster::PixelFormat pixelFormat() const { return m_pixelFormat; } - raster::color_t maskColor() const { return m_maskColor; } + doc::PixelFormat pixelFormat() const { return m_pixelFormat; } + doc::color_t maskColor() const { return m_maskColor; } private: LayerType m_layerType; - raster::PixelFormat m_pixelFormat; - raster::color_t m_maskColor; + doc::PixelFormat m_pixelFormat; + doc::color_t m_maskColor; }; } // namespace app diff --git a/src/app/color_utils.cpp b/src/app/color_utils.cpp index 67c8f0fa2..c9d4c9f12 100644 --- a/src/app/color_utils.cpp +++ b/src/app/color_utils.cpp @@ -25,10 +25,10 @@ #include "app/modules/palettes.h" #include "gfx/hsv.h" #include "gfx/rgb.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/palette.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/palette.h" +#include "doc/sprite.h" namespace app { @@ -90,19 +90,19 @@ gfx::Color color_utils::color_for_ui(const app::Color& color) return c; } -raster::color_t color_utils::color_for_image(const app::Color& color, PixelFormat format) +doc::color_t color_utils::color_for_image(const app::Color& color, PixelFormat format) { if (color.getType() == app::Color::MaskType) return 0; - raster::color_t c = -1; + doc::color_t c = -1; switch (format) { case IMAGE_RGB: - c = raster::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255); + c = doc::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255); break; case IMAGE_GRAYSCALE: - c = raster::graya(color.getGray(), 255); + c = doc::graya(color.getGray(), 255); break; case IMAGE_INDEXED: c = color.getIndex(); @@ -112,24 +112,24 @@ raster::color_t color_utils::color_for_image(const app::Color& color, PixelForma return c; } -raster::color_t color_utils::color_for_layer(const app::Color& color, Layer* layer) +doc::color_t color_utils::color_for_layer(const app::Color& color, Layer* layer) { return color_for_target(color, ColorTarget(layer)); } -raster::color_t color_utils::color_for_target(const app::Color& color, const ColorTarget& colorTarget) +doc::color_t color_utils::color_for_target(const app::Color& color, const ColorTarget& colorTarget) { if (color.getType() == app::Color::MaskType) return colorTarget.maskColor(); - raster::color_t c = -1; + doc::color_t c = -1; switch (colorTarget.pixelFormat()) { case IMAGE_RGB: - c = raster::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255); + c = doc::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255); break; case IMAGE_GRAYSCALE: - c = raster::graya(color.getGray(), 255); + c = doc::graya(color.getGray(), 255); break; case IMAGE_INDEXED: if (color.getType() == app::Color::IndexType) { diff --git a/src/app/color_utils.h b/src/app/color_utils.h index b35f26356..2c5a7d2db 100644 --- a/src/app/color_utils.h +++ b/src/app/color_utils.h @@ -23,10 +23,10 @@ #include "app/color.h" #include "app/color_target.h" #include "gfx/color.h" -#include "raster/color.h" -#include "raster/pixel_format.h" +#include "doc/color.h" +#include "doc/pixel_format.h" -namespace raster { +namespace doc { class Layer; } @@ -37,9 +37,9 @@ namespace app { gfx::Color blackandwhite_neg(gfx::Color color); gfx::Color color_for_ui(const app::Color& color); - raster::color_t color_for_image(const app::Color& color, raster::PixelFormat format); - raster::color_t color_for_layer(const app::Color& color, raster::Layer* layer); - raster::color_t color_for_target(const app::Color& color, const ColorTarget& colorTarget); + doc::color_t color_for_image(const app::Color& color, doc::PixelFormat format); + doc::color_t color_for_layer(const app::Color& color, doc::Layer* layer); + doc::color_t color_for_target(const app::Color& color, const ColorTarget& colorTarget); } // namespace color_utils } // namespace app diff --git a/src/app/commands/cmd_background_from_layer.cpp b/src/app/commands/cmd_background_from_layer.cpp index bb916f46c..8271a1ed5 100644 --- a/src/app/commands/cmd_background_from_layer.cpp +++ b/src/app/commands/cmd_background_from_layer.cpp @@ -28,8 +28,8 @@ #include "app/settings/settings.h" #include "app/ui/color_bar.h" #include "app/undo_transaction.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/sprite.h" namespace app { diff --git a/src/app/commands/cmd_canvas_size.cpp b/src/app/commands/cmd_canvas_size.cpp index 8be382179..5a2eca3c4 100644 --- a/src/app/commands/cmd_canvas_size.cpp +++ b/src/app/commands/cmd_canvas_size.cpp @@ -36,9 +36,9 @@ #include "app/undo_transaction.h" #include "base/bind.h" #include "base/unique_ptr.h" -#include "raster/image.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/ui.h" #include "generated_canvas_size.h" diff --git a/src/app/commands/cmd_cel_properties.cpp b/src/app/commands/cmd_cel_properties.cpp index 2a36ad12e..a037b9d8b 100644 --- a/src/app/commands/cmd_cel_properties.cpp +++ b/src/app/commands/cmd_cel_properties.cpp @@ -29,11 +29,11 @@ #include "app/modules/gui.h" #include "app/undo_transaction.h" #include "base/mem_utils.h" -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/sprite.h" +#include "doc/stock.h" #include "ui/ui.h" namespace app { diff --git a/src/app/commands/cmd_change_pixel_format.cpp b/src/app/commands/cmd_change_pixel_format.cpp index a0a042ae8..7ca4d4a57 100644 --- a/src/app/commands/cmd_change_pixel_format.cpp +++ b/src/app/commands/cmd_change_pixel_format.cpp @@ -28,9 +28,9 @@ #include "app/modules/gui.h" #include "app/modules/palettes.h" #include "app/undo_transaction.h" -#include "raster/dithering_method.h" -#include "raster/image.h" -#include "raster/sprite.h" +#include "doc/dithering_method.h" +#include "doc/image.h" +#include "doc/sprite.h" namespace app { diff --git a/src/app/commands/cmd_clear.cpp b/src/app/commands/cmd_clear.cpp index 2eb05fccb..5ad1bd033 100644 --- a/src/app/commands/cmd_clear.cpp +++ b/src/app/commands/cmd_clear.cpp @@ -31,8 +31,8 @@ #include "app/ui/main_window.h" #include "app/ui/timeline.h" #include "app/undo_transaction.h" -#include "raster/layer.h" -#include "raster/mask.h" +#include "doc/layer.h" +#include "doc/mask.h" #include "undo/undo_history.h" namespace app { diff --git a/src/app/commands/cmd_clear_cel.cpp b/src/app/commands/cmd_clear_cel.cpp index ec9222c06..cc4c1bc19 100644 --- a/src/app/commands/cmd_clear_cel.cpp +++ b/src/app/commands/cmd_clear_cel.cpp @@ -28,9 +28,9 @@ #include "app/ui/main_window.h" #include "app/ui/timeline.h" #include "app/undo_transaction.h" -#include "raster/cel.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/cel.h" +#include "doc/layer.h" +#include "doc/sprite.h" namespace app { diff --git a/src/app/commands/cmd_close_file.cpp b/src/app/commands/cmd_close_file.cpp index d0aac6479..cc8decfb4 100644 --- a/src/app/commands/cmd_close_file.cpp +++ b/src/app/commands/cmd_close_file.cpp @@ -31,7 +31,7 @@ #include "app/ui/status_bar.h" #include "app/ui/workspace.h" #include "app/ui_context.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/ui.h" #include diff --git a/src/app/commands/cmd_configure_tools.cpp b/src/app/commands/cmd_configure_tools.cpp index a4375bef1..a3d886382 100644 --- a/src/app/commands/cmd_configure_tools.cpp +++ b/src/app/commands/cmd_configure_tools.cpp @@ -38,7 +38,7 @@ #include "base/bind.h" #include "doc/context_observer.h" #include "gfx/size.h" -#include "raster/mask.h" +#include "doc/mask.h" #include "ui/ui.h" namespace app { diff --git a/src/app/commands/cmd_copy.cpp b/src/app/commands/cmd_copy.cpp index f6d518c69..8976bf73a 100644 --- a/src/app/commands/cmd_copy.cpp +++ b/src/app/commands/cmd_copy.cpp @@ -27,9 +27,9 @@ #include "app/ui/timeline.h" #include "app/util/clipboard.h" #include "app/util/misc.h" -#include "raster/layer.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/base.h" namespace app { diff --git a/src/app/commands/cmd_crop.cpp b/src/app/commands/cmd_crop.cpp index 41d2f588e..4e654c200 100644 --- a/src/app/commands/cmd_crop.cpp +++ b/src/app/commands/cmd_crop.cpp @@ -28,10 +28,10 @@ #include "app/undo_transaction.h" #include "app/util/autocrop.h" #include "app/util/misc.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/mask.h" +#include "doc/sprite.h" namespace app { diff --git a/src/app/commands/cmd_cut.cpp b/src/app/commands/cmd_cut.cpp index 79e945a59..1a493359e 100644 --- a/src/app/commands/cmd_cut.cpp +++ b/src/app/commands/cmd_cut.cpp @@ -24,9 +24,9 @@ #include "app/context_access.h" #include "app/util/clipboard.h" #include "app/util/misc.h" -#include "raster/layer.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/base.h" namespace app { diff --git a/src/app/commands/cmd_deselect_mask.cpp b/src/app/commands/cmd_deselect_mask.cpp index 4a7a4a342..4b1b7d445 100644 --- a/src/app/commands/cmd_deselect_mask.cpp +++ b/src/app/commands/cmd_deselect_mask.cpp @@ -25,8 +25,8 @@ #include "app/document_api.h" #include "app/modules/gui.h" #include "app/undo_transaction.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/mask.h" +#include "doc/sprite.h" namespace app { diff --git a/src/app/commands/cmd_duplicate_layer.cpp b/src/app/commands/cmd_duplicate_layer.cpp index 1297f5565..355564f87 100644 --- a/src/app/commands/cmd_duplicate_layer.cpp +++ b/src/app/commands/cmd_duplicate_layer.cpp @@ -32,8 +32,8 @@ #include "app/undo_transaction.h" #include "app/undoers/add_layer.h" #include "app/undoers/move_layer.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/sprite.h" #include "ui/ui.h" namespace app { diff --git a/src/app/commands/cmd_duplicate_sprite.cpp b/src/app/commands/cmd_duplicate_sprite.cpp index f04857fb9..16139eb5a 100644 --- a/src/app/commands/cmd_duplicate_sprite.cpp +++ b/src/app/commands/cmd_duplicate_sprite.cpp @@ -29,7 +29,7 @@ #include "app/modules/editors.h" #include "app/ui_context.h" #include "base/path.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/ui.h" #include "generated_duplicate_sprite.h" diff --git a/src/app/commands/cmd_export_sprite_sheet.cpp b/src/app/commands/cmd_export_sprite_sheet.cpp index 6b166a170..4ce59c7f6 100644 --- a/src/app/commands/cmd_export_sprite_sheet.cpp +++ b/src/app/commands/cmd_export_sprite_sheet.cpp @@ -39,13 +39,13 @@ #include "app/undo_transaction.h" #include "base/bind.h" #include "base/convert_to.h" -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/palette.h" -#include "raster/primitives.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/palette.h" +#include "doc/primitives.h" +#include "doc/sprite.h" +#include "doc/stock.h" #include "ui/ui.h" #include "generated_export_sprite_sheet.h" @@ -329,7 +329,7 @@ void ExportSpriteSheetCommand::onExecute(Context* context) base::UniquePtr resultImage(Image::create(sprite->pixelFormat(), sheet_w, sheet_h)); base::UniquePtr tempImage(Image::create(sprite->pixelFormat(), sprite->width(), sprite->height())); - raster::clear_image(resultImage, 0); + doc::clear_image(resultImage, 0); int column = 0, row = 0; for (FrameNumber frame(0); frameget("orientation"); - m_flipType = (orientation == "vertical" ? raster::algorithm::FlipVertical: - raster::algorithm::FlipHorizontal); + m_flipType = (orientation == "vertical" ? doc::algorithm::FlipVertical: + doc::algorithm::FlipHorizontal); } bool FlipCommand::onEnabled(Context* context) @@ -77,10 +77,10 @@ void FlipCommand::onExecute(Context* context) { UndoTransaction undoTransaction(writer.context(), m_flipMask ? - (m_flipType == raster::algorithm::FlipHorizontal ? + (m_flipType == doc::algorithm::FlipHorizontal ? "Flip Horizontal": "Flip Vertical"): - (m_flipType == raster::algorithm::FlipHorizontal ? + (m_flipType == doc::algorithm::FlipHorizontal ? "Flip Canvas Horizontal": "Flip Canvas Vertical")); @@ -132,10 +132,10 @@ void FlipCommand::onExecute(Context* context) if (!alreadyFlipped) { api.setCelPosition (sprite, cel, - (m_flipType == raster::algorithm::FlipHorizontal ? + (m_flipType == doc::algorithm::FlipHorizontal ? sprite->width() - image->width() - cel->x(): cel->x()), - (m_flipType == raster::algorithm::FlipVertical ? + (m_flipType == doc::algorithm::FlipVertical ? sprite->height() - image->height() - cel->y(): cel->y())); @@ -149,7 +149,7 @@ void FlipCommand::onExecute(Context* context) // Create a flipped copy of the current mask. base::UniquePtr newMask(new Mask(*mask)); newMask->freeze(); - raster::algorithm::flip_image(newMask->bitmap(), + doc::algorithm::flip_image(newMask->bitmap(), maskBitmap->bounds(), m_flipType); newMask->unfreeze(); @@ -171,10 +171,10 @@ void FlipCommand::onExecute(Context* context) api.setCelPosition (sprite, cel, - (m_flipType == raster::algorithm::FlipHorizontal ? + (m_flipType == doc::algorithm::FlipHorizontal ? sprite->width() - image->width() - cel->x(): cel->x()), - (m_flipType == raster::algorithm::FlipVertical ? + (m_flipType == doc::algorithm::FlipVertical ? sprite->height() - image->height() - cel->y(): cel->y())); diff --git a/src/app/commands/cmd_flip.h b/src/app/commands/cmd_flip.h index 444a24ff5..765b67521 100644 --- a/src/app/commands/cmd_flip.h +++ b/src/app/commands/cmd_flip.h @@ -21,7 +21,7 @@ #pragma once #include "app/commands/command.h" -#include "raster/algorithm/flip_type.h" +#include "doc/algorithm/flip_type.h" namespace app { @@ -30,7 +30,7 @@ namespace app { FlipCommand(); Command* clone() const override { return new FlipCommand(*this); } - raster::algorithm::FlipType getFlipType() const { return m_flipType; } + doc::algorithm::FlipType getFlipType() const { return m_flipType; } protected: void onLoadParams(Params* params); @@ -39,7 +39,7 @@ namespace app { private: bool m_flipMask; - raster::algorithm::FlipType m_flipType; + doc::algorithm::FlipType m_flipType; }; } // namespace app diff --git a/src/app/commands/cmd_frame_properties.cpp b/src/app/commands/cmd_frame_properties.cpp index c16423b60..448bf81a5 100644 --- a/src/app/commands/cmd_frame_properties.cpp +++ b/src/app/commands/cmd_frame_properties.cpp @@ -31,7 +31,7 @@ #include "app/ui/timeline.h" #include "app/undo_transaction.h" #include "base/convert_to.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/ui.h" namespace app { diff --git a/src/app/commands/cmd_goto_frame.cpp b/src/app/commands/cmd_goto_frame.cpp index 9bce24d06..12383a711 100644 --- a/src/app/commands/cmd_goto_frame.cpp +++ b/src/app/commands/cmd_goto_frame.cpp @@ -27,7 +27,7 @@ #include "app/modules/editors.h" #include "app/modules/gui.h" #include "app/ui/editor/editor.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/window.h" namespace app { diff --git a/src/app/commands/cmd_goto_layer.cpp b/src/app/commands/cmd_goto_layer.cpp index 974d8f512..3bdcd6162 100644 --- a/src/app/commands/cmd_goto_layer.cpp +++ b/src/app/commands/cmd_goto_layer.cpp @@ -27,8 +27,8 @@ #include "app/modules/gui.h" #include "app/ui/editor/editor.h" #include "app/ui/status_bar.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/sprite.h" namespace app { diff --git a/src/app/commands/cmd_import_sprite_sheet.cpp b/src/app/commands/cmd_import_sprite_sheet.cpp index 3db83150e..a2d05390f 100644 --- a/src/app/commands/cmd_import_sprite_sheet.cpp +++ b/src/app/commands/cmd_import_sprite_sheet.cpp @@ -39,13 +39,13 @@ #include "app/ui/workspace.h" #include "app/undo_transaction.h" #include "base/bind.h" -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/palette.h" -#include "raster/primitives.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/palette.h" +#include "doc/primitives.h" +#include "doc/sprite.h" +#include "doc/stock.h" #include "ui/ui.h" namespace app { @@ -172,7 +172,7 @@ protected: base::UniquePtr resultImage(Image::create(sprite->pixelFormat(), m_rect.w, m_rect.h)); // Clear the image with mask color. - raster::clear_image(resultImage, 0); + doc::clear_image(resultImage, 0); // Render the portion of sheet. sprite->render(resultImage, -x, -y, currentFrame); diff --git a/src/app/commands/cmd_invert_mask.cpp b/src/app/commands/cmd_invert_mask.cpp index 9a2f2ce85..c9aa9e0e5 100644 --- a/src/app/commands/cmd_invert_mask.cpp +++ b/src/app/commands/cmd_invert_mask.cpp @@ -27,10 +27,10 @@ #include "app/undo_transaction.h" #include "app/undoers/set_mask.h" #include "base/unique_ptr.h" -#include "raster/image.h" -#include "raster/mask.h" -#include "raster/primitives.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/mask.h" +#include "doc/primitives.h" +#include "doc/sprite.h" namespace app { @@ -90,7 +90,7 @@ void InvertMaskCommand::onExecute(Context* context) /* remove in the new mask the current sprite marked region */ const gfx::Rect& maskBounds = document->mask()->bounds(); - raster::fill_rect(mask->bitmap(), + doc::fill_rect(mask->bitmap(), maskBounds.x, maskBounds.y, maskBounds.x + maskBounds.w-1, maskBounds.y + maskBounds.h-1, 0); @@ -99,7 +99,7 @@ void InvertMaskCommand::onExecute(Context* context) document->mask()->invert(); if (document->mask()->bitmap()) { // Copy the inverted region in the new mask - raster::copy_image(mask->bitmap(), + doc::copy_image(mask->bitmap(), document->mask()->bitmap(), document->mask()->bounds().x, document->mask()->bounds().y); diff --git a/src/app/commands/cmd_layer_from_background.cpp b/src/app/commands/cmd_layer_from_background.cpp index 884305df0..241676921 100644 --- a/src/app/commands/cmd_layer_from_background.cpp +++ b/src/app/commands/cmd_layer_from_background.cpp @@ -25,8 +25,8 @@ #include "app/document_api.h" #include "app/modules/gui.h" #include "app/undo_transaction.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/sprite.h" #include "ui/ui.h" namespace app { diff --git a/src/app/commands/cmd_layer_properties.cpp b/src/app/commands/cmd_layer_properties.cpp index 2e99e8971..b96bd8681 100644 --- a/src/app/commands/cmd_layer_properties.cpp +++ b/src/app/commands/cmd_layer_properties.cpp @@ -27,8 +27,8 @@ #include "app/commands/command.h" #include "app/context_access.h" #include "app/modules/gui.h" -#include "raster/image.h" -#include "raster/layer.h" +#include "doc/image.h" +#include "doc/layer.h" #include "generated_layer_properties.h" diff --git a/src/app/commands/cmd_load_mask.cpp b/src/app/commands/cmd_load_mask.cpp index cc34a4e55..ea07c0bef 100644 --- a/src/app/commands/cmd_load_mask.cpp +++ b/src/app/commands/cmd_load_mask.cpp @@ -28,8 +28,8 @@ #include "app/undo_transaction.h" #include "app/undoers/set_mask.h" #include "app/util/msk_file.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/alert.h" namespace app { diff --git a/src/app/commands/cmd_load_palette.cpp b/src/app/commands/cmd_load_palette.cpp index 51997dab1..41b7d734e 100644 --- a/src/app/commands/cmd_load_palette.cpp +++ b/src/app/commands/cmd_load_palette.cpp @@ -27,7 +27,7 @@ #include "app/file/palette_file.h" #include "app/file_selector.h" #include "base/unique_ptr.h" -#include "raster/palette.h" +#include "doc/palette.h" #include "ui/alert.h" namespace app { @@ -57,7 +57,7 @@ void LoadPaletteCommand::onExecute(Context* context) std::string filename = app::show_file_selector("Load Palette", "", exts); if (!filename.empty()) { - base::UniquePtr palette(load_palette(filename.c_str())); + base::UniquePtr palette(load_palette(filename.c_str())); if (!palette) { Alert::show("Error<y()+src_image->height()-1, dst_cel->y()+dst_image->height()-1); } - raster::color_t bgcolor = app_get_color_to_clear_layer(dst_layer); + doc::color_t bgcolor = app_get_color_to_clear_layer(dst_layer); - Image* new_image = raster::crop_image(dst_image, + Image* new_image = doc::crop_image(dst_image, x1-dst_cel->x(), y1-dst_cel->y(), x2-x1+1, y2-y1+1, bgcolor); // Merge src_image in new_image - raster::composite_image(new_image, src_image, + doc::composite_image(new_image, src_image, src_cel->x()-x1, src_cel->y()-y1, src_cel->opacity(), diff --git a/src/app/commands/cmd_move_mask.cpp b/src/app/commands/cmd_move_mask.cpp index 4aad3c656..856798b03 100644 --- a/src/app/commands/cmd_move_mask.cpp +++ b/src/app/commands/cmd_move_mask.cpp @@ -32,8 +32,8 @@ #include "app/ui/editor/editor.h" #include "app/undo_transaction.h" #include "app/undoers/set_mask_position.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/view.h" namespace app { diff --git a/src/app/commands/cmd_new_file.cpp b/src/app/commands/cmd_new_file.cpp index 8d7f9b83e..3d6a304a0 100644 --- a/src/app/commands/cmd_new_file.cpp +++ b/src/app/commands/cmd_new_file.cpp @@ -36,13 +36,13 @@ #include "app/ui_context.h" #include "app/util/clipboard.h" #include "base/unique_ptr.h" -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/palette.h" -#include "raster/primitives.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/palette.h" +#include "doc/primitives.h" +#include "doc/sprite.h" +#include "doc/stock.h" #include "ui/ui.h" #include "generated_new_sprite.h" @@ -75,7 +75,7 @@ NewFileCommand::NewFileCommand() void NewFileCommand::onExecute(Context* context) { PixelFormat format; - int w, h, bg, ncolors = raster::Palette::MaxColors; + int w, h, bg, ncolors = doc::Palette::MaxColors; char buf[1024]; app::Color bg_table[] = { app::Color::fromMask(), @@ -179,7 +179,7 @@ void NewFileCommand::onExecute(Context* context) layerImage->configureAsBackground(); Image* image = layerImage->getCel(FrameNumber(0))->image(); - raster::clear_image(image, + doc::clear_image(image, color_utils::color_for_target(color, ColorTarget( ColorTarget::BackgroundLayer, diff --git a/src/app/commands/cmd_new_frame.cpp b/src/app/commands/cmd_new_frame.cpp index 4e9f5ae5d..51ebbd8e1 100644 --- a/src/app/commands/cmd_new_frame.cpp +++ b/src/app/commands/cmd_new_frame.cpp @@ -31,10 +31,10 @@ #include "app/ui/main_window.h" #include "app/ui/status_bar.h" #include "app/undo_transaction.h" -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/cel.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/sprite.h" #include "ui/ui.h" #include diff --git a/src/app/commands/cmd_new_layer.cpp b/src/app/commands/cmd_new_layer.cpp index 2dc34ded9..e5a973f2c 100644 --- a/src/app/commands/cmd_new_layer.cpp +++ b/src/app/commands/cmd_new_layer.cpp @@ -31,8 +31,8 @@ #include "app/ui/main_window.h" #include "app/ui/status_bar.h" #include "app/undo_transaction.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/sprite.h" #include "ui/ui.h" #include diff --git a/src/app/commands/cmd_new_layer_set.cpp b/src/app/commands/cmd_new_layer_set.cpp index 764b6368f..0213544aa 100644 --- a/src/app/commands/cmd_new_layer_set.cpp +++ b/src/app/commands/cmd_new_layer_set.cpp @@ -30,8 +30,8 @@ #include "app/modules/gui.h" #include "app/ui/status_bar.h" #include "app/undo_transaction.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/sprite.h" #include "ui/ui.h" namespace app { diff --git a/src/app/commands/cmd_open_file.cpp b/src/app/commands/cmd_open_file.cpp index 79dabc1ca..0ad478600 100644 --- a/src/app/commands/cmd_open_file.cpp +++ b/src/app/commands/cmd_open_file.cpp @@ -36,7 +36,7 @@ #include "base/bind.h" #include "base/thread.h" #include "base/unique_ptr.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/ui.h" #include diff --git a/src/app/commands/cmd_options.cpp b/src/app/commands/cmd_options.cpp index 3c26130b7..1524bc74c 100644 --- a/src/app/commands/cmd_options.cpp +++ b/src/app/commands/cmd_options.cpp @@ -38,7 +38,7 @@ #include "app/util/render.h" #include "base/bind.h" #include "base/path.h" -#include "raster/image.h" +#include "doc/image.h" #include "she/system.h" #include "ui/ui.h" diff --git a/src/app/commands/cmd_palette_editor.cpp b/src/app/commands/cmd_palette_editor.cpp index 993992fdb..963575e8f 100644 --- a/src/app/commands/cmd_palette_editor.cpp +++ b/src/app/commands/cmd_palette_editor.cpp @@ -52,11 +52,11 @@ #include "gfx/hsv.h" #include "gfx/rgb.h" #include "gfx/size.h" -#include "raster/image.h" -#include "raster/palette.h" -#include "raster/quantization.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/image.h" +#include "doc/palette.h" +#include "doc/quantization.h" +#include "doc/sprite.h" +#include "doc/stock.h" #include "ui/graphics.h" #include "ui/ui.h" @@ -601,7 +601,7 @@ void PaletteEntryEditor::setPaletteEntry(const app::Color& color) PaletteView::SelectedEntries entries; palView->getSelectedEntries(entries); - color_t new_pal_color = raster::rgba(color.getRed(), + color_t new_pal_color = doc::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255); @@ -697,7 +697,7 @@ void PaletteEntryEditor::setPaletteEntryChannel(const app::Color& color, ColorSl break; } - palette->setEntry(c, raster::rgba(r, g, b, 255)); + palette->setEntry(c, doc::rgba(r, g, b, 255)); } } } diff --git a/src/app/commands/cmd_paste.cpp b/src/app/commands/cmd_paste.cpp index 69b07b987..81c7e2d89 100644 --- a/src/app/commands/cmd_paste.cpp +++ b/src/app/commands/cmd_paste.cpp @@ -23,8 +23,8 @@ #include "app/commands/command.h" #include "app/context.h" #include "app/util/clipboard.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/sprite.h" namespace app { diff --git a/src/app/commands/cmd_play_animation.cpp b/src/app/commands/cmd_play_animation.cpp index c33498dd0..110e08fc8 100644 --- a/src/app/commands/cmd_play_animation.cpp +++ b/src/app/commands/cmd_play_animation.cpp @@ -35,9 +35,9 @@ #include "app/ui/editor/editor.h" #include "app/ui/main_window.h" #include "app/ui/mini_editor.h" -#include "raster/image.h" -#include "raster/palette.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/palette.h" +#include "doc/sprite.h" namespace app { diff --git a/src/app/commands/cmd_preview.cpp b/src/app/commands/cmd_preview.cpp index 9057c9e66..974357ce5 100644 --- a/src/app/commands/cmd_preview.cpp +++ b/src/app/commands/cmd_preview.cpp @@ -34,11 +34,11 @@ #include "app/ui/editor/editor.h" #include "app/ui/status_bar.h" #include "app/util/render.h" -#include "raster/conversion_she.h" -#include "raster/image.h" -#include "raster/palette.h" -#include "raster/primitives.h" -#include "raster/sprite.h" +#include "doc/conversion_she.h" +#include "doc/image.h" +#include "doc/palette.h" +#include "doc/primitives.h" +#include "doc/sprite.h" #include "she/scoped_handle.h" #include "she/surface.h" #include "she/system.h" @@ -49,7 +49,7 @@ namespace app { using namespace ui; -using namespace raster; +using namespace doc; using namespace filters; class PreviewWindow : public Window { @@ -207,7 +207,7 @@ protected: if (m_index_bg_color == -1) RenderEngine::renderCheckedBackground(m_doublebuf, -m_pos.x, -m_pos.y, m_zoom); else - raster::clear_image(m_doublebuf, m_pal->getEntry(m_index_bg_color)); + doc::clear_image(m_doublebuf, m_pal->getEntry(m_index_bg_color)); switch (m_tiled) { case TILED_NONE: @@ -228,7 +228,7 @@ protected: break; } - raster::convert_image_to_surface(m_doublebuf, m_pal, + doc::convert_image_to_surface(m_doublebuf, m_pal, m_doublesur, 0, 0, 0, 0, m_doublebuf->width(), m_doublebuf->height()); g->blit(m_doublesur, 0, 0, 0, 0, m_doublesur->width(), m_doublesur->height()); } diff --git a/src/app/commands/cmd_remove_frame.cpp b/src/app/commands/cmd_remove_frame.cpp index a15ac31c2..ade668980 100644 --- a/src/app/commands/cmd_remove_frame.cpp +++ b/src/app/commands/cmd_remove_frame.cpp @@ -28,7 +28,7 @@ #include "app/ui/main_window.h" #include "app/ui/timeline.h" #include "app/undo_transaction.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/ui.h" namespace app { diff --git a/src/app/commands/cmd_remove_layer.cpp b/src/app/commands/cmd_remove_layer.cpp index cb73431ca..4320fd15b 100644 --- a/src/app/commands/cmd_remove_layer.cpp +++ b/src/app/commands/cmd_remove_layer.cpp @@ -29,8 +29,8 @@ #include "app/ui/status_bar.h" #include "app/ui/timeline.h" #include "app/undo_transaction.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/sprite.h" #include "ui/alert.h" #include "ui/widget.h" diff --git a/src/app/commands/cmd_reselect_mask.cpp b/src/app/commands/cmd_reselect_mask.cpp index 7c3359884..f1331402a 100644 --- a/src/app/commands/cmd_reselect_mask.cpp +++ b/src/app/commands/cmd_reselect_mask.cpp @@ -25,8 +25,8 @@ #include "app/modules/gui.h" #include "app/undo_transaction.h" #include "app/undoers/set_mask.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/mask.h" +#include "doc/sprite.h" namespace app { diff --git a/src/app/commands/cmd_rotate.cpp b/src/app/commands/cmd_rotate.cpp index dcd250e26..07e488102 100644 --- a/src/app/commands/cmd_rotate.cpp +++ b/src/app/commands/cmd_rotate.cpp @@ -33,11 +33,11 @@ #include "app/ui/timeline.h" #include "app/undo_transaction.h" #include "app/util/range_utils.h" -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/mask.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/image.h" +#include "doc/mask.h" +#include "doc/sprite.h" +#include "doc/stock.h" #include "ui/ui.h" namespace app { @@ -117,7 +117,7 @@ protected: Image* new_image = Image::create(image->pixelFormat(), m_angle == 180 ? image->width(): image->height(), m_angle == 180 ? image->height(): image->width()); - raster::rotate_image(image, new_image, m_angle); + doc::rotate_image(image, new_image, m_angle); api.replaceStockImage(m_sprite, cel->imageIndex(), new_image); } @@ -156,7 +156,7 @@ protected: new_mask->replace(x, y, m_angle == 180 ? origBounds.w: origBounds.h, m_angle == 180 ? origBounds.h: origBounds.w); - raster::rotate_image(origMask->bitmap(), new_mask->bitmap(), m_angle); + doc::rotate_image(origMask->bitmap(), new_mask->bitmap(), m_angle); // Copy new mask api.copyToCurrentMask(new_mask); diff --git a/src/app/commands/cmd_save_file.cpp b/src/app/commands/cmd_save_file.cpp index 7d8320e47..aa8454ec4 100644 --- a/src/app/commands/cmd_save_file.cpp +++ b/src/app/commands/cmd_save_file.cpp @@ -36,7 +36,7 @@ #include "base/path.h" #include "base/thread.h" #include "base/unique_ptr.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/ui.h" namespace app { diff --git a/src/app/commands/cmd_save_mask.cpp b/src/app/commands/cmd_save_mask.cpp index 867dfd7ab..c268387dd 100644 --- a/src/app/commands/cmd_save_mask.cpp +++ b/src/app/commands/cmd_save_mask.cpp @@ -26,8 +26,8 @@ #include "app/util/msk_file.h" #include "base/fs.h" #include "base/path.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/alert.h" namespace app { diff --git a/src/app/commands/cmd_save_palette.cpp b/src/app/commands/cmd_save_palette.cpp index 074e0878b..dc0ef7c15 100644 --- a/src/app/commands/cmd_save_palette.cpp +++ b/src/app/commands/cmd_save_palette.cpp @@ -26,7 +26,7 @@ #include "app/modules/palettes.h" #include "base/fs.h" #include "base/path.h" -#include "raster/palette.h" +#include "doc/palette.h" #include "ui/alert.h" namespace app { @@ -70,7 +70,7 @@ again: return; } - raster::Palette* palette = get_current_palette(); + doc::Palette* palette = get_current_palette(); if (!save_palette(filename.c_str(), palette)) { Alert::show("Error< diff --git a/src/app/commands/cmd_sprite_size.cpp b/src/app/commands/cmd_sprite_size.cpp index c0c75acec..916a37b70 100644 --- a/src/app/commands/cmd_sprite_size.cpp +++ b/src/app/commands/cmd_sprite_size.cpp @@ -33,13 +33,13 @@ #include "app/undo_transaction.h" #include "base/bind.h" #include "base/unique_ptr.h" -#include "raster/algorithm/resize_image.h" -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/mask.h" -#include "raster/primitives.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/algorithm/resize_image.h" +#include "doc/cel.h" +#include "doc/image.h" +#include "doc/mask.h" +#include "doc/primitives.h" +#include "doc/sprite.h" +#include "doc/stock.h" #include "ui/ui.h" #define PERC_FORMAT "%.1f" @@ -47,7 +47,7 @@ namespace app { using namespace ui; -using raster::algorithm::ResizeMethod; +using doc::algorithm::ResizeMethod; class SpriteSizeJob : public Job { ContextWriter m_writer; @@ -105,8 +105,8 @@ protected: int h = scale_y(image->height()); Image* new_image = Image::create(image->pixelFormat(), MAX(1, w), MAX(1, h)); - raster::algorithm::fixup_image_transparent_colors(image); - raster::algorithm::resize_image(image, new_image, + doc::algorithm::fixup_image_transparent_colors(image); + doc::algorithm::resize_image(image, new_image, m_resize_method, m_sprite->getPalette(cel->frame()), m_sprite->getRgbMap(cel->frame())); @@ -220,7 +220,7 @@ void SpriteSizeCommand::onExecute(Context* context) method->addItem("Nearest-neighbor"); method->addItem("Bilinear"); method->setSelectedItemIndex(get_config_int("SpriteSize", "Method", - raster::algorithm::RESIZE_METHOD_NEAREST_NEIGHBOR)); + doc::algorithm::RESIZE_METHOD_NEAREST_NEIGHBOR)); window->remapWindow(); window->centerWindow(); diff --git a/src/app/commands/cmd_undo.cpp b/src/app/commands/cmd_undo.cpp index 47b030f43..3fdc0aef6 100644 --- a/src/app/commands/cmd_undo.cpp +++ b/src/app/commands/cmd_undo.cpp @@ -32,7 +32,7 @@ #include "app/ui/editor/editor.h" #include "app/ui/status_bar.h" #include "base/thread.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/system.h" namespace app { diff --git a/src/app/commands/filters/cmd_color_curve.cpp b/src/app/commands/filters/cmd_color_curve.cpp index e5f057e82..334b279a8 100644 --- a/src/app/commands/filters/cmd_color_curve.cpp +++ b/src/app/commands/filters/cmd_color_curve.cpp @@ -33,8 +33,8 @@ #include "base/bind.h" #include "filters/color_curve.h" #include "filters/color_curve_filter.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/ui.h" namespace app { diff --git a/src/app/commands/filters/cmd_convolution_matrix.cpp b/src/app/commands/filters/cmd_convolution_matrix.cpp index 0512f3d43..8d3c0ffe0 100644 --- a/src/app/commands/filters/cmd_convolution_matrix.cpp +++ b/src/app/commands/filters/cmd_convolution_matrix.cpp @@ -35,8 +35,8 @@ #include "base/bind.h" #include "filters/convolution_matrix.h" #include "filters/convolution_matrix_filter.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/button.h" #include "ui/label.h" #include "ui/listbox.h" diff --git a/src/app/commands/filters/cmd_despeckle.cpp b/src/app/commands/filters/cmd_despeckle.cpp index ed633ef49..e569c4851 100644 --- a/src/app/commands/filters/cmd_despeckle.cpp +++ b/src/app/commands/filters/cmd_despeckle.cpp @@ -32,8 +32,8 @@ #include "app/settings/settings.h" #include "base/bind.h" #include "filters/median_filter.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/button.h" #include "ui/entry.h" #include "ui/grid.h" diff --git a/src/app/commands/filters/cmd_invert_color.cpp b/src/app/commands/filters/cmd_invert_color.cpp index 8b728ae9c..aebaa7a11 100644 --- a/src/app/commands/filters/cmd_invert_color.cpp +++ b/src/app/commands/filters/cmd_invert_color.cpp @@ -30,9 +30,9 @@ #include "filters/invert_color_filter.h" #include "app/ini_file.h" #include "app/modules/gui.h" -#include "raster/image.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/button.h" #include "ui/label.h" #include "ui/slider.h" diff --git a/src/app/commands/filters/cmd_replace_color.cpp b/src/app/commands/filters/cmd_replace_color.cpp index 1dfeabebf..ab36de629 100644 --- a/src/app/commands/filters/cmd_replace_color.cpp +++ b/src/app/commands/filters/cmd_replace_color.cpp @@ -36,9 +36,9 @@ #include "app/ui/color_button.h" #include "base/bind.h" #include "filters/replace_color_filter.h" -#include "raster/image.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/ui.h" namespace app { diff --git a/src/app/commands/filters/filter_manager_impl.cpp b/src/app/commands/filters/filter_manager_impl.cpp index 261c86f40..09b25b02c 100644 --- a/src/app/commands/filters/filter_manager_impl.cpp +++ b/src/app/commands/filters/filter_manager_impl.cpp @@ -29,13 +29,13 @@ #include "app/undo_transaction.h" #include "app/undoers/image_area.h" #include "filters/filter.h" -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/images_collector.h" -#include "raster/layer.h" -#include "raster/mask.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/image.h" +#include "doc/images_collector.h" +#include "doc/layer.h" +#include "doc/mask.h" +#include "doc/sprite.h" +#include "doc/stock.h" #include "ui/manager.h" #include "ui/view.h" #include "ui/widget.h" diff --git a/src/app/commands/filters/filter_manager_impl.h b/src/app/commands/filters/filter_manager_impl.h index cc689d807..f757159b7 100644 --- a/src/app/commands/filters/filter_manager_impl.h +++ b/src/app/commands/filters/filter_manager_impl.h @@ -25,13 +25,13 @@ #include "base/unique_ptr.h" #include "filters/filter_indexed_data.h" #include "filters/filter_manager.h" -#include "raster/image_bits.h" -#include "raster/image_traits.h" -#include "raster/pixel_format.h" +#include "doc/image_bits.h" +#include "doc/image_traits.h" +#include "doc/pixel_format.h" #include -namespace raster { +namespace doc { class Image; class Layer; class Mask; @@ -131,8 +131,8 @@ namespace app { int m_offset_x, m_offset_y; Mask* m_mask; base::UniquePtr m_preview_mask; - raster::ImageBits m_maskBits; - raster::ImageBits::iterator m_maskIterator; + doc::ImageBits m_maskBits; + doc::ImageBits::iterator m_maskIterator; Target m_targetOrig; // Original targets Target m_target; // Filtered targets diff --git a/src/app/commands/filters/filter_preview.cpp b/src/app/commands/filters/filter_preview.cpp index 40a767c81..ac776c091 100644 --- a/src/app/commands/filters/filter_preview.cpp +++ b/src/app/commands/filters/filter_preview.cpp @@ -23,7 +23,7 @@ #include "app/commands/filters/filter_preview.h" #include "app/commands/filters/filter_manager_impl.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/manager.h" #include "ui/message.h" #include "ui/widget.h" diff --git a/src/app/commands/filters/filter_target_buttons.cpp b/src/app/commands/filters/filter_target_buttons.cpp index e5e4f5dd7..96b6c5f60 100644 --- a/src/app/commands/filters/filter_target_buttons.cpp +++ b/src/app/commands/filters/filter_target_buttons.cpp @@ -26,7 +26,7 @@ #include "app/modules/gui.h" #include "app/ui/skin/skin_parts.h" #include "base/bind.h" -#include "raster/image.h" +#include "doc/image.h" #include "ui/box.h" #include "ui/button.h" #include "ui/theme.h" diff --git a/src/app/commands/filters/filter_worker.cpp b/src/app/commands/filters/filter_worker.cpp index 929ea119a..800fc510d 100644 --- a/src/app/commands/filters/filter_worker.cpp +++ b/src/app/commands/filters/filter_worker.cpp @@ -34,7 +34,7 @@ #include "base/mutex.h" #include "base/scoped_lock.h" #include "base/thread.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/ui.h" namespace app { diff --git a/src/app/context_flags.cpp b/src/app/context_flags.cpp index a648168ef..38df28ced 100644 --- a/src/app/context_flags.cpp +++ b/src/app/context_flags.cpp @@ -25,10 +25,10 @@ #include "app/context.h" #include "app/document.h" #include "app/document_location.h" -#include "raster/cel.h" -#include "raster/layer.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/layer.h" +#include "doc/sprite.h" +#include "doc/stock.h" namespace app { diff --git a/src/app/document.cpp b/src/app/document.cpp index 26bd9bcdc..220edddf4 100644 --- a/src/app/document.cpp +++ b/src/app/document.cpp @@ -36,17 +36,17 @@ #include "base/unique_ptr.h" #include "doc/document_event.h" #include "doc/document_observer.h" -#include "raster/cel.h" -#include "raster/layer.h" -#include "raster/mask.h" -#include "raster/palette.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/layer.h" +#include "doc/mask.h" +#include "doc/palette.h" +#include "doc/sprite.h" +#include "doc/stock.h" namespace app { using namespace base; -using namespace raster; +using namespace doc; Document::Document(Sprite* sprite) : m_undo(new DocumentUndo) diff --git a/src/app/document.h b/src/app/document.h index 4fc63ab7e..ad3940ebc 100644 --- a/src/app/document.h +++ b/src/app/document.h @@ -27,8 +27,8 @@ #include "base/unique_ptr.h" #include "doc/document.h" #include "gfx/transformation.h" -#include "raster/frame_number.h" -#include "raster/pixel_format.h" +#include "doc/frame_number.h" +#include "doc/pixel_format.h" #include @@ -36,7 +36,7 @@ namespace base { class mutex; } -namespace raster { +namespace doc { class Cel; class Image; class Layer; @@ -57,7 +57,7 @@ namespace app { class DocumentUndo; struct BoundSeg; - using namespace raster; + using namespace doc; enum DuplicateType { DuplicateExactCopy, diff --git a/src/app/document_api.cpp b/src/app/document_api.cpp index 7f293739c..7e7dc393c 100644 --- a/src/app/document_api.cpp +++ b/src/app/document_api.cpp @@ -62,19 +62,19 @@ #include "doc/context.h" #include "doc/document_event.h" #include "doc/document_observer.h" -#include "raster/algorithm/flip_image.h" -#include "raster/algorithm/shrink_bounds.h" -#include "raster/blend.h" -#include "raster/cel.h" -#include "raster/dirty.h" -#include "raster/image.h" -#include "raster/image_bits.h" -#include "raster/layer.h" -#include "raster/mask.h" -#include "raster/palette.h" -#include "raster/quantization.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/algorithm/flip_image.h" +#include "doc/algorithm/shrink_bounds.h" +#include "doc/blend.h" +#include "doc/cel.h" +#include "doc/dirty.h" +#include "doc/image.h" +#include "doc/image_bits.h" +#include "doc/layer.h" +#include "doc/mask.h" +#include "doc/palette.h" +#include "doc/quantization.h" +#include "doc/sprite.h" +#include "doc/stock.h" namespace app { @@ -147,7 +147,7 @@ void DocumentApi::trimSprite(Sprite* sprite) // TODO configurable (what color pixel to use as "refpixel", // here we are using the top-left pixel by default) gfx::Rect frameBounds; - if (raster::algorithm::shrink_bounds(image, frameBounds, get_pixel(image, 0, 0))) + if (doc::algorithm::shrink_bounds(image, frameBounds, get_pixel(image, 0, 0))) bounds = bounds.createUnion(frameBounds); } @@ -299,7 +299,7 @@ void DocumentApi::displaceFrames(Layer* layer, FrameNumber frame) switch (layer->type()) { - case OBJECT_LAYER_IMAGE: { + case ObjectType::LayerImage: { LayerImage* imglayer = static_cast(layer); // Displace all cels in '>=frame' to the next frame. @@ -318,7 +318,7 @@ void DocumentApi::displaceFrames(Layer* layer, FrameNumber frame) break; } - case OBJECT_LAYER_FOLDER: { + case ObjectType::LayerFolder: { LayerIterator it = static_cast(layer)->getLayerBegin(); LayerIterator end = static_cast(layer)->getLayerEnd(); @@ -337,13 +337,13 @@ void DocumentApi::copyFrameForLayer(Layer* layer, FrameNumber fromFrame, FrameNu switch (layer->type()) { - case OBJECT_LAYER_IMAGE: { + case ObjectType::LayerImage: { LayerImage* imglayer = static_cast(layer); copyCel(imglayer, fromFrame, imglayer, frame); break; } - case OBJECT_LAYER_FOLDER: { + case ObjectType::LayerFolder: { LayerIterator it = static_cast(layer)->getLayerBegin(); LayerIterator end = static_cast(layer)->getLayerEnd(); @@ -390,7 +390,7 @@ void DocumentApi::removeFrameOfLayer(Layer* layer, FrameNumber frame) switch (layer->type()) { - case OBJECT_LAYER_IMAGE: { + case ObjectType::LayerImage: { LayerImage* imglayer = static_cast(layer); if (Cel* cel = imglayer->getCel(frame)) removeCel(cel); @@ -401,7 +401,7 @@ void DocumentApi::removeFrameOfLayer(Layer* layer, FrameNumber frame) break; } - case OBJECT_LAYER_FOLDER: { + case ObjectType::LayerFolder: { LayerIterator it = static_cast(layer)->getLayerBegin(); LayerIterator end = static_cast(layer)->getLayerEnd(); @@ -501,7 +501,7 @@ void DocumentApi::moveFrameLayer(Layer* layer, FrameNumber frame, FrameNumber be switch (layer->type()) { - case OBJECT_LAYER_IMAGE: { + case ObjectType::LayerImage: { LayerImage* imglayer = static_cast(layer); CelList cels; @@ -542,7 +542,7 @@ void DocumentApi::moveFrameLayer(Layer* layer, FrameNumber frame, FrameNumber be break; } - case OBJECT_LAYER_FOLDER: { + case ObjectType::LayerFolder: { LayerIterator it = static_cast(layer)->getLayerBegin(); LayerIterator end = static_cast(layer)->getLayerEnd(); @@ -931,7 +931,7 @@ void DocumentApi::displaceLayers(Layer* layer, int dx, int dy) { switch (layer->type()) { - case OBJECT_LAYER_IMAGE: { + case ObjectType::LayerImage: { CelIterator it = ((LayerImage*)layer)->getCelBegin(); CelIterator end = ((LayerImage*)layer)->getCelEnd(); for (; it != end; ++it) { @@ -941,7 +941,7 @@ void DocumentApi::displaceLayers(Layer* layer, int dx, int dy) break; } - case OBJECT_LAYER_FOLDER: { + case ObjectType::LayerFolder: { LayerIterator it = ((LayerFolder*)layer)->getLayerBegin(); LayerIterator end = ((LayerFolder*)layer)->getLayerEnd(); for (; it != end; ++it) @@ -1259,7 +1259,7 @@ void DocumentApi::clearMask(Cel* cel) } void DocumentApi::flipImage(Image* image, const gfx::Rect& bounds, - raster::algorithm::FlipType flipType) + doc::algorithm::FlipType flipType) { // Insert the undo operation. if (undoEnabled()) { @@ -1269,16 +1269,16 @@ void DocumentApi::flipImage(Image* image, const gfx::Rect& bounds, } // Flip the portion of the bitmap. - raster::algorithm::flip_image(image, bounds, flipType); + doc::algorithm::flip_image(image, bounds, flipType); } -void DocumentApi::flipImageWithMask(Layer* layer, Image* image, const Mask* mask, raster::algorithm::FlipType flipType) +void DocumentApi::flipImageWithMask(Layer* layer, Image* image, const Mask* mask, doc::algorithm::FlipType flipType) { base::UniquePtr flippedImage((Image::createCopy(image))); color_t bgcolor = bgColor(layer); // Flip the portion of the bitmap. - raster::algorithm::flip_image_with_mask(flippedImage, mask, flipType, bgcolor); + doc::algorithm::flip_image_with_mask(flippedImage, mask, flipType, bgcolor); // Insert the undo operation. if (undoEnabled()) { @@ -1365,7 +1365,7 @@ bool DocumentApi::undoEnabled() m_document->getUndo()->isEnabled(); } -raster::color_t DocumentApi::bgColor() +doc::color_t DocumentApi::bgColor() { app::ISettings* appSettings = dynamic_cast(m_document->context()->settings()); @@ -1377,7 +1377,7 @@ raster::color_t DocumentApi::bgColor() m_document->sprite()->transparentColor())); } -raster::color_t DocumentApi::bgColor(Layer* layer) +doc::color_t DocumentApi::bgColor(Layer* layer) { app::ISettings* appSettings = dynamic_cast(m_document->context()->settings()); diff --git a/src/app/document_api.h b/src/app/document_api.h index 876683a34..3ca1f90a0 100644 --- a/src/app/document_api.h +++ b/src/app/document_api.h @@ -21,13 +21,13 @@ #pragma once #include "gfx/rect.h" -#include "raster/algorithm/flip_type.h" -#include "raster/color.h" -#include "raster/dithering_method.h" -#include "raster/frame_number.h" -#include "raster/pixel_format.h" +#include "doc/algorithm/flip_type.h" +#include "doc/color.h" +#include "doc/dithering_method.h" +#include "doc/frame_number.h" +#include "doc/pixel_format.h" -namespace raster { +namespace doc { class Cel; class Image; class Layer; @@ -46,12 +46,11 @@ namespace undo { namespace app { class Document; - using namespace raster; + using namespace doc; // High-level API to modify a document in an undoable and observable way. // Each method of this class take care of three important things: - // 1) Do the given action with low-level operations (raster - // namespace mainly), + // 1) Do the given action with low-level operations (doc namespace mainly), // 2) Add undoers so the action can be undone in the // future (undoers namespace mainly), // 3) Notify observers of the document that a change @@ -116,8 +115,8 @@ namespace app { // Image API void clearImage(Image* image, color_t bgcolor); void clearMask(Cel* cel); - void flipImage(Image* image, const gfx::Rect& bounds, raster::algorithm::FlipType flipType); - void flipImageWithMask(Layer* layer, Image* image, const Mask* mask, raster::algorithm::FlipType flipType); + void flipImage(Image* image, const gfx::Rect& bounds, doc::algorithm::FlipType flipType); + void flipImageWithMask(Layer* layer, Image* image, const Mask* mask, doc::algorithm::FlipType flipType); void pasteImage(Sprite* sprite, Cel* cel, const Image* src_image, int x, int y, int opacity); // Mask API @@ -139,8 +138,8 @@ namespace app { void configureLayerAsBackground(LayerImage* layer); bool undoEnabled(); - raster::color_t bgColor(); - raster::color_t bgColor(Layer* layer); + doc::color_t bgColor(); + doc::color_t bgColor(Layer* layer); Document* m_document; undo::UndoersCollector* m_undoers; diff --git a/src/app/document_exporter.cpp b/src/app/document_exporter.cpp index e5c4626e4..129b3a30f 100644 --- a/src/app/document_exporter.cpp +++ b/src/app/document_exporter.cpp @@ -30,19 +30,19 @@ #include "base/path.h" #include "base/unique_ptr.h" #include "gfx/size.h" -#include "raster/cel.h" -#include "raster/dithering_method.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/palette.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/dithering_method.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/palette.h" +#include "doc/sprite.h" +#include "doc/stock.h" #include #include #include -using namespace raster; +using namespace doc; namespace app { diff --git a/src/app/document_exporter.h b/src/app/document_exporter.h index 434478c1f..4538a7648 100644 --- a/src/app/document_exporter.h +++ b/src/app/document_exporter.h @@ -27,7 +27,7 @@ #include #include -namespace raster { +namespace doc { class Image; } @@ -94,8 +94,8 @@ namespace app { void captureSamples(Samples& samples); Document* createEmptyTexture(const Samples& samples); - void renderTexture(const Samples& samples, raster::Image* textureImage); - void createDataFile(const Samples& samples, std::ostream& os, raster::Image* textureImage); + void renderTexture(const Samples& samples, doc::Image* textureImage); + void createDataFile(const Samples& samples, std::ostream& os, doc::Image* textureImage); DataFormat m_dataFormat; std::string m_dataFilename; diff --git a/src/app/document_location.cpp b/src/app/document_location.cpp index 90a93f777..cdb05058b 100644 --- a/src/app/document_location.cpp +++ b/src/app/document_location.cpp @@ -22,14 +22,14 @@ #include "app/document_location.h" -#include "raster/cel.h" -#include "raster/layer.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/layer.h" +#include "doc/sprite.h" +#include "doc/stock.h" namespace app { -using namespace raster; +using namespace doc; LayerIndex DocumentLocation::layerIndex() const { diff --git a/src/app/document_location.h b/src/app/document_location.h index 10ed1567a..5b485bcb4 100644 --- a/src/app/document_location.h +++ b/src/app/document_location.h @@ -20,10 +20,10 @@ #define APP_DOCUMENT_LOCATION_H_INCLUDED #pragma once -#include "raster/frame_number.h" -#include "raster/layer_index.h" +#include "doc/frame_number.h" +#include "doc/layer_index.h" -namespace raster { +namespace doc { class Cel; class Image; class Layer; @@ -34,7 +34,7 @@ namespace raster { namespace app { class Document; - using namespace raster; + using namespace doc; // Specifies the current location in a context. If we are in the // UIContext, it means the location in the current Editor (current diff --git a/src/app/document_range.cpp b/src/app/document_range.cpp index 39721a08c..d8413b441 100644 --- a/src/app/document_range.cpp +++ b/src/app/document_range.cpp @@ -24,7 +24,7 @@ namespace app { -using namespace raster; +using namespace doc; void DocumentRange::startRange(LayerIndex layer, FrameNumber frame, Type type) { diff --git a/src/app/document_range.h b/src/app/document_range.h index fdc36dc14..79ae5415b 100644 --- a/src/app/document_range.h +++ b/src/app/document_range.h @@ -20,13 +20,13 @@ #define APP_DOCUMENT_RANGE_H_INCLUDED #pragma once -#include "raster/frame_number.h" -#include "raster/layer_index.h" +#include "doc/frame_number.h" +#include "doc/layer_index.h" #include namespace app { - using namespace raster; + using namespace doc; class DocumentRange { public: diff --git a/src/app/document_range_ops.cpp b/src/app/document_range_ops.cpp index 764328c02..6a284f74a 100644 --- a/src/app/document_range_ops.cpp +++ b/src/app/document_range_ops.cpp @@ -27,8 +27,8 @@ #include "app/document_api.h" #include "app/document_range.h" #include "app/undo_transaction.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/sprite.h" #include diff --git a/src/app/document_range_tests.cpp b/src/app/document_range_tests.cpp index 3aff49e82..18a682272 100644 --- a/src/app/document_range_tests.cpp +++ b/src/app/document_range_tests.cpp @@ -25,11 +25,11 @@ #include "app/document_undo.h" #include "app/test_context.h" #include "base/unique_ptr.h" -#include "raster/raster.h" +#include "doc/doc.h" #include "undo/undo_history.h" using namespace app; -using namespace raster; +using namespace doc; namespace app { @@ -40,7 +40,7 @@ namespace app { } -typedef base::UniquePtr DocumentPtr; +typedef base::UniquePtr DocumentPtr; #define EXPECT_LAYER_ORDER(a, b, c, d) \ EXPECT_TRUE(expect_layer(a, 0)); \ @@ -84,7 +84,7 @@ public: black = rgba(0, 0, 0, 0); white = rgba(255, 255, 255, 255); - doc.reset(static_cast(ctx.documents().add(4, 4))); + doc.reset(static_cast(ctx.documents().add(4, 4))); sprite = doc->sprite(); layer1 = dynamic_cast(sprite->folder()->getFirstLayer()); layer2 = new LayerImage(sprite); diff --git a/src/app/document_undo.h b/src/app/document_undo.h index 75ecf305c..cf64183e9 100644 --- a/src/app/document_undo.h +++ b/src/app/document_undo.h @@ -22,7 +22,7 @@ #include "base/disable_copying.h" #include "base/unique_ptr.h" -#include "raster/sprite_position.h" +#include "doc/sprite_position.h" #include "undo/undo_history.h" namespace doc { @@ -39,7 +39,7 @@ namespace app { class CloseGroup; } - using namespace raster; + using namespace doc; class DocumentUndo : public undo::UndoHistoryDelegate { public: diff --git a/src/app/file/ase_format.cpp b/src/app/file/ase_format.cpp index 9eb443c94..dbf607b48 100644 --- a/src/app/file/ase_format.cpp +++ b/src/app/file/ase_format.cpp @@ -27,7 +27,7 @@ #include "base/cfile.h" #include "base/exception.h" #include "base/file_handle.h" -#include "raster/raster.h" +#include "doc/doc.h" #include "zlib.h" #include diff --git a/src/app/file/bmp_format.cpp b/src/app/file/bmp_format.cpp index 5c83c07e3..c61b1d943 100644 --- a/src/app/file/bmp_format.cpp +++ b/src/app/file/bmp_format.cpp @@ -27,7 +27,7 @@ #include "app/file/format_options.h" #include "base/cfile.h" #include "base/file_handle.h" -#include "raster/raster.h" +#include "doc/doc.h" namespace app { diff --git a/src/app/file/file.cpp b/src/app/file/file.cpp index 1961d9a09..cc4868218 100644 --- a/src/app/file/file.cpp +++ b/src/app/file/file.cpp @@ -38,8 +38,8 @@ #include "base/scoped_lock.h" #include "base/shared_ptr.h" #include "base/string.h" -#include "raster/quantization.h" -#include "raster/raster.h" +#include "doc/quantization.h" +#include "doc/doc.h" #include "ui/alert.h" #include diff --git a/src/app/file/file.h b/src/app/file/file.h index 35dd7788c..7dbb93b2d 100644 --- a/src/app/file/file.h +++ b/src/app/file/file.h @@ -21,8 +21,8 @@ #pragma once #include "base/shared_ptr.h" -#include "raster/frame_number.h" -#include "raster/pixel_format.h" +#include "doc/frame_number.h" +#include "doc/pixel_format.h" #include #include @@ -41,7 +41,7 @@ namespace doc { class Document; } -namespace raster { +namespace doc { class Cel; class Image; class Layer; @@ -56,7 +56,7 @@ namespace app { class FileFormat; class FormatOptions; - using namespace raster; + using namespace doc; // File operations. typedef enum { diff --git a/src/app/file/file_tests.cpp b/src/app/file/file_tests.cpp index 160234701..1255c80cd 100644 --- a/src/app/file/file_tests.cpp +++ b/src/app/file/file_tests.cpp @@ -23,7 +23,7 @@ #include "app/document.h" #include "app/file/file.h" #include "app/file/file_formats_manager.h" -#include "raster/raster.h" +#include "doc/doc.h" #include "she/she.h" #include @@ -69,7 +69,7 @@ TEST(File, SeveralSizes) } { - Document* doc = load_document(&ctx, &fn[0]); + app::Document* doc = load_document(&ctx, &fn[0]); ASSERT_EQ(w, doc->sprite()->width()); ASSERT_EQ(h, doc->sprite()->height()); diff --git a/src/app/file/fli_format.cpp b/src/app/file/fli_format.cpp index e887fe7ea..ac70ed380 100644 --- a/src/app/file/fli_format.cpp +++ b/src/app/file/fli_format.cpp @@ -27,7 +27,7 @@ #include "app/file/format_options.h" #include "app/modules/palettes.h" #include "base/file_handle.h" -#include "raster/raster.h" +#include "doc/doc.h" #include diff --git a/src/app/file/gif_format.cpp b/src/app/file/gif_format.cpp index d92794348..d714b8755 100644 --- a/src/app/file/gif_format.cpp +++ b/src/app/file/gif_format.cpp @@ -32,7 +32,7 @@ #include "app/util/autocrop.h" #include "base/file_handle.h" #include "base/unique_ptr.h" -#include "raster/raster.h" +#include "doc/doc.h" #include "ui/alert.h" #include "ui/button.h" @@ -614,7 +614,7 @@ bool GifFormat::onSave(FileOp* fop) if (sprite_format != IMAGE_INDEXED && gif_options->quantize() == GifOptions::QuantizeAll) { // Feed the optimizer with all rendered frames. - raster::quantization::PaletteOptimizer optimizer; + doc::quantization::PaletteOptimizer optimizer; for (FrameNumber frame_num(0); frame_numtotalFrames(); ++frame_num) { clear_image(buffer_image, background_color); layer_render(sprite->folder(), buffer_image, 0, 0, frame_num); @@ -644,7 +644,7 @@ bool GifFormat::onSave(FileOp* fop) std::vector imgarray(1); imgarray[0] = buffer_image; - raster::quantization::create_palette_from_images(imgarray, ¤t_palette, has_background); + doc::quantization::create_palette_from_images(imgarray, ¤t_palette, has_background); rgbmap.regenerate(¤t_palette, transparent_index); } break; @@ -811,7 +811,7 @@ SharedPtr GifFormat::onGetFormatOptions(FileOp* fop) // Configuration parameters gif_options->setQuantize((GifOptions::Quantize)get_config_int("GIF", "Quantize", (int)gif_options->quantize())); gif_options->setInterlaced(get_config_bool("GIF", "Interlaced", gif_options->interlaced())); - gif_options->setDithering((raster::DitheringMethod)get_config_int("GIF", "Dither", (int)gif_options->dithering())); + gif_options->setDithering((doc::DitheringMethod)get_config_int("GIF", "Dither", (int)gif_options->dithering())); // Load the window to ask to the user the GIF options he wants. @@ -826,7 +826,7 @@ SharedPtr GifFormat::onGetFormatOptions(FileOp* fop) win.interlaced()->setSelected(gif_options->interlaced()); win.dither()->setEnabled(true); - win.dither()->setSelected(gif_options->dithering() == raster::DITHERING_ORDERED); + win.dither()->setSelected(gif_options->dithering() == doc::DITHERING_ORDERED); win.openWindowInForeground(); @@ -840,8 +840,8 @@ SharedPtr GifFormat::onGetFormatOptions(FileOp* fop) gif_options->setInterlaced(win.interlaced()->isSelected()); gif_options->setDithering(win.dither()->isSelected() ? - raster::DITHERING_ORDERED: - raster::DITHERING_NONE); + doc::DITHERING_ORDERED: + doc::DITHERING_NONE); set_config_int("GIF", "Quantize", gif_options->quantize()); set_config_bool("GIF", "Interlaced", gif_options->interlaced()); diff --git a/src/app/file/gif_options.h b/src/app/file/gif_options.h index ba723934b..a33dbb0f3 100644 --- a/src/app/file/gif_options.h +++ b/src/app/file/gif_options.h @@ -21,7 +21,7 @@ #pragma once #include "app/file/format_options.h" -#include "raster/dithering_method.h" +#include "doc/dithering_method.h" namespace app { @@ -33,7 +33,7 @@ namespace app { GifOptions( Quantize quantize = QuantizeEach, bool interlaced = false, - DitheringMethod dithering = raster::DITHERING_NONE) + DitheringMethod dithering = doc::DITHERING_NONE) : m_quantize(quantize) , m_interlaced(interlaced) , m_dithering(dithering) { @@ -41,16 +41,16 @@ namespace app { Quantize quantize() const { return m_quantize; } bool interlaced() const { return m_interlaced; } - raster::DitheringMethod dithering() const { return m_dithering; } + doc::DitheringMethod dithering() const { return m_dithering; } void setQuantize(const Quantize quantize) { m_quantize = quantize; } void setInterlaced(bool interlaced) { m_interlaced = interlaced; } - void setDithering(const raster::DitheringMethod dithering) { m_dithering = dithering; } + void setDithering(const doc::DitheringMethod dithering) { m_dithering = dithering; } private: Quantize m_quantize; bool m_interlaced; - raster::DitheringMethod m_dithering; + doc::DitheringMethod m_dithering; }; } // namespace app diff --git a/src/app/file/gif_tests.cpp b/src/app/file/gif_tests.cpp index ee33b1f51..0edef1676 100644 --- a/src/app/file/gif_tests.cpp +++ b/src/app/file/gif_tests.cpp @@ -24,7 +24,7 @@ #include "app/file/file_formats_manager.h" #include "app/file/gif_options.h" #include "app/test_context.h" -#include "raster/raster.h" +#include "doc/doc.h" #include "she/scoped_handle.h" #include "she/system.h" @@ -64,7 +64,7 @@ TEST_F(GifFormat, Dimensions) } { - Document* doc = load_document(&m_ctx, fn); + app::Document* doc = load_document(&m_ctx, fn); Sprite* sprite = doc->sprite(); EXPECT_EQ(31, sprite->width()); @@ -111,7 +111,7 @@ TEST_F(GifFormat, OpaqueIndexed) } { - Document* doc = load_document(&m_ctx, fn); + app::Document* doc = load_document(&m_ctx, fn); Sprite* sprite = doc->sprite(); LayerImage* layer = dynamic_cast(sprite->folder()->getFirstLayer()); @@ -167,7 +167,7 @@ TEST_F(GifFormat, TransparentIndexed) } { - Document* doc = load_document(&m_ctx, fn); + app::Document* doc = load_document(&m_ctx, fn); Sprite* sprite = doc->sprite(); LayerImage* layer = dynamic_cast(sprite->folder()->getFirstLayer()); @@ -217,7 +217,7 @@ TEST_F(GifFormat, TransparentRgbQuantization) } { - Document* doc = load_document(&m_ctx, fn); + app::Document* doc = load_document(&m_ctx, fn); Sprite* sprite = doc->sprite(); LayerImage* layer = dynamic_cast(sprite->folder()->getFirstLayer()); @@ -263,7 +263,7 @@ TEST_F(GifFormat, OpaqueRgbQuantization) } { - Document* doc = load_document(&m_ctx, fn); + app::Document* doc = load_document(&m_ctx, fn); Sprite* sprite = doc->sprite(); LayerImage* layer = dynamic_cast(sprite->folder()->getFirstLayer()); @@ -289,7 +289,7 @@ TEST_F(GifFormat, OpaqueRgbQuantizationTwoLayers) const char* fn = "test.gif"; { - Document* doc(static_cast(m_ctx.documents().add(2, 2, doc::ColorMode::RGB, 256))); + app::Document* doc(static_cast(m_ctx.documents().add(2, 2, doc::ColorMode::RGB, 256))); Sprite* sprite = doc->sprite(); doc->setFilename(fn); @@ -322,7 +322,7 @@ TEST_F(GifFormat, OpaqueRgbQuantizationTwoLayers) } { - Document* doc = load_document(&m_ctx, fn); + app::Document* doc = load_document(&m_ctx, fn); Sprite* sprite = doc->sprite(); LayerImage* layer = dynamic_cast(sprite->folder()->getFirstLayer()); diff --git a/src/app/file/ico_format.cpp b/src/app/file/ico_format.cpp index c03abea34..6d7b1334a 100644 --- a/src/app/file/ico_format.cpp +++ b/src/app/file/ico_format.cpp @@ -28,7 +28,7 @@ #include "app/file/format_options.h" #include "base/cfile.h" #include "base/file_handle.h" -#include "raster/raster.h" +#include "doc/doc.h" namespace app { diff --git a/src/app/file/jpeg_format.cpp b/src/app/file/jpeg_format.cpp index a45f6dfaa..8a9c48ccb 100644 --- a/src/app/file/jpeg_format.cpp +++ b/src/app/file/jpeg_format.cpp @@ -33,7 +33,7 @@ #include "app/load_widget.h" #include "base/file_handle.h" #include "base/memory.h" -#include "raster/raster.h" +#include "doc/doc.h" #include "ui/ui.h" #include diff --git a/src/app/file/palette_file.cpp b/src/app/file/palette_file.cpp index 97a8361e7..3c2a9c441 100644 --- a/src/app/file/palette_file.cpp +++ b/src/app/file/palette_file.cpp @@ -27,17 +27,17 @@ #include "app/file/file_formats_manager.h" #include "base/path.h" #include "base/string.h" -#include "raster/cel.h" -#include "raster/file/col_file.h" -#include "raster/file/gpl_file.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/palette.h" -#include "raster/sprite.h" +#include "doc/cel.h" +#include "doc/file/col_file.h" +#include "doc/file/gpl_file.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/palette.h" +#include "doc/sprite.h" namespace app { -using namespace raster; +using namespace doc; void get_readable_palette_extensions(char* buf, int size) { @@ -57,10 +57,10 @@ Palette* load_palette(const char *filename) Palette* pal = NULL; if (ext == "col") { - pal = raster::file::load_col_file(filename); + pal = doc::file::load_col_file(filename); } else if (ext == "gpl") { - pal = raster::file::load_gpl_file(filename); + pal = doc::file::load_gpl_file(filename); } else { FileFormat* ff = FileFormatsManager::instance()->getFileFormatByExtension(ext.c_str()); @@ -101,10 +101,10 @@ bool save_palette(const char *filename, Palette* pal) bool success = false; if (ext == "col") { - success = raster::file::save_col_file(pal, filename); + success = doc::file::save_col_file(pal, filename); } else if (ext == "gpl") { - success = raster::file::save_gpl_file(pal, filename); + success = doc::file::save_gpl_file(pal, filename); } else { FileFormat* ff = FileFormatsManager::instance()->getFileFormatByExtension(ext.c_str()); diff --git a/src/app/file/palette_file.h b/src/app/file/palette_file.h index 39579ef44..44ae6470d 100644 --- a/src/app/file/palette_file.h +++ b/src/app/file/palette_file.h @@ -20,7 +20,7 @@ #define APP_FILE_PALETTE_FILE_H_INCLUDED #pragma once -namespace raster { +namespace doc { class Palette; } @@ -29,8 +29,8 @@ namespace app { void get_readable_palette_extensions(char* buf, int size); void get_writable_palette_extensions(char* buf, int size); - raster::Palette* load_palette(const char *filename); - bool save_palette(const char *filename, raster::Palette* pal); + doc::Palette* load_palette(const char *filename); + bool save_palette(const char *filename, doc::Palette* pal); } // namespace app diff --git a/src/app/file/pcx_format.cpp b/src/app/file/pcx_format.cpp index 8f197e281..9380914f0 100644 --- a/src/app/file/pcx_format.cpp +++ b/src/app/file/pcx_format.cpp @@ -27,7 +27,7 @@ #include "app/file/format_options.h" #include "base/cfile.h" #include "base/file_handle.h" -#include "raster/raster.h" +#include "doc/doc.h" namespace app { diff --git a/src/app/file/png_format.cpp b/src/app/file/png_format.cpp index 9cf95884b..98a9900f5 100644 --- a/src/app/file/png_format.cpp +++ b/src/app/file/png_format.cpp @@ -27,7 +27,7 @@ #include "app/file/format_options.h" #include "app/ini_file.h" #include "base/file_handle.h" -#include "raster/raster.h" +#include "doc/doc.h" #include #include diff --git a/src/app/file/tga_format.cpp b/src/app/file/tga_format.cpp index 8387cc060..72d4aa8c8 100644 --- a/src/app/file/tga_format.cpp +++ b/src/app/file/tga_format.cpp @@ -28,7 +28,7 @@ #include "app/file/format_options.h" #include "base/cfile.h" #include "base/file_handle.h" -#include "raster/raster.h" +#include "doc/doc.h" namespace app { diff --git a/src/app/flatten.cpp b/src/app/flatten.cpp index 84ebda2af..8554c872f 100644 --- a/src/app/flatten.cpp +++ b/src/app/flatten.cpp @@ -22,16 +22,16 @@ #include "base/unique_ptr.h" #include "gfx/rect.h" -#include "raster/cel.h" -#include "raster/frame_number.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/frame_number.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/sprite.h" +#include "doc/stock.h" namespace app { -using namespace raster; +using namespace doc; static bool has_cels(const Layer* layer, FrameNumber frame); @@ -77,10 +77,10 @@ static bool has_cels(const Layer* layer, FrameNumber frame) switch (layer->type()) { - case OBJECT_LAYER_IMAGE: + case ObjectType::LayerImage: return static_cast(layer)->getCel(frame) ? true: false; - case OBJECT_LAYER_FOLDER: { + case ObjectType::LayerFolder: { LayerConstIterator it = static_cast(layer)->getLayerBegin(); LayerConstIterator end = static_cast(layer)->getLayerEnd(); diff --git a/src/app/flatten.h b/src/app/flatten.h index 165e47e79..a9051c4ff 100644 --- a/src/app/flatten.h +++ b/src/app/flatten.h @@ -21,9 +21,9 @@ #pragma once #include "gfx/rect.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" -namespace raster { +namespace doc { class Sprite; class Layer; class LayerImage; diff --git a/src/app/handle_anidir.cpp b/src/app/handle_anidir.cpp index cbd7ca256..418d4b7a4 100644 --- a/src/app/handle_anidir.cpp +++ b/src/app/handle_anidir.cpp @@ -23,13 +23,13 @@ #include "app/handle_anidir.h" #include "app/settings/document_settings.h" -#include "raster/sprite.h" +#include "doc/sprite.h" namespace app { -raster::FrameNumber calculate_next_frame( - raster::Sprite* sprite, - raster::FrameNumber frame, +doc::FrameNumber calculate_next_frame( + doc::Sprite* sprite, + doc::FrameNumber frame, IDocumentSettings* docSettings, bool& pingPongForward) { diff --git a/src/app/handle_anidir.h b/src/app/handle_anidir.h index 1c1a1d3ba..1792cb277 100644 --- a/src/app/handle_anidir.h +++ b/src/app/handle_anidir.h @@ -20,9 +20,9 @@ #define APP_HANDLE_ANIDIR_H_INCLUDED #pragma once -#include "raster/frame_number.h" +#include "doc/frame_number.h" -namespace raster { +namespace doc { class Sprite; } @@ -30,9 +30,9 @@ namespace app { class IDocumentSettings; - raster::FrameNumber calculate_next_frame( - raster::Sprite* sprite, - raster::FrameNumber frame, + doc::FrameNumber calculate_next_frame( + doc::Sprite* sprite, + doc::FrameNumber frame, IDocumentSettings* docSettings, bool& pingPongForward); diff --git a/src/app/modules/gfx.cpp b/src/app/modules/gfx.cpp index 67dc735bf..012d4016c 100644 --- a/src/app/modules/gfx.cpp +++ b/src/app/modules/gfx.cpp @@ -35,9 +35,9 @@ #include "app/ui/skin/skin_theme.h" #include "gfx/point.h" #include "gfx/rect.h" -#include "raster/blend.h" -#include "raster/image.h" -#include "raster/palette.h" +#include "doc/blend.h" +#include "doc/image.h" +#include "doc/palette.h" namespace app { diff --git a/src/app/modules/gfx.h b/src/app/modules/gfx.h index e61e83f16..30b00fb57 100644 --- a/src/app/modules/gfx.h +++ b/src/app/modules/gfx.h @@ -27,7 +27,7 @@ #include "ui/graphics.h" namespace app { - using namespace raster; + using namespace doc; void draw_color_button(ui::Graphics* g, const gfx::Rect& rc, const app::Color& color, diff --git a/src/app/modules/gui.cpp b/src/app/modules/gui.cpp index 2f619ebd1..060861159 100644 --- a/src/app/modules/gui.cpp +++ b/src/app/modules/gui.cpp @@ -48,7 +48,7 @@ #include "base/memory.h" #include "base/shared_ptr.h" #include "base/unique_ptr.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "she/clipboard.h" #include "she/display.h" #include "she/error.h" diff --git a/src/app/modules/palettes.cpp b/src/app/modules/palettes.cpp index fb73279ac..b789d3224 100644 --- a/src/app/modules/palettes.cpp +++ b/src/app/modules/palettes.cpp @@ -22,10 +22,10 @@ #include "app/app.h" #include "app/modules/palettes.h" -#include "raster/blend.h" -#include "raster/image.h" -#include "raster/palette.h" -#include "raster/sprite.h" +#include "doc/blend.h" +#include "doc/image.h" +#include "doc/palette.h" +#include "doc/sprite.h" #include diff --git a/src/app/modules/palettes.h b/src/app/modules/palettes.h index bd9d27db8..a299fa9d0 100644 --- a/src/app/modules/palettes.h +++ b/src/app/modules/palettes.h @@ -20,12 +20,12 @@ #define APP_MODULES_PALETTES_H_INCLUDED #pragma once -namespace raster { +namespace doc { class Palette; } namespace app { - using namespace raster; + using namespace doc; int init_module_palette(); void exit_module_palette(); diff --git a/src/app/res/palette_resource.h b/src/app/res/palette_resource.h index b9f5fc167..126faaf7c 100644 --- a/src/app/res/palette_resource.h +++ b/src/app/res/palette_resource.h @@ -22,7 +22,7 @@ #include "app/res/resource.h" -namespace raster { +namespace doc { class Palette; } @@ -30,16 +30,16 @@ namespace app { class PaletteResource : public Resource { public: - PaletteResource(raster::Palette* palette, const std::string& name) + PaletteResource(doc::Palette* palette, const std::string& name) : m_palette(palette) , m_name(name) { } virtual ~PaletteResource() { } - virtual raster::Palette* palette() { return m_palette; } + virtual doc::Palette* palette() { return m_palette; } virtual const std::string& name() const override { return m_name; } private: - raster::Palette* m_palette; + doc::Palette* m_palette; std::string m_name; }; diff --git a/src/app/res/palettes_loader_delegate.cpp b/src/app/res/palettes_loader_delegate.cpp index 79309da75..716de68a9 100644 --- a/src/app/res/palettes_loader_delegate.cpp +++ b/src/app/res/palettes_loader_delegate.cpp @@ -30,7 +30,7 @@ #include "base/fs.h" #include "base/path.h" #include "base/scoped_value.h" -#include "raster/palette.h" +#include "doc/palette.h" namespace app { @@ -50,7 +50,7 @@ std::string PalettesLoaderDelegate::resourcesLocation() const Resource* PalettesLoaderDelegate::loadResource(const std::string& filename) { - raster::Palette* palette = load_palette(filename.c_str()); + doc::Palette* palette = load_palette(filename.c_str()); if (!palette) return NULL; diff --git a/src/app/settings/document_settings.h b/src/app/settings/document_settings.h index 3b4d45cfc..e618113a9 100644 --- a/src/app/settings/document_settings.h +++ b/src/app/settings/document_settings.h @@ -24,7 +24,7 @@ #include "filters/tiled_mode.h" #include "gfx/point.h" #include "gfx/rect.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" namespace app { class DocumentSettingsObserver; @@ -92,11 +92,11 @@ namespace app { }; virtual bool getLoopAnimation() = 0; - virtual void getLoopRange(raster::FrameNumber* begin, raster::FrameNumber* end) = 0; + virtual void getLoopRange(doc::FrameNumber* begin, doc::FrameNumber* end) = 0; virtual AniDir getAnimationDirection() = 0; virtual void setLoopAnimation(bool state) = 0; - virtual void setLoopRange(raster::FrameNumber begin, raster::FrameNumber end) = 0; + virtual void setLoopRange(doc::FrameNumber begin, doc::FrameNumber end) = 0; virtual void setAnimationDirection(AniDir dir) = 0; // Observable diff --git a/src/app/settings/settings.h b/src/app/settings/settings.h index 45a60b7f5..1b8796f9c 100644 --- a/src/app/settings/settings.h +++ b/src/app/settings/settings.h @@ -29,7 +29,7 @@ #include "doc/settings.h" #include "gfx/point.h" #include "gfx/rect.h" -#include "raster/brush_type.h" +#include "doc/brush_type.h" namespace doc { class Document; @@ -137,7 +137,7 @@ namespace app { public: virtual ~IBrushSettings() { } - virtual raster::BrushType getType() = 0; + virtual doc::BrushType getType() = 0; virtual int getSize() = 0; virtual int getAngle() = 0; diff --git a/src/app/settings/settings_observers.h b/src/app/settings/settings_observers.h index c8c3f2ab0..bdb74a3a6 100644 --- a/src/app/settings/settings_observers.h +++ b/src/app/settings/settings_observers.h @@ -27,7 +27,7 @@ #include "app/settings/selection_mode.h" #include "filters/tiled_mode.h" #include "gfx/fwd.h" -#include "raster/brush_type.h" +#include "doc/brush_type.h" namespace app { class Color; @@ -42,7 +42,7 @@ namespace app { virtual ~BrushSettingsObserver() {} virtual void onSetBrushSize(int newSize) {} - virtual void onSetBrushType(raster::BrushType newType) {} + virtual void onSetBrushType(doc::BrushType newType) {} virtual void onSetBrushAngle(int newAngle) {} }; diff --git a/src/app/settings/ui_settings_impl.cpp b/src/app/settings/ui_settings_impl.cpp index e74a18b59..176dcc347 100644 --- a/src/app/settings/ui_settings_impl.cpp +++ b/src/app/settings/ui_settings_impl.cpp @@ -51,7 +51,7 @@ namespace app { using namespace gfx; -using namespace raster; +using namespace doc; using namespace filters; namespace { @@ -190,11 +190,11 @@ public: // Animation virtual bool getLoopAnimation() override; - virtual void getLoopRange(raster::FrameNumber* begin, raster::FrameNumber* end) override; + virtual void getLoopRange(doc::FrameNumber* begin, doc::FrameNumber* end) override; virtual AniDir getAnimationDirection() override; virtual void setLoopAnimation(bool state) override; - virtual void setLoopRange(raster::FrameNumber begin, raster::FrameNumber end) override; + virtual void setLoopRange(doc::FrameNumber begin, doc::FrameNumber end) override; virtual void setAnimationDirection(AniDir dir) override; virtual void addObserver(DocumentSettingsObserver* observer) override; @@ -245,8 +245,8 @@ private: bool m_pixelGridVisible; app::Color m_pixelGridColor; bool m_isLoop; - raster::FrameNumber m_loopBegin; - raster::FrameNumber m_loopEnd; + doc::FrameNumber m_loopBegin; + doc::FrameNumber m_loopEnd; AniDir m_aniDir; }; @@ -691,7 +691,7 @@ bool UIDocumentSettingsImpl::getLoopAnimation() return m_isLoop; } -void UIDocumentSettingsImpl::getLoopRange(raster::FrameNumber* begin, raster::FrameNumber* end) +void UIDocumentSettingsImpl::getLoopRange(doc::FrameNumber* begin, doc::FrameNumber* end) { *begin = m_loopBegin; *end = m_loopEnd; @@ -708,7 +708,7 @@ void UIDocumentSettingsImpl::setLoopAnimation(bool state) redrawDocumentViews(); } -void UIDocumentSettingsImpl::setLoopRange(raster::FrameNumber begin, raster::FrameNumber end) +void UIDocumentSettingsImpl::setLoopRange(doc::FrameNumber begin, doc::FrameNumber end) { m_loopBegin = begin; m_loopEnd = end; diff --git a/src/app/test_context.h b/src/app/test_context.h index 471b40d44..e49683906 100644 --- a/src/app/test_context.h +++ b/src/app/test_context.h @@ -23,7 +23,7 @@ #include "app/context.h" #include "app/document_location.h" #include "doc/settings.h" -#include "raster/layer.h" +#include "doc/layer.h" namespace app { diff --git a/src/app/thumbnail_generator.cpp b/src/app/thumbnail_generator.cpp index eed6d4e2f..c0ac820f8 100644 --- a/src/app/thumbnail_generator.cpp +++ b/src/app/thumbnail_generator.cpp @@ -30,12 +30,12 @@ #include "base/bind.h" #include "base/scoped_lock.h" #include "base/thread.h" -#include "raster/conversion_she.h" -#include "raster/image.h" -#include "raster/palette.h" -#include "raster/primitives.h" -#include "raster/rotate.h" -#include "raster/sprite.h" +#include "doc/algorithm/rotate.h" +#include "doc/conversion_she.h" +#include "doc/image.h" +#include "doc/palette.h" +#include "doc/primitives.h" +#include "doc/sprite.h" #include "she/system.h" #define MAX_THUMBNAIL_SIZE 128 @@ -100,7 +100,7 @@ private: // Stretch the 'image' m_thumbnail.reset(Image::create(image->pixelFormat(), thumb_w, thumb_h)); clear_image(m_thumbnail, 0); - image_scale(m_thumbnail, image, 0, 0, thumb_w, thumb_h); + algorithm::scale_image(m_thumbnail, image, 0, 0, thumb_w, thumb_h); } // Close file diff --git a/src/app/tools/ink_processing.h b/src/app/tools/ink_processing.h index a18d4dce8..bb0fd5afe 100644 --- a/src/app/tools/ink_processing.h +++ b/src/app/tools/ink_processing.h @@ -21,9 +21,9 @@ #include "app/tools/shade_table.h" #include "app/tools/shading_options.h" #include "filters/neighboring_pixels.h" -#include "raster/palette.h" -#include "raster/rgbmap.h" -#include "raster/sprite.h" +#include "doc/palette.h" +#include "doc/rgbmap.h" +#include "doc/sprite.h" namespace app { namespace tools { diff --git a/src/app/tools/inks.h b/src/app/tools/inks.h index 78ccec98d..596dc7024 100644 --- a/src/app/tools/inks.h +++ b/src/app/tools/inks.h @@ -26,7 +26,7 @@ #include "app/settings/settings.h" #include "app/tools/pick_ink.h" #include "app/undoers/set_mask.h" -#include "raster/mask.h" +#include "doc/mask.h" namespace app { namespace tools { diff --git a/src/app/tools/intertwine.cpp b/src/app/tools/intertwine.cpp index ff6e8390e..516124684 100644 --- a/src/app/tools/intertwine.cpp +++ b/src/app/tools/intertwine.cpp @@ -24,13 +24,13 @@ #include "app/tools/point_shape.h" #include "app/tools/tool_loop.h" -#include "raster/algo.h" +#include "doc/algo.h" namespace app { namespace tools { using namespace gfx; -using namespace raster; +using namespace doc; void Intertwine::doPointshapePoint(int x, int y, ToolLoop* loop) { diff --git a/src/app/tools/intertwiners.h b/src/app/tools/intertwiners.h index d950fa329..212312855 100644 --- a/src/app/tools/intertwiners.h +++ b/src/app/tools/intertwiners.h @@ -76,7 +76,7 @@ public: joinPoints(loop, points); // Fill content - algo_polygon(points.size(), (const int*)&points[0], loop, (AlgoHLine)doPointshapeHline); + doc::algorithm::polygon(points.size(), (const int*)&points[0], loop, (AlgoHLine)doPointshapeHline); } }; @@ -291,7 +291,7 @@ public: joinPoints(loop, points); // Fill content - algo_polygon(points.size(), (const int*)&points[0], loop, (AlgoHLine)doPointshapeHline); + doc::algorithm::polygon(points.size(), (const int*)&points[0], loop, (AlgoHLine)doPointshapeHline); } }; diff --git a/src/app/tools/point_shape.cpp b/src/app/tools/point_shape.cpp index d6a49f9fa..235466b73 100644 --- a/src/app/tools/point_shape.cpp +++ b/src/app/tools/point_shape.cpp @@ -25,12 +25,12 @@ #include "app/settings/document_settings.h" #include "app/tools/ink.h" #include "app/tools/tool_loop.h" -#include "raster/image.h" +#include "doc/image.h" namespace app { namespace tools { -using namespace raster; +using namespace doc; using namespace filters; void PointShape::doInkHline(int x1, int y, int x2, ToolLoop* loop) diff --git a/src/app/tools/point_shapes.h b/src/app/tools/point_shapes.h index 3c62b35e5..636a37393 100644 --- a/src/app/tools/point_shapes.h +++ b/src/app/tools/point_shapes.h @@ -75,7 +75,7 @@ public: void transformPoint(ToolLoop* loop, int x, int y) { - algo_floodfill(loop->getSrcImage(), x, y, + doc::algorithm::floodfill(loop->getSrcImage(), x, y, paintBounds(loop, x, y), loop->getTolerance(), loop->getContiguous(), diff --git a/src/app/tools/shade_table.cpp b/src/app/tools/shade_table.cpp index f47015352..0d5e157b5 100644 --- a/src/app/tools/shade_table.cpp +++ b/src/app/tools/shade_table.cpp @@ -23,7 +23,7 @@ #include "app/tools/shade_table.h" #include "app/color_swatches.h" -#include "raster/palette.h" +#include "doc/palette.h" namespace app { namespace tools { diff --git a/src/app/tools/tool_box.cpp b/src/app/tools/tool_box.cpp index 88b6b9421..cccf318b4 100644 --- a/src/app/tools/tool_box.cpp +++ b/src/app/tools/tool_box.cpp @@ -30,11 +30,13 @@ #include "app/tools/tool_group.h" #include "app/tools/tool_loop.h" #include "base/exception.h" +#include "doc/algo.h" +#include "doc/algorithm/floodfill.h" +#include "doc/algorithm/polygon.h" +#include "doc/brush.h" +#include "doc/image.h" +#include "doc/mask.h" #include "fixmath/fixmath.h" -#include "raster/algo.h" -#include "raster/brush.h" -#include "raster/image.h" -#include "raster/mask.h" #include diff --git a/src/app/tools/tool_loop.h b/src/app/tools/tool_loop.h index 64501792c..70c2aa6ea 100644 --- a/src/app/tools/tool_loop.h +++ b/src/app/tools/tool_loop.h @@ -29,7 +29,7 @@ namespace gfx { class Region; } -namespace raster { +namespace doc { class Image; class Layer; class Mask; @@ -52,7 +52,7 @@ namespace app { class ShadingOptions; class Tool; - using namespace raster; + using namespace doc; // Interface to communicate the sprite editor with the tool when the user // starts using a tool to paint, select, pick color, etc. diff --git a/src/app/tools/tool_loop_manager.cpp b/src/app/tools/tool_loop_manager.cpp index d2ef0f803..995c6cfc2 100644 --- a/src/app/tools/tool_loop_manager.cpp +++ b/src/app/tools/tool_loop_manager.cpp @@ -31,15 +31,15 @@ #include "app/tools/tool_loop.h" #include "app/util/render.h" #include "gfx/region.h" -#include "raster/image.h" -#include "raster/primitives.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/primitives.h" +#include "doc/sprite.h" namespace app { namespace tools { using namespace gfx; -using namespace raster; +using namespace doc; using namespace filters; ToolLoopManager::ToolLoopManager(ToolLoop* toolLoop) diff --git a/src/app/ui/color_bar.cpp b/src/app/ui/color_bar.cpp index 51a60b521..505675166 100644 --- a/src/app/ui/color_bar.cpp +++ b/src/app/ui/color_bar.cpp @@ -31,8 +31,8 @@ #include "app/ui/status_bar.h" #include "app/ui_context.h" #include "base/bind.h" -#include "raster/image.h" -#include "raster/palette.h" +#include "doc/image.h" +#include "doc/palette.h" #include "she/surface.h" #include "ui/graphics.h" #include "ui/menu.h" diff --git a/src/app/ui/color_bar.h b/src/app/ui/color_bar.h index b5773105d..6ace9f835 100644 --- a/src/app/ui/color_bar.h +++ b/src/app/ui/color_bar.h @@ -27,7 +27,7 @@ #include "app/ui/palette_view.h" #include "base/signal.h" #include "base/unique_ptr.h" -#include "raster/pixel_format.h" +#include "doc/pixel_format.h" #include "ui/box.h" #include "ui/button.h" #include "ui/view.h" diff --git a/src/app/ui/color_button.cpp b/src/app/ui/color_button.cpp index 982e44665..de7e494b0 100644 --- a/src/app/ui/color_button.cpp +++ b/src/app/ui/color_button.cpp @@ -33,7 +33,7 @@ #include "app/ui/editor/editor.h" #include "app/ui/skin/skin_theme.h" #include "app/ui/status_bar.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/preferred_size_event.h" #include "ui/ui.h" diff --git a/src/app/ui/color_button.h b/src/app/ui/color_button.h index b307ab0c4..8a94ffc1a 100644 --- a/src/app/ui/color_button.h +++ b/src/app/ui/color_button.h @@ -22,7 +22,7 @@ #include "app/color.h" #include "base/signal.h" -#include "raster/pixel_format.h" +#include "doc/pixel_format.h" #include "ui/button.h" namespace app { diff --git a/src/app/ui/color_selector.cpp b/src/app/ui/color_selector.cpp index 577387dfa..973202edb 100644 --- a/src/app/ui/color_selector.cpp +++ b/src/app/ui/color_selector.cpp @@ -43,17 +43,17 @@ #include "base/scoped_value.h" #include "gfx/border.h" #include "gfx/size.h" -#include "raster/image.h" -#include "raster/image_bits.h" -#include "raster/palette.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/image.h" +#include "doc/image_bits.h" +#include "doc/palette.h" +#include "doc/sprite.h" +#include "doc/stock.h" #include "ui/ui.h" namespace app { using namespace ui; -using namespace raster; +using namespace doc; class ColorSelector::WarningIcon : public StyledButton { public: @@ -213,7 +213,7 @@ void ColorSelector::onFixWarningClick(ui::Event& ev) { try { Palette* newPalette = get_current_palette(); // System current pal - color_t newColor = raster::rgba( + color_t newColor = doc::rgba( m_color.getRed(), m_color.getGreen(), m_color.getBlue(), 255); diff --git a/src/app/ui/context_bar.cpp b/src/app/ui/context_bar.cpp index a696887fe..e6ce3589e 100644 --- a/src/app/ui/context_bar.cpp +++ b/src/app/ui/context_bar.cpp @@ -39,10 +39,10 @@ #include "app/ui_context.h" #include "base/bind.h" #include "base/unique_ptr.h" -#include "raster/brush.h" -#include "raster/conversion_she.h" -#include "raster/image.h" -#include "raster/palette.h" +#include "doc/brush.h" +#include "doc/conversion_she.h" +#include "doc/image.h" +#include "doc/palette.h" #include "she/scoped_surface_lock.h" #include "she/surface.h" #include "she/system.h" @@ -84,8 +84,8 @@ public: void setBrushSettings(IBrushSettings* brushSettings) { base::UniquePtr palette(new Palette(FrameNumber(0), 2)); - palette->setEntry(0, raster::rgba(0, 0, 0, 0)); - palette->setEntry(1, raster::rgba(0, 0, 0, 255)); + palette->setEntry(0, doc::rgba(0, 0, 0, 0)); + palette->setEntry(1, doc::rgba(0, 0, 0, 255)); base::UniquePtr brush( new Brush( diff --git a/src/app/ui/document_view.cpp b/src/app/ui/document_view.cpp index 4f32ed6d1..fbe019453 100644 --- a/src/app/ui/document_view.cpp +++ b/src/app/ui/document_view.cpp @@ -34,8 +34,8 @@ #include "app/ui/workspace.h" #include "base/path.h" #include "doc/document_event.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/sprite.h" #include "ui/accelerator.h" #include "ui/message.h" #include "ui/view.h" diff --git a/src/app/ui/editor/cursor.cpp b/src/app/ui/editor/cursor.cpp index 1c54bbd01..1d1c4792c 100644 --- a/src/app/ui/editor/cursor.cpp +++ b/src/app/ui/editor/cursor.cpp @@ -33,12 +33,12 @@ #include "app/ui_context.h" #include "app/util/boundary.h" #include "base/memory.h" -#include "raster/algo.h" -#include "raster/brush.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/primitives.h" -#include "raster/sprite.h" +#include "doc/algo.h" +#include "doc/brush.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/primitives.h" +#include "doc/sprite.h" #include "ui/base.h" #include "ui/system.h" #include "ui/widget.h" @@ -595,7 +595,7 @@ static void trace_brush_bounds(ui::Graphics* g, Editor* editor, } } - raster::algo_line(x1, y1, x2, y2, (void*)&data, algo_line_proxy); + doc::algo_line(x1, y1, x2, y2, (void*)&data, algo_line_proxy); } } diff --git a/src/app/ui/editor/drawing_state.cpp b/src/app/ui/editor/drawing_state.cpp index 2307e1aa8..247455d36 100644 --- a/src/app/ui/editor/drawing_state.cpp +++ b/src/app/ui/editor/drawing_state.cpp @@ -33,7 +33,7 @@ #include "app/tools/tool_loop_manager.h" #include "app/ui/editor/editor.h" #include "app/ui_context.h" -#include "raster/blend.h" +#include "doc/blend.h" #include "ui/message.h" #include "ui/system.h" diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp index 2e1af20dc..6255aca3a 100644 --- a/src/app/ui/editor/editor.cpp +++ b/src/app/ui/editor/editor.cpp @@ -55,8 +55,8 @@ #include "app/util/render.h" #include "base/bind.h" #include "base/unique_ptr.h" -#include "raster/conversion_she.h" -#include "raster/raster.h" +#include "doc/conversion_she.h" +#include "doc/doc.h" #include "she/surface.h" #include "she/system.h" #include "ui/ui.h" diff --git a/src/app/ui/editor/editor.h b/src/app/ui/editor/editor.h index 0851cf84f..55cf01b69 100644 --- a/src/app/ui/editor/editor.h +++ b/src/app/ui/editor/editor.h @@ -29,7 +29,7 @@ #include "app/ui/editor/editor_states_history.h" #include "base/connection.h" #include "gfx/fwd.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" #include "ui/base.h" #include "ui/timer.h" #include "ui/widget.h" @@ -37,7 +37,7 @@ #define MIN_ZOOM 0 #define MAX_ZOOM 5 -namespace raster { +namespace doc { class Sprite; class Layer; } diff --git a/src/app/ui/editor/editor_decorator.h b/src/app/ui/editor/editor_decorator.h index 77bd11d42..e74ff3fe4 100644 --- a/src/app/ui/editor/editor_decorator.h +++ b/src/app/ui/editor/editor_decorator.h @@ -23,7 +23,7 @@ #include "gfx/color.h" #include "gfx/rect.h" -namespace raster { +namespace doc { class Image; } @@ -31,7 +31,7 @@ namespace app { class Editor; class EditorDecorator; - using namespace raster; + using namespace doc; // EditorPreRender and EditorPostRender are two interfaces used to // draw elements in the editor's area. They are implemented by the diff --git a/src/app/ui/editor/moving_cel_state.cpp b/src/app/ui/editor/moving_cel_state.cpp index 72a7bd6af..160b51c9f 100644 --- a/src/app/ui/editor/moving_cel_state.cpp +++ b/src/app/ui/editor/moving_cel_state.cpp @@ -33,10 +33,10 @@ #include "app/ui_context.h" #include "app/undo_transaction.h" #include "app/util/range_utils.h" -#include "raster/cel.h" -#include "raster/layer.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/cel.h" +#include "doc/layer.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/message.h" namespace app { diff --git a/src/app/ui/editor/moving_cel_state.h b/src/app/ui/editor/moving_cel_state.h index cb5efe66a..5140d12de 100644 --- a/src/app/ui/editor/moving_cel_state.h +++ b/src/app/ui/editor/moving_cel_state.h @@ -22,7 +22,7 @@ #include "app/ui/editor/standby_state.h" -namespace raster { +namespace doc { class Cel; } diff --git a/src/app/ui/editor/moving_pixels_state.cpp b/src/app/ui/editor/moving_pixels_state.cpp index 59009fb24..df39f9553 100644 --- a/src/app/ui/editor/moving_pixels_state.cpp +++ b/src/app/ui/editor/moving_pixels_state.cpp @@ -44,9 +44,9 @@ #include "app/util/clipboard.h" #include "base/unique_ptr.h" #include "gfx/rect.h" -#include "raster/algorithm/flip_image.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/algorithm/flip_image.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/manager.h" #include "ui/message.h" #include "ui/system.h" diff --git a/src/app/ui/editor/moving_pixels_state.h b/src/app/ui/editor/moving_pixels_state.h index 6e2144b14..a6fed621f 100644 --- a/src/app/ui/editor/moving_pixels_state.h +++ b/src/app/ui/editor/moving_pixels_state.h @@ -29,7 +29,7 @@ #include "app/ui/status_bar.h" #include "base/connection.h" -namespace raster { +namespace doc { class Image; } diff --git a/src/app/ui/editor/pixels_movement.cpp b/src/app/ui/editor/pixels_movement.cpp index 5ab560d40..561b0c5ee 100644 --- a/src/app/ui/editor/pixels_movement.cpp +++ b/src/app/ui/editor/pixels_movement.cpp @@ -30,14 +30,14 @@ #include "app/ui_context.h" #include "app/util/expand_cel_canvas.h" #include "base/vector2d.h" +#include "doc/algorithm/flip_image.h" +#include "doc/algorithm/rotate.h" +#include "doc/algorithm/rotsprite.h" +#include "doc/cel.h" +#include "doc/image.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "gfx/region.h" -#include "raster/algorithm/flip_image.h" -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/mask.h" -#include "raster/rotate.h" -#include "raster/rotsprite.h" -#include "raster/sprite.h" namespace app { @@ -85,17 +85,17 @@ PixelsMovement::~PixelsMovement() delete m_currentMask; } -void PixelsMovement::flipImage(raster::algorithm::FlipType flipType) +void PixelsMovement::flipImage(doc::algorithm::FlipType flipType) { // Flip the image. - raster::algorithm::flip_image(m_originalImage, + doc::algorithm::flip_image(m_originalImage, gfx::Rect(gfx::Point(0, 0), gfx::Size(m_originalImage->width(), m_originalImage->height())), flipType); // Flip the mask. - raster::algorithm::flip_image(m_initialMask->bitmap(), + doc::algorithm::flip_image(m_initialMask->bitmap(), gfx::Rect(gfx::Point(0, 0), m_initialMask->bounds().getSize()), flipType); @@ -596,7 +596,7 @@ void PixelsMovement::redrawCurrentMask() m_currentMask->unfreeze(); } -void PixelsMovement::drawImage(raster::Image* dst, const gfx::Point& pt) +void PixelsMovement::drawImage(doc::Image* dst, const gfx::Point& pt) { gfx::Transformation::Corners corners; m_currentData.transformBox(corners); @@ -608,7 +608,7 @@ void PixelsMovement::drawImage(raster::Image* dst, const gfx::Point& pt) drawParallelogram(dst, m_originalImage, corners, pt); } -void PixelsMovement::drawParallelogram(raster::Image* dst, raster::Image* src, +void PixelsMovement::drawParallelogram(doc::Image* dst, doc::Image* src, const gfx::Transformation::Corners& corners, const gfx::Point& leftTop) { @@ -625,7 +625,7 @@ void PixelsMovement::drawParallelogram(raster::Image* dst, raster::Image* src, switch (rotAlgo) { case kFastRotationAlgorithm: - image_parallelogram(dst, src, + doc::algorithm::parallelogram(dst, src, corners.leftTop().x-leftTop.x, corners.leftTop().y-leftTop.y, corners.rightTop().x-leftTop.x, corners.rightTop().y-leftTop.y, corners.rightBottom().x-leftTop.x, corners.rightBottom().y-leftTop.y, @@ -633,7 +633,7 @@ void PixelsMovement::drawParallelogram(raster::Image* dst, raster::Image* src, break; case kRotSpriteRotationAlgorithm: - image_rotsprite(dst, src, + doc::algorithm::rotsprite_image(dst, src, corners.leftTop().x-leftTop.x, corners.leftTop().y-leftTop.y, corners.rightTop().x-leftTop.x, corners.rightTop().y-leftTop.y, corners.rightBottom().x-leftTop.x, corners.rightBottom().y-leftTop.y, diff --git a/src/app/ui/editor/pixels_movement.h b/src/app/ui/editor/pixels_movement.h index 0987df536..46f7ce685 100644 --- a/src/app/ui/editor/pixels_movement.h +++ b/src/app/ui/editor/pixels_movement.h @@ -26,9 +26,9 @@ #include "app/undo_transaction.h" #include "base/shared_ptr.h" #include "gfx/size.h" -#include "raster/algorithm/flip_type.h" +#include "doc/algorithm/flip_type.h" -namespace raster { +namespace doc { class Image; class Sprite; } @@ -93,7 +93,7 @@ namespace app { // Flip Horizontally/Vertically commands are replaced calling this // function, so they work more as the user would expect (flip the // current selection instead of dropping and flipping it). - void flipImage(raster::algorithm::FlipType flipType); + void flipImage(doc::algorithm::FlipType flipType); const gfx::Transformation& getTransformation() const { return m_currentData; } @@ -103,8 +103,8 @@ namespace app { private: void redrawExtraImage(); void redrawCurrentMask(); - void drawImage(raster::Image* dst, const gfx::Point& pt); - void drawParallelogram(raster::Image* dst, raster::Image* src, + void drawImage(doc::Image* dst, const gfx::Point& pt); + void drawParallelogram(doc::Image* dst, doc::Image* src, const gfx::Transformation::Corners& corners, const gfx::Point& leftTop); void updateDocumentMask(); diff --git a/src/app/ui/editor/scrolling_state.cpp b/src/app/ui/editor/scrolling_state.cpp index 51f40583d..9ba63bb06 100644 --- a/src/app/ui/editor/scrolling_state.cpp +++ b/src/app/ui/editor/scrolling_state.cpp @@ -26,7 +26,7 @@ #include "app/ui/editor/editor.h" #include "app/ui/status_bar.h" #include "gfx/rect.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/message.h" #include "ui/system.h" #include "ui/view.h" diff --git a/src/app/ui/editor/select_box_state.cpp b/src/app/ui/editor/select_box_state.cpp index 5e514e265..ebed213d0 100644 --- a/src/app/ui/editor/select_box_state.cpp +++ b/src/app/ui/editor/select_box_state.cpp @@ -24,8 +24,8 @@ #include "app/ui/editor/editor.h" #include "gfx/rect.h" -#include "raster/image.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/sprite.h" #include "ui/message.h" #include "ui/system.h" #include "ui/view.h" @@ -162,19 +162,19 @@ void SelectBoxState::preRenderDecorator(EditorPreRender* render) // Top band if (rc.y > 0) - render->fillRect(gfx::Rect(0, 0, sprite_w, rc.y), raster::rgba(0, 0, 0, 255), 128); + render->fillRect(gfx::Rect(0, 0, sprite_w, rc.y), doc::rgba(0, 0, 0, 255), 128); // Bottom band if (rc.y+rc.h < sprite_h) - render->fillRect(gfx::Rect(0, rc.y+rc.h, sprite_w, sprite_h-(rc.y+rc.h)), raster::rgba(0, 0, 0, 255), 128); + render->fillRect(gfx::Rect(0, rc.y+rc.h, sprite_w, sprite_h-(rc.y+rc.h)), doc::rgba(0, 0, 0, 255), 128); // Left band if (rc.x > 0) - render->fillRect(gfx::Rect(0, rc.y, rc.x, rc.h), raster::rgba(0, 0, 0, 255), 128); + render->fillRect(gfx::Rect(0, rc.y, rc.x, rc.h), doc::rgba(0, 0, 0, 255), 128); // Right band if (rc.x+rc.w < sprite_w) - render->fillRect(gfx::Rect(rc.x+rc.w, rc.y, sprite_w-(rc.x+rc.w), rc.h), raster::rgba(0, 0, 0, 255), 128); + render->fillRect(gfx::Rect(rc.x+rc.w, rc.y, sprite_w-(rc.x+rc.w), rc.h), doc::rgba(0, 0, 0, 255), 128); } void SelectBoxState::postRenderDecorator(EditorPostRender* render) diff --git a/src/app/ui/editor/standby_state.cpp b/src/app/ui/editor/standby_state.cpp index 1596303b3..c82a834ef 100644 --- a/src/app/ui/editor/standby_state.cpp +++ b/src/app/ui/editor/standby_state.cpp @@ -49,9 +49,9 @@ #include "app/util/misc.h" #include "fixmath/fixmath.h" #include "gfx/rect.h" -#include "raster/layer.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/alert.h" #include "ui/message.h" #include "ui/system.h" @@ -176,7 +176,7 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg) // Move cel X,Y coordinates if (clickedInk->isCelMovement()) { if ((layer) && - (layer->type() == OBJECT_LAYER_IMAGE)) { + (layer->type() == ObjectType::LayerImage)) { // TODO you can move the `Background' with tiled mode if (layer->isBackground()) { Alert::show(PACKAGE diff --git a/src/app/ui/editor/tool_loop_impl.cpp b/src/app/ui/editor/tool_loop_impl.cpp index e57b15b60..2c21fd557 100644 --- a/src/app/ui/editor/tool_loop_impl.cpp +++ b/src/app/ui/editor/tool_loop_impl.cpp @@ -42,11 +42,11 @@ #include "app/undo_transaction.h" #include "app/undoers/set_mask.h" #include "app/util/expand_cel_canvas.h" -#include "raster/brush.h" -#include "raster/cel.h" -#include "raster/layer.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/brush.h" +#include "doc/cel.h" +#include "doc/layer.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "ui/ui.h" namespace app { diff --git a/src/app/ui/editor/zooming_state.cpp b/src/app/ui/editor/zooming_state.cpp index a2f0cc5d9..09f45942e 100644 --- a/src/app/ui/editor/zooming_state.cpp +++ b/src/app/ui/editor/zooming_state.cpp @@ -26,7 +26,7 @@ #include "app/ui/editor/editor.h" #include "app/ui/status_bar.h" #include "gfx/rect.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/message.h" #include "ui/system.h" #include "ui/view.h" diff --git a/src/app/ui/mini_editor.cpp b/src/app/ui/mini_editor.cpp index 93f5f4432..c413382ac 100644 --- a/src/app/ui/mini_editor.cpp +++ b/src/app/ui/mini_editor.cpp @@ -38,7 +38,7 @@ #include "app/ui_context.h" #include "base/bind.h" #include "gfx/rect.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "ui/base.h" #include "ui/button.h" #include "ui/close_event.h" diff --git a/src/app/ui/palette_popup.cpp b/src/app/ui/palette_popup.cpp index 293ae333f..eca9272fc 100644 --- a/src/app/ui/palette_popup.cpp +++ b/src/app/ui/palette_popup.cpp @@ -73,7 +73,7 @@ void PalettePopup::showPopup(const gfx::Rect& bounds) openWindow(); } -void PalettePopup::onPalChange(raster::Palette* palette) +void PalettePopup::onPalChange(doc::Palette* palette) { m_popup->loadPal()->setEnabled( UIContext::instance()->activeDocument() && @@ -84,7 +84,7 @@ void PalettePopup::onPalChange(raster::Palette* palette) void PalettePopup::onLoadPal(bool asDefault) { - raster::Palette* palette = m_paletteListBox.selectedPalette(); + doc::Palette* palette = m_paletteListBox.selectedPalette(); if (!palette) return; diff --git a/src/app/ui/palette_popup.h b/src/app/ui/palette_popup.h index 253eed4ea..352a8f57e 100644 --- a/src/app/ui/palette_popup.h +++ b/src/app/ui/palette_popup.h @@ -41,7 +41,7 @@ namespace app { void showPopup(const gfx::Rect& bounds); protected: - void onPalChange(raster::Palette* palette); + void onPalChange(doc::Palette* palette); void onLoadPal(bool asDefault); void onOpenFolder(); diff --git a/src/app/ui/palette_view.cpp b/src/app/ui/palette_view.cpp index 94743c8e9..e2a929373 100644 --- a/src/app/ui/palette_view.cpp +++ b/src/app/ui/palette_view.cpp @@ -27,9 +27,9 @@ #include "app/ui/palette_view.h" #include "app/ui/status_bar.h" #include "gfx/point.h" -#include "raster/blend.h" -#include "raster/image.h" -#include "raster/palette.h" +#include "doc/blend.h" +#include "doc/image.h" +#include "doc/palette.h" #include "ui/graphics.h" #include "ui/manager.h" #include "ui/message.h" diff --git a/src/app/ui/palettes_listbox.cpp b/src/app/ui/palettes_listbox.cpp index 925c58cdd..84aa594e9 100644 --- a/src/app/ui/palettes_listbox.cpp +++ b/src/app/ui/palettes_listbox.cpp @@ -27,7 +27,7 @@ #include "app/res/palettes_loader_delegate.h" #include "app/ui/skin/skin_theme.h" #include "base/bind.h" -#include "raster/palette.h" +#include "doc/palette.h" #include "ui/graphics.h" #include "ui/listitem.h" #include "ui/message.h" @@ -44,7 +44,7 @@ PalettesListBox::PalettesListBox() { } -raster::Palette* PalettesListBox::selectedPalette() +doc::Palette* PalettesListBox::selectedPalette() { Resource* resource = selectedResource(); if (!resource) @@ -57,25 +57,25 @@ void PalettesListBox::onResourceChange(Resource* resource) { ResourcesListBox::onResourceChange(resource); - raster::Palette* palette = static_cast(resource)->palette(); + doc::Palette* palette = static_cast(resource)->palette(); PalChange(palette); } void PalettesListBox::onPaintResource(Graphics* g, const gfx::Rect& bounds, Resource* resource) { - raster::Palette* palette = static_cast(resource)->palette(); + doc::Palette* palette = static_cast(resource)->palette(); gfx::Rect box( bounds.x, bounds.y+bounds.h-6*jguiscale(), 4*jguiscale(), 4*jguiscale()); for (int i=0; isize(); ++i) { - raster::color_t c = palette->getEntry(i); + doc::color_t c = palette->getEntry(i); g->fillRect(gfx::rgba( - raster::rgba_getr(c), - raster::rgba_getg(c), - raster::rgba_getb(c)), box); + doc::rgba_getr(c), + doc::rgba_getg(c), + doc::rgba_getb(c)), box); box.x += box.w; } diff --git a/src/app/ui/palettes_listbox.h b/src/app/ui/palettes_listbox.h index 035e2f3b4..e27752185 100644 --- a/src/app/ui/palettes_listbox.h +++ b/src/app/ui/palettes_listbox.h @@ -22,7 +22,7 @@ #include "app/ui/resources_listbox.h" -namespace raster { +namespace doc { class Palette; } @@ -32,9 +32,9 @@ namespace app { public: PalettesListBox(); - raster::Palette* selectedPalette(); + doc::Palette* selectedPalette(); - Signal1 PalChange; + Signal1 PalChange; protected: virtual void onResourceChange(Resource* resource) override; diff --git a/src/app/ui/resources_listbox.cpp b/src/app/ui/resources_listbox.cpp index ca56844c4..f75aee11a 100644 --- a/src/app/ui/resources_listbox.cpp +++ b/src/app/ui/resources_listbox.cpp @@ -80,12 +80,12 @@ protected: paintResource(g, bounds, m_resource); // for (int i=0; isize(); ++i) { - // raster::color_t c = m_resource->getEntry(i); + // doc::color_t c = m_resource->getEntry(i); // g->fillRect(gfx::rgba( - // raster::rgba_getr(c), - // raster::rgba_getg(c), - // raster::rgba_getb(c)), box); + // doc::rgba_getr(c), + // doc::rgba_getg(c), + // doc::rgba_getb(c)), box); // box.x += box.w; // } diff --git a/src/app/ui/status_bar.cpp b/src/app/ui/status_bar.cpp index 66d03bd5b..d8d4abaca 100644 --- a/src/app/ui/status_bar.cpp +++ b/src/app/ui/status_bar.cpp @@ -42,10 +42,10 @@ #include "app/util/range_utils.h" #include "base/bind.h" #include "gfx/size.h" -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/cel.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/sprite.h" #include "she/font.h" #include "she/surface.h" #include "ui/ui.h" @@ -61,7 +61,7 @@ namespace app { using namespace app::skin; using namespace gfx; using namespace ui; -using namespace raster; +using namespace doc; enum AniAction { ACTION_FIRST, diff --git a/src/app/ui/status_bar.h b/src/app/ui/status_bar.h index b046c3521..02731875e 100644 --- a/src/app/ui/status_bar.h +++ b/src/app/ui/status_bar.h @@ -22,7 +22,7 @@ #include "app/color.h" #include "base/observers.h" -#include "raster/layer_index.h" +#include "doc/layer_index.h" #include "ui/base.h" #include "ui/link_label.h" #include "ui/widget.h" diff --git a/src/app/ui/timeline.cpp b/src/app/ui/timeline.cpp index 4a40c2561..503ab148e 100644 --- a/src/app/ui/timeline.cpp +++ b/src/app/ui/timeline.cpp @@ -50,7 +50,7 @@ #include "doc/document_event.h" #include "gfx/point.h" #include "gfx/rect.h" -#include "raster/raster.h" +#include "doc/doc.h" #include "ui/ui.h" #include @@ -82,7 +82,7 @@ namespace app { using namespace app::skin; using namespace gfx; -using namespace raster; +using namespace doc; using namespace ui; static const char* kTimeline = "timeline"; diff --git a/src/app/ui/timeline.h b/src/app/ui/timeline.h index fa8d99db1..9cbfccab3 100644 --- a/src/app/ui/timeline.h +++ b/src/app/ui/timeline.h @@ -26,15 +26,15 @@ #include "base/connection.h" #include "doc/document_observer.h" #include "doc/documents_observer.h" -#include "raster/frame_number.h" -#include "raster/layer_index.h" -#include "raster/sprite.h" +#include "doc/frame_number.h" +#include "doc/layer_index.h" +#include "doc/sprite.h" #include "ui/timer.h" #include "ui/widget.h" #include -namespace raster { +namespace doc { class Cel; class Layer; class LayerImage; @@ -46,7 +46,7 @@ namespace ui { } namespace app { - using namespace raster; + using namespace doc; class Command; class ConfigureTimelinePopup; diff --git a/src/app/ui_context.cpp b/src/app/ui_context.cpp index 01c0d757e..e75be6f1b 100644 --- a/src/app/ui_context.cpp +++ b/src/app/ui_context.cpp @@ -34,7 +34,7 @@ #include "app/ui/workspace.h" #include "app/ui_context.h" #include "base/mutex.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "undo/undo_history.h" namespace app { diff --git a/src/app/undo_transaction.cpp b/src/app/undo_transaction.cpp index 57c29d38f..aacf952e5 100644 --- a/src/app/undo_transaction.cpp +++ b/src/app/undo_transaction.cpp @@ -27,7 +27,7 @@ #include "app/document_undo.h" #include "app/undoers/close_group.h" #include "app/undoers/open_group.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "undo/undo_history.h" namespace app { diff --git a/src/app/undo_transaction.h b/src/app/undo_transaction.h index 45b33010a..72e494894 100644 --- a/src/app/undo_transaction.h +++ b/src/app/undo_transaction.h @@ -22,7 +22,7 @@ #include "undo/modification.h" -namespace raster { +namespace doc { class Sprite; } @@ -37,7 +37,7 @@ namespace app { class Document; class DocumentUndo; - using namespace raster; + using namespace doc; // High-level class to group a set of operations to modify the // document atomically, adding information in the undo history to diff --git a/src/app/undoers/add_cel.cpp b/src/app/undoers/add_cel.cpp index 25e818716..62bd161a9 100644 --- a/src/app/undoers/add_cel.cpp +++ b/src/app/undoers/add_cel.cpp @@ -23,15 +23,15 @@ #include "app/undoers/add_cel.h" #include "app/undoers/remove_cel.h" -#include "raster/cel.h" -#include "raster/layer.h" +#include "doc/cel.h" +#include "doc/layer.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" namespace app { namespace undoers { -using namespace raster; +using namespace doc; using namespace undo; AddCel::AddCel(ObjectsContainer* objects, Layer* layer, Cel* cel) diff --git a/src/app/undoers/add_cel.h b/src/app/undoers/add_cel.h index 8aa420821..4f3c07aff 100644 --- a/src/app/undoers/add_cel.h +++ b/src/app/undoers/add_cel.h @@ -23,14 +23,14 @@ #include "app/undoers/undoer_base.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Cel; class Layer; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class AddCel : public UndoerBase { @@ -42,8 +42,8 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_layerId; - ObjectId m_celId; + undo::ObjectId m_layerId; + undo::ObjectId m_celId; }; } // namespace undoers diff --git a/src/app/undoers/add_frame.cpp b/src/app/undoers/add_frame.cpp index 811935f29..4a4f66279 100644 --- a/src/app/undoers/add_frame.cpp +++ b/src/app/undoers/add_frame.cpp @@ -26,7 +26,7 @@ #include "app/undoers/remove_frame.h" #include "doc/document_event.h" #include "doc/document_observer.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/add_frame.h b/src/app/undoers/add_frame.h index 3316b1c9c..1a6791685 100644 --- a/src/app/undoers/add_frame.h +++ b/src/app/undoers/add_frame.h @@ -21,10 +21,10 @@ #pragma once #include "app/undoers/undoer_base.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Sprite; } @@ -32,7 +32,7 @@ namespace app { class Document; namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class AddFrame : public UndoerBase { @@ -44,8 +44,8 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_documentId; - ObjectId m_spriteId; + undo::ObjectId m_documentId; + undo::ObjectId m_spriteId; FrameNumber m_frame; }; diff --git a/src/app/undoers/add_image.cpp b/src/app/undoers/add_image.cpp index f1bc82e50..d9cfe4b99 100644 --- a/src/app/undoers/add_image.cpp +++ b/src/app/undoers/add_image.cpp @@ -23,8 +23,8 @@ #include "app/undoers/add_image.h" #include "app/undoers/remove_image.h" -#include "raster/image.h" -#include "raster/stock.h" +#include "doc/image.h" +#include "doc/stock.h" #include "undo/objects_container.h" #include "undo/undo_exception.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/add_image.h b/src/app/undoers/add_image.h index 5897441fb..c865003e1 100644 --- a/src/app/undoers/add_image.h +++ b/src/app/undoers/add_image.h @@ -23,13 +23,13 @@ #include "app/undoers/undoer_base.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Stock; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class AddImage : public UndoerBase { @@ -41,7 +41,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_stockId; + undo::ObjectId m_stockId; uint32_t m_imageIndex; }; diff --git a/src/app/undoers/add_layer.cpp b/src/app/undoers/add_layer.cpp index a385a20c8..81cd04d1b 100644 --- a/src/app/undoers/add_layer.cpp +++ b/src/app/undoers/add_layer.cpp @@ -25,7 +25,7 @@ #include "app/document.h" #include "app/document_api.h" #include "app/undoers/remove_layer.h" -#include "raster/layer.h" +#include "doc/layer.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/add_layer.h b/src/app/undoers/add_layer.h index 640fbee9e..049473368 100644 --- a/src/app/undoers/add_layer.h +++ b/src/app/undoers/add_layer.h @@ -23,7 +23,7 @@ #include "app/undoers/undoer_base.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Layer; } @@ -31,7 +31,7 @@ namespace app { class Document; namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class AddLayer : public UndoerBase { @@ -43,8 +43,8 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_documentId; - ObjectId m_layerId; + undo::ObjectId m_documentId; + undo::ObjectId m_layerId; }; } // namespace undoers diff --git a/src/app/undoers/add_palette.cpp b/src/app/undoers/add_palette.cpp index a330fd85d..3c878bcad 100644 --- a/src/app/undoers/add_palette.cpp +++ b/src/app/undoers/add_palette.cpp @@ -23,7 +23,7 @@ #include "app/undoers/add_palette.h" #include "app/undoers/remove_palette.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/add_palette.h b/src/app/undoers/add_palette.h index 0b1676188..fa8071bd4 100644 --- a/src/app/undoers/add_palette.h +++ b/src/app/undoers/add_palette.h @@ -21,16 +21,16 @@ #pragma once #include "app/undoers/undoer_base.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Sprite; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class AddPalette : public UndoerBase { @@ -42,7 +42,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_spriteId; + undo::ObjectId m_spriteId; FrameNumber m_paletteFrame; }; diff --git a/src/app/undoers/close_group.cpp b/src/app/undoers/close_group.cpp index c95c95cf5..15c001eb0 100644 --- a/src/app/undoers/close_group.cpp +++ b/src/app/undoers/close_group.cpp @@ -23,7 +23,7 @@ #include "app/undoers/close_group.h" #include "app/undoers/open_group.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/close_group.h b/src/app/undoers/close_group.h index 4ce195b51..911dc2a60 100644 --- a/src/app/undoers/close_group.h +++ b/src/app/undoers/close_group.h @@ -20,17 +20,17 @@ #define APP_UNDOERS_CLOSE_GROUP_H_INCLUDED #pragma once -#include "raster/sprite_position.h" +#include "doc/sprite_position.h" #include "undo/object_id.h" #include "undo/undoer.h" -namespace raster { +namespace doc { class Sprite; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class CloseGroup : public undo::Undoer { @@ -54,7 +54,7 @@ namespace app { private: const char* m_label; Modification m_modification; - ObjectId m_spriteId; + undo::ObjectId m_spriteId; SpritePosition m_spritePosition; }; diff --git a/src/app/undoers/dirty_area.cpp b/src/app/undoers/dirty_area.cpp index e21e68f3b..9da620745 100644 --- a/src/app/undoers/dirty_area.cpp +++ b/src/app/undoers/dirty_area.cpp @@ -23,9 +23,9 @@ #include "app/undoers/dirty_area.h" #include "base/unique_ptr.h" -#include "raster/dirty.h" -#include "raster/dirty_io.h" -#include "raster/image.h" +#include "doc/dirty.h" +#include "doc/dirty_io.h" +#include "doc/image.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" @@ -37,7 +37,7 @@ using namespace undo; DirtyArea::DirtyArea(ObjectsContainer* objects, Image* image, Dirty* dirty) : m_imageId(objects->addObject(image)) { - raster::write_dirty(m_stream, dirty); + doc::write_dirty(m_stream, dirty); } void DirtyArea::dispose() @@ -48,7 +48,7 @@ void DirtyArea::dispose() void DirtyArea::revert(ObjectsContainer* objects, UndoersCollector* redoers) { Image* image = objects->getObjectT(m_imageId); - base::UniquePtr dirty(raster::read_dirty(m_stream)); + base::UniquePtr dirty(doc::read_dirty(m_stream)); // Swap the saved pixels in the dirty with the pixels in the image dirty->swapImagePixels(image); diff --git a/src/app/undoers/dirty_area.h b/src/app/undoers/dirty_area.h index 9da2f961b..0352e361d 100644 --- a/src/app/undoers/dirty_area.h +++ b/src/app/undoers/dirty_area.h @@ -25,14 +25,14 @@ #include -namespace raster { +namespace doc { class Dirty; class Image; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class DirtyArea : public UndoerBase { @@ -48,7 +48,7 @@ namespace app { return const_cast(&m_stream)->tellp(); } - ObjectId m_imageId; + undo::ObjectId m_imageId; std::stringstream m_stream; }; diff --git a/src/app/undoers/flip_image.cpp b/src/app/undoers/flip_image.cpp index 16236516c..a4fb3235e 100644 --- a/src/app/undoers/flip_image.cpp +++ b/src/app/undoers/flip_image.cpp @@ -26,8 +26,8 @@ #include "gfx/point.h" #include "gfx/rect.h" #include "gfx/size.h" -#include "raster/algorithm/flip_image.h" -#include "raster/image.h" +#include "doc/algorithm/flip_image.h" +#include "doc/image.h" #include "undo/objects_container.h" #include "undo/undo_exception.h" #include "undo/undoers_collector.h" @@ -35,12 +35,12 @@ namespace app { namespace undoers { -using namespace raster; +using namespace doc; using namespace undo; FlipImage::FlipImage(ObjectsContainer* objects, Image* image, const gfx::Rect& bounds, - raster::algorithm::FlipType flipType) + doc::algorithm::FlipType flipType) : m_imageId(objects->addObject(image)) , m_format(image->pixelFormat()) , m_x(bounds.x), m_y(bounds.y) @@ -59,7 +59,7 @@ void FlipImage::dispose() void FlipImage::revert(ObjectsContainer* objects, UndoersCollector* redoers) { Image* image = objects->getObjectT(m_imageId); - raster::algorithm::FlipType flipType = static_cast(m_flipType); + doc::algorithm::FlipType flipType = static_cast(m_flipType); gfx::Rect bounds(gfx::Point(m_x, m_y), gfx::Size(m_w, m_h)); if (image->pixelFormat() != m_format) @@ -67,7 +67,7 @@ void FlipImage::revert(ObjectsContainer* objects, UndoersCollector* redoers) redoers->pushUndoer(new FlipImage(objects, image, bounds, flipType)); - raster::algorithm::flip_image(image, bounds, flipType); + doc::algorithm::flip_image(image, bounds, flipType); } } // namespace undoers diff --git a/src/app/undoers/flip_image.h b/src/app/undoers/flip_image.h index bb8e9ca16..4a621826b 100644 --- a/src/app/undoers/flip_image.h +++ b/src/app/undoers/flip_image.h @@ -22,16 +22,16 @@ #include "app/undoers/undoer_base.h" #include "gfx/fwd.h" -#include "raster/algorithm/flip_type.h" +#include "doc/algorithm/flip_type.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Image; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class FlipImage : public UndoerBase { @@ -45,7 +45,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_imageId; + undo::ObjectId m_imageId; uint8_t m_format; uint16_t m_x, m_y, m_w, m_h; uint8_t m_flipType; diff --git a/src/app/undoers/image_area.cpp b/src/app/undoers/image_area.cpp index 526ba8ad1..53b885c27 100644 --- a/src/app/undoers/image_area.cpp +++ b/src/app/undoers/image_area.cpp @@ -22,7 +22,7 @@ #include "app/undoers/image_area.h" -#include "raster/image.h" +#include "doc/image.h" #include "undo/objects_container.h" #include "undo/undo_exception.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/image_area.h b/src/app/undoers/image_area.h index 5178163fc..bb681a92f 100644 --- a/src/app/undoers/image_area.h +++ b/src/app/undoers/image_area.h @@ -25,13 +25,13 @@ #include -namespace raster { +namespace doc { class Image; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class ImageArea : public UndoerBase { @@ -43,7 +43,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_imageId; + undo::ObjectId m_imageId; uint8_t m_format; uint16_t m_x, m_y, m_w, m_h; uint32_t m_lineSize; diff --git a/src/app/undoers/move_layer.cpp b/src/app/undoers/move_layer.cpp index 9ad28f950..a5cc39f76 100644 --- a/src/app/undoers/move_layer.cpp +++ b/src/app/undoers/move_layer.cpp @@ -22,7 +22,7 @@ #include "app/undoers/move_layer.h" -#include "raster/layer.h" +#include "doc/layer.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/move_layer.h b/src/app/undoers/move_layer.h index 11434352a..9d2fe4d99 100644 --- a/src/app/undoers/move_layer.h +++ b/src/app/undoers/move_layer.h @@ -23,13 +23,13 @@ #include "app/undoers/undoer_base.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Layer; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class MoveLayer : public UndoerBase { @@ -41,9 +41,9 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_folderId; - ObjectId m_layerId; - ObjectId m_afterId; + undo::ObjectId m_folderId; + undo::ObjectId m_layerId; + undo::ObjectId m_afterId; }; } // namespace undoers diff --git a/src/app/undoers/open_group.cpp b/src/app/undoers/open_group.cpp index ee5b702a9..3cf0610d0 100644 --- a/src/app/undoers/open_group.cpp +++ b/src/app/undoers/open_group.cpp @@ -23,14 +23,14 @@ #include "app/undoers/open_group.h" #include "app/undoers/close_group.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" namespace app { namespace undoers { -using namespace raster; +using namespace doc; using namespace undo; OpenGroup::OpenGroup(ObjectsContainer* objects, diff --git a/src/app/undoers/open_group.h b/src/app/undoers/open_group.h index 1ff0d7cc3..facb12d27 100644 --- a/src/app/undoers/open_group.h +++ b/src/app/undoers/open_group.h @@ -20,17 +20,17 @@ #define APP_UNDOERS_OPEN_GROUP_H_INCLUDED #pragma once -#include "raster/sprite_position.h" +#include "doc/sprite_position.h" #include "undo/object_id.h" #include "undo/undoer.h" -namespace raster { +namespace doc { class Layer; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class OpenGroup : public Undoer { @@ -53,7 +53,7 @@ namespace app { private: const char* m_label; Modification m_modification; - ObjectId m_spriteId; + undo::ObjectId m_spriteId; SpritePosition m_spritePosition; }; diff --git a/src/app/undoers/remap_palette.cpp b/src/app/undoers/remap_palette.cpp index eed170dca..b08b2c7ad 100644 --- a/src/app/undoers/remap_palette.cpp +++ b/src/app/undoers/remap_palette.cpp @@ -24,14 +24,14 @@ #include "app/undoers/add_cel.h" #include "app/undoers/object_io.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" namespace app { namespace undoers { -using namespace raster; +using namespace doc; using namespace undo; RemapPalette::RemapPalette(ObjectsContainer* objects, Sprite* sprite, diff --git a/src/app/undoers/remap_palette.h b/src/app/undoers/remap_palette.h index 8c9c0191a..ac4d66c6d 100644 --- a/src/app/undoers/remap_palette.h +++ b/src/app/undoers/remap_palette.h @@ -21,18 +21,18 @@ #pragma once #include "app/undoers/undoer_base.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" #include "undo/object_id.h" #include -namespace raster { +namespace doc { class Sprite; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class RemapPalette : public UndoerBase { @@ -46,7 +46,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_spriteId; + undo::ObjectId m_spriteId; FrameNumber m_frameFrom; FrameNumber m_frameTo; std::vector m_mapping; diff --git a/src/app/undoers/remove_cel.cpp b/src/app/undoers/remove_cel.cpp index 245e940b2..dfece69bc 100644 --- a/src/app/undoers/remove_cel.cpp +++ b/src/app/undoers/remove_cel.cpp @@ -24,23 +24,23 @@ #include "app/undoers/add_cel.h" #include "app/undoers/object_io.h" -#include "raster/cel.h" -#include "raster/cel_io.h" -#include "raster/layer.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/cel_io.h" +#include "doc/layer.h" +#include "doc/stock.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" namespace app { namespace undoers { -using namespace raster; +using namespace doc; using namespace undo; RemoveCel::RemoveCel(ObjectsContainer* objects, Layer* layer, Cel* cel) : m_layerId(objects->addObject(layer)) { - write_object(objects, m_stream, cel, raster::write_cel); + write_object(objects, m_stream, cel, doc::write_cel); } void RemoveCel::dispose() @@ -51,7 +51,7 @@ void RemoveCel::dispose() void RemoveCel::revert(ObjectsContainer* objects, UndoersCollector* redoers) { LayerImage* layer = objects->getObjectT(m_layerId); - Cel* cel = read_object(objects, m_stream, raster::read_cel); + Cel* cel = read_object(objects, m_stream, doc::read_cel); // Push an AddCel as redoer redoers->pushUndoer(new AddCel(objects, layer, cel)); diff --git a/src/app/undoers/remove_cel.h b/src/app/undoers/remove_cel.h index a6992ea8c..b8f5b2ed1 100644 --- a/src/app/undoers/remove_cel.h +++ b/src/app/undoers/remove_cel.h @@ -25,14 +25,14 @@ #include -namespace raster { +namespace doc { class Cel; class Layer; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class RemoveCel : public UndoerBase { @@ -48,7 +48,7 @@ namespace app { return const_cast(&m_stream)->tellp(); } - ObjectId m_layerId; + undo::ObjectId m_layerId; std::stringstream m_stream; }; diff --git a/src/app/undoers/remove_frame.cpp b/src/app/undoers/remove_frame.cpp index 0e982adf3..ce287e9cb 100644 --- a/src/app/undoers/remove_frame.cpp +++ b/src/app/undoers/remove_frame.cpp @@ -26,14 +26,14 @@ #include "app/undoers/add_frame.h" #include "doc/document_event.h" #include "doc/document_observer.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" namespace app { namespace undoers { -using namespace raster; +using namespace doc; using namespace undo; RemoveFrame::RemoveFrame(undo::ObjectsContainer* objects, Document* document, Sprite* sprite, FrameNumber frame) diff --git a/src/app/undoers/remove_frame.h b/src/app/undoers/remove_frame.h index fb578240e..db40fd2d1 100644 --- a/src/app/undoers/remove_frame.h +++ b/src/app/undoers/remove_frame.h @@ -21,12 +21,12 @@ #pragma once #include "app/undoers/undoer_base.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" #include "undo/object_id.h" #include -namespace raster { +namespace doc { class Sprite; } @@ -34,7 +34,7 @@ namespace app { class Document; namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class RemoveFrame : public UndoerBase { @@ -46,8 +46,8 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_documentId; - ObjectId m_spriteId; + undo::ObjectId m_documentId; + undo::ObjectId m_spriteId; FrameNumber m_frame; int m_frameDuration; }; diff --git a/src/app/undoers/remove_image.cpp b/src/app/undoers/remove_image.cpp index 7ef5c630d..2302e51d0 100644 --- a/src/app/undoers/remove_image.cpp +++ b/src/app/undoers/remove_image.cpp @@ -24,16 +24,16 @@ #include "app/undoers/add_image.h" #include "app/undoers/object_io.h" -#include "raster/image.h" -#include "raster/image_io.h" -#include "raster/stock.h" +#include "doc/image.h" +#include "doc/image_io.h" +#include "doc/stock.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" namespace app { namespace undoers { -using namespace raster; +using namespace doc; using namespace undo; RemoveImage::RemoveImage(ObjectsContainer* objects, Stock* stock, int imageIndex) @@ -42,7 +42,7 @@ RemoveImage::RemoveImage(ObjectsContainer* objects, Stock* stock, int imageIndex { Image* image = stock->getImage(imageIndex); - write_object(objects, m_stream, image, raster::write_image); + write_object(objects, m_stream, image, doc::write_image); } void RemoveImage::dispose() @@ -53,7 +53,7 @@ void RemoveImage::dispose() void RemoveImage::revert(ObjectsContainer* objects, UndoersCollector* redoers) { Stock* stock = objects->getObjectT(m_stockId); - Image* image = read_object(objects, m_stream, raster::read_image); + Image* image = read_object(objects, m_stream, doc::read_image); // Push an AddImage as redoer redoers->pushUndoer(new AddImage(objects, stock, m_imageIndex)); diff --git a/src/app/undoers/remove_image.h b/src/app/undoers/remove_image.h index a70e857d5..9d2040eda 100644 --- a/src/app/undoers/remove_image.h +++ b/src/app/undoers/remove_image.h @@ -25,13 +25,13 @@ #include -namespace raster { +namespace doc { class Stock; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class RemoveImage : public UndoerBase { @@ -47,7 +47,7 @@ namespace app { return const_cast(&m_stream)->tellp(); } - ObjectId m_stockId; + undo::ObjectId m_stockId; uint32_t m_imageIndex; std::stringstream m_stream; }; diff --git a/src/app/undoers/remove_layer.cpp b/src/app/undoers/remove_layer.cpp index 98052e5ba..e677bc989 100644 --- a/src/app/undoers/remove_layer.cpp +++ b/src/app/undoers/remove_layer.cpp @@ -26,12 +26,12 @@ #include "app/document_api.h" #include "app/undoers/add_layer.h" #include "app/undoers/object_io.h" -#include "raster/cel.h" -#include "raster/cel_io.h" -#include "raster/image.h" -#include "raster/image_io.h" -#include "raster/layer.h" -#include "raster/layer_io.h" +#include "doc/cel.h" +#include "doc/cel_io.h" +#include "doc/image.h" +#include "doc/image_io.h" +#include "doc/layer.h" +#include "doc/layer_io.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" @@ -40,7 +40,7 @@ namespace undoers { using namespace undo; -class LayerSubObjectsSerializerImpl : public raster::LayerSubObjectsSerializer { +class LayerSubObjectsSerializerImpl : public doc::LayerSubObjectsSerializer { public: LayerSubObjectsSerializerImpl(ObjectsContainer* objects, Sprite* sprite) : m_objects(objects) @@ -51,11 +51,11 @@ public: // How to write cels, images, and sub-layers void write_cel(std::ostream& os, Cel* cel) override { - write_object(m_objects, os, cel, raster::write_cel); + write_object(m_objects, os, cel, doc::write_cel); } void write_image(std::ostream& os, Image* image) override { - write_object(m_objects, os, image, raster::write_image); + write_object(m_objects, os, image, doc::write_image); } void write_layer(std::ostream& os, Layer* layer) override { @@ -65,11 +65,11 @@ public: // How to read cels, images, and sub-layers Cel* read_cel(std::istream& is) override { - return read_object(m_objects, is, raster::read_cel); + return read_object(m_objects, is, doc::read_cel); } Image* read_image(std::istream& is) override { - return read_object(m_objects, is, raster::read_image); + return read_object(m_objects, is, doc::read_image); } Layer* read_layer(std::istream& is) override { @@ -80,11 +80,11 @@ public: // The following operator() calls are used in write/read_object() functions. void operator()(std::ostream& os, Layer* layer) { - raster::write_layer(os, this, layer); + doc::write_layer(os, this, layer); } Layer* operator()(std::istream& is) { - return raster::read_layer(is, this, m_sprite); + return doc::read_layer(is, this, m_sprite); } private: diff --git a/src/app/undoers/remove_layer.h b/src/app/undoers/remove_layer.h index e3c04708d..e91cb4d93 100644 --- a/src/app/undoers/remove_layer.h +++ b/src/app/undoers/remove_layer.h @@ -25,7 +25,7 @@ #include -namespace raster { +namespace doc { class Layer; } @@ -34,7 +34,7 @@ namespace app { namespace undoers { using namespace undo; - using namespace raster; + using namespace doc; class RemoveLayer : public UndoerBase { public: @@ -49,9 +49,9 @@ namespace app { return const_cast(&m_stream)->tellp(); } - ObjectId m_documentId; - ObjectId m_folderId; - ObjectId m_afterId; + undo::ObjectId m_documentId; + undo::ObjectId m_folderId; + undo::ObjectId m_afterId; std::stringstream m_stream; }; diff --git a/src/app/undoers/remove_palette.cpp b/src/app/undoers/remove_palette.cpp index b9320cd4a..54aea15a6 100644 --- a/src/app/undoers/remove_palette.cpp +++ b/src/app/undoers/remove_palette.cpp @@ -24,9 +24,9 @@ #include "app/undoers/add_palette.h" #include "base/unique_ptr.h" -#include "raster/palette.h" -#include "raster/palette_io.h" -#include "raster/sprite.h" +#include "doc/palette.h" +#include "doc/palette_io.h" +#include "doc/sprite.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" @@ -38,7 +38,7 @@ using namespace undo; RemovePalette::RemovePalette(ObjectsContainer* objects, Sprite* sprite, FrameNumber paletteFrame) : m_spriteId(objects->addObject(sprite)) { - raster::write_palette(m_stream, sprite->getPalette(paletteFrame)); + doc::write_palette(m_stream, sprite->getPalette(paletteFrame)); } void RemovePalette::dispose() @@ -49,7 +49,7 @@ void RemovePalette::dispose() void RemovePalette::revert(ObjectsContainer* objects, UndoersCollector* redoers) { Sprite* sprite = objects->getObjectT(m_spriteId); - base::UniquePtr palette(raster::read_palette(m_stream)); + base::UniquePtr palette(doc::read_palette(m_stream)); // Push an AddPalette as redoer redoers->pushUndoer(new AddPalette(objects, sprite, palette->frame())); diff --git a/src/app/undoers/remove_palette.h b/src/app/undoers/remove_palette.h index 7281e8678..465a529d0 100644 --- a/src/app/undoers/remove_palette.h +++ b/src/app/undoers/remove_palette.h @@ -21,18 +21,18 @@ #pragma once #include "app/undoers/undoer_base.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" #include "undo/object_id.h" #include -namespace raster { +namespace doc { class Sprite; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class RemovePalette : public UndoerBase { @@ -48,7 +48,7 @@ namespace app { return const_cast(&m_stream)->tellp(); } - ObjectId m_spriteId; + undo::ObjectId m_spriteId; std::stringstream m_stream; }; diff --git a/src/app/undoers/replace_image.cpp b/src/app/undoers/replace_image.cpp index 3c07aab4f..7699b7f63 100644 --- a/src/app/undoers/replace_image.cpp +++ b/src/app/undoers/replace_image.cpp @@ -23,9 +23,9 @@ #include "app/undoers/replace_image.h" #include "app/undoers/object_io.h" -#include "raster/image.h" -#include "raster/image_io.h" -#include "raster/stock.h" +#include "doc/image.h" +#include "doc/image_io.h" +#include "doc/stock.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" @@ -40,7 +40,7 @@ ReplaceImage::ReplaceImage(ObjectsContainer* objects, Stock* stock, int imageInd { Image* image = stock->getImage(imageIndex); - write_object(objects, m_stream, image, raster::write_image); + write_object(objects, m_stream, image, doc::write_image); } void ReplaceImage::dispose() @@ -53,7 +53,7 @@ void ReplaceImage::revert(ObjectsContainer* objects, UndoersCollector* redoers) Stock* stock = objects->getObjectT(m_stockId); // Read the image to be restored from the stream - Image* image = read_object(objects, m_stream, raster::read_image); + Image* image = read_object(objects, m_stream, doc::read_image); // Save the current image in the redoers redoers->pushUndoer(new ReplaceImage(objects, stock, m_imageIndex)); diff --git a/src/app/undoers/replace_image.h b/src/app/undoers/replace_image.h index 82a64be6f..edee795af 100644 --- a/src/app/undoers/replace_image.h +++ b/src/app/undoers/replace_image.h @@ -25,13 +25,13 @@ #include -namespace raster { +namespace doc { class Stock; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class ReplaceImage : public UndoerBase { @@ -47,7 +47,7 @@ namespace app { return const_cast(&m_stream)->tellp(); } - ObjectId m_stockId; + undo::ObjectId m_stockId; uint32_t m_imageIndex; std::stringstream m_stream; }; diff --git a/src/app/undoers/set_cel_frame.cpp b/src/app/undoers/set_cel_frame.cpp index e3192ad9f..d44c25f0b 100644 --- a/src/app/undoers/set_cel_frame.cpp +++ b/src/app/undoers/set_cel_frame.cpp @@ -22,8 +22,8 @@ #include "app/undoers/set_cel_frame.h" -#include "raster/cel.h" -#include "raster/layer.h" +#include "doc/cel.h" +#include "doc/layer.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/set_cel_frame.h b/src/app/undoers/set_cel_frame.h index 9a9453c17..7b5cce017 100644 --- a/src/app/undoers/set_cel_frame.h +++ b/src/app/undoers/set_cel_frame.h @@ -21,17 +21,17 @@ #pragma once #include "app/undoers/undoer_base.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Cel; class LayerImage; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class SetCelFrame : public UndoerBase { @@ -43,8 +43,8 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_layerId; - ObjectId m_celId; + undo::ObjectId m_layerId; + undo::ObjectId m_celId; FrameNumber m_frame; }; diff --git a/src/app/undoers/set_cel_opacity.cpp b/src/app/undoers/set_cel_opacity.cpp index dbe45af4a..41b23a6cb 100644 --- a/src/app/undoers/set_cel_opacity.cpp +++ b/src/app/undoers/set_cel_opacity.cpp @@ -22,7 +22,7 @@ #include "app/undoers/set_cel_opacity.h" -#include "raster/cel.h" +#include "doc/cel.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/set_cel_opacity.h b/src/app/undoers/set_cel_opacity.h index 7ca561209..52f9d8acb 100644 --- a/src/app/undoers/set_cel_opacity.h +++ b/src/app/undoers/set_cel_opacity.h @@ -23,14 +23,14 @@ #include "app/undoers/undoer_base.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Cel; class Layer; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class SetCelOpacity : public UndoerBase { @@ -42,7 +42,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_celId; + undo::ObjectId m_celId; uint8_t m_opacity; }; diff --git a/src/app/undoers/set_cel_position.cpp b/src/app/undoers/set_cel_position.cpp index a397f67bf..7facd2cf6 100644 --- a/src/app/undoers/set_cel_position.cpp +++ b/src/app/undoers/set_cel_position.cpp @@ -22,7 +22,7 @@ #include "app/undoers/set_cel_position.h" -#include "raster/cel.h" +#include "doc/cel.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/set_cel_position.h b/src/app/undoers/set_cel_position.h index ddd6335b9..f96ee02be 100644 --- a/src/app/undoers/set_cel_position.h +++ b/src/app/undoers/set_cel_position.h @@ -23,14 +23,14 @@ #include "app/undoers/undoer_base.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Cel; class Layer; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class SetCelPosition : public UndoerBase { @@ -42,7 +42,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_celId; + undo::ObjectId m_celId; int m_x, m_y; }; diff --git a/src/app/undoers/set_frame_duration.cpp b/src/app/undoers/set_frame_duration.cpp index 29d905656..aef31d4a4 100644 --- a/src/app/undoers/set_frame_duration.cpp +++ b/src/app/undoers/set_frame_duration.cpp @@ -22,7 +22,7 @@ #include "app/undoers/set_frame_duration.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/set_frame_duration.h b/src/app/undoers/set_frame_duration.h index f62c25812..b9a5a31f3 100644 --- a/src/app/undoers/set_frame_duration.h +++ b/src/app/undoers/set_frame_duration.h @@ -21,16 +21,16 @@ #pragma once #include "app/undoers/undoer_base.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Sprite; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class SetFrameDuration : public UndoerBase { @@ -42,7 +42,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_spriteId; + undo::ObjectId m_spriteId; FrameNumber m_frame; uint32_t m_duration; }; diff --git a/src/app/undoers/set_layer_flags.cpp b/src/app/undoers/set_layer_flags.cpp index cbae94e51..609c47378 100644 --- a/src/app/undoers/set_layer_flags.cpp +++ b/src/app/undoers/set_layer_flags.cpp @@ -22,7 +22,7 @@ #include "app/undoers/set_layer_flags.h" -#include "raster/layer.h" +#include "doc/layer.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/set_layer_flags.h b/src/app/undoers/set_layer_flags.h index 7241d7fcf..336148f25 100644 --- a/src/app/undoers/set_layer_flags.h +++ b/src/app/undoers/set_layer_flags.h @@ -25,13 +25,13 @@ #include -namespace raster { +namespace doc { class Layer; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class SetLayerFlags : public UndoerBase { @@ -43,7 +43,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_layerId; + undo::ObjectId m_layerId; uint32_t m_flags; }; diff --git a/src/app/undoers/set_layer_name.cpp b/src/app/undoers/set_layer_name.cpp index bff4921e8..6e3929562 100644 --- a/src/app/undoers/set_layer_name.cpp +++ b/src/app/undoers/set_layer_name.cpp @@ -22,7 +22,7 @@ #include "app/undoers/set_layer_name.h" -#include "raster/layer.h" +#include "doc/layer.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/set_layer_name.h b/src/app/undoers/set_layer_name.h index 17eff091d..3879c6785 100644 --- a/src/app/undoers/set_layer_name.h +++ b/src/app/undoers/set_layer_name.h @@ -25,13 +25,13 @@ #include -namespace raster { +namespace doc { class Layer; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class SetLayerName : public UndoerBase { @@ -43,7 +43,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_layerId; + undo::ObjectId m_layerId; std::string m_name; }; diff --git a/src/app/undoers/set_mask.cpp b/src/app/undoers/set_mask.cpp index 7713be320..d13a0587e 100644 --- a/src/app/undoers/set_mask.cpp +++ b/src/app/undoers/set_mask.cpp @@ -24,8 +24,8 @@ #include "app/document.h" #include "base/unique_ptr.h" -#include "raster/mask.h" -#include "raster/mask_io.h" +#include "doc/mask.h" +#include "doc/mask_io.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" @@ -39,7 +39,7 @@ SetMask::SetMask(ObjectsContainer* objects, Document* document) , m_isMaskVisible(document->isMaskVisible()) { if (m_isMaskVisible) - raster::write_mask(m_stream, document->mask()); + doc::write_mask(m_stream, document->mask()); } void SetMask::dispose() @@ -55,7 +55,7 @@ void SetMask::revert(ObjectsContainer* objects, UndoersCollector* redoers) redoers->pushUndoer(new SetMask(objects, document)); if (m_isMaskVisible) { - base::UniquePtr mask(raster::read_mask(m_stream)); + base::UniquePtr mask(doc::read_mask(m_stream)); document->setMask(mask); diff --git a/src/app/undoers/set_mask_position.cpp b/src/app/undoers/set_mask_position.cpp index aebbef0cc..8d12215aa 100644 --- a/src/app/undoers/set_mask_position.cpp +++ b/src/app/undoers/set_mask_position.cpp @@ -23,7 +23,7 @@ #include "app/undoers/set_mask_position.h" #include "app/document.h" -#include "raster/mask.h" +#include "doc/mask.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/set_mask_position.h b/src/app/undoers/set_mask_position.h index a8a1314d7..5623baf43 100644 --- a/src/app/undoers/set_mask_position.h +++ b/src/app/undoers/set_mask_position.h @@ -40,7 +40,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_documentId; + undo::ObjectId m_documentId; int m_x, m_y; }; diff --git a/src/app/undoers/set_palette_colors.cpp b/src/app/undoers/set_palette_colors.cpp index e0eacdf21..61a8702ce 100644 --- a/src/app/undoers/set_palette_colors.cpp +++ b/src/app/undoers/set_palette_colors.cpp @@ -23,8 +23,8 @@ #include "app/undoers/set_palette_colors.h" #include "base/serialization.h" -#include "raster/palette.h" -#include "raster/sprite.h" +#include "doc/palette.h" +#include "doc/sprite.h" #include "undo/objects_container.h" #include "undo/undo_exception.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/set_palette_colors.h b/src/app/undoers/set_palette_colors.h index af249b6e7..4888d0992 100644 --- a/src/app/undoers/set_palette_colors.h +++ b/src/app/undoers/set_palette_colors.h @@ -21,19 +21,19 @@ #pragma once #include "app/undoers/undoer_base.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" #include "undo/object_id.h" #include -namespace raster { +namespace doc { class Palette; class Sprite; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class SetPaletteColors : public UndoerBase { @@ -49,7 +49,7 @@ namespace app { return const_cast(&m_stream)->tellp(); } - ObjectId m_spriteId; + undo::ObjectId m_spriteId; FrameNumber m_frame; uint8_t m_from; uint8_t m_to; diff --git a/src/app/undoers/set_sprite_pixel_format.cpp b/src/app/undoers/set_sprite_pixel_format.cpp index afe4516c8..a4b12acc6 100644 --- a/src/app/undoers/set_sprite_pixel_format.cpp +++ b/src/app/undoers/set_sprite_pixel_format.cpp @@ -22,7 +22,7 @@ #include "app/undoers/set_sprite_pixel_format.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/set_sprite_pixel_format.h b/src/app/undoers/set_sprite_pixel_format.h index 24f7ceea5..842d57edf 100644 --- a/src/app/undoers/set_sprite_pixel_format.h +++ b/src/app/undoers/set_sprite_pixel_format.h @@ -23,13 +23,13 @@ #include "app/undoers/undoer_base.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Sprite; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class SetSpritePixelFormat : public UndoerBase { @@ -41,7 +41,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_spriteId; + undo::ObjectId m_spriteId; uint32_t m_format; }; diff --git a/src/app/undoers/set_sprite_size.cpp b/src/app/undoers/set_sprite_size.cpp index 69182c399..c0fbc9064 100644 --- a/src/app/undoers/set_sprite_size.cpp +++ b/src/app/undoers/set_sprite_size.cpp @@ -22,7 +22,7 @@ #include "app/undoers/set_sprite_size.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/set_sprite_size.h b/src/app/undoers/set_sprite_size.h index c0472d84a..e85b452d0 100644 --- a/src/app/undoers/set_sprite_size.h +++ b/src/app/undoers/set_sprite_size.h @@ -23,13 +23,13 @@ #include "app/undoers/undoer_base.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Sprite; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class SetSpriteSize : public UndoerBase { @@ -41,7 +41,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_spriteId; + undo::ObjectId m_spriteId; uint32_t m_width; uint32_t m_height; }; diff --git a/src/app/undoers/set_sprite_transparent_color.cpp b/src/app/undoers/set_sprite_transparent_color.cpp index 5d589df47..571a226e7 100644 --- a/src/app/undoers/set_sprite_transparent_color.cpp +++ b/src/app/undoers/set_sprite_transparent_color.cpp @@ -22,7 +22,7 @@ #include "app/undoers/set_sprite_transparent_color.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/set_sprite_transparent_color.h b/src/app/undoers/set_sprite_transparent_color.h index de14a3519..0e9abeaf6 100644 --- a/src/app/undoers/set_sprite_transparent_color.h +++ b/src/app/undoers/set_sprite_transparent_color.h @@ -23,13 +23,13 @@ #include "app/undoers/undoer_base.h" #include "undo/object_id.h" -namespace raster { +namespace doc { class Sprite; } namespace app { namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class SetSpriteTransparentColor : public UndoerBase { @@ -41,7 +41,7 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_spriteId; + undo::ObjectId m_spriteId; uint32_t m_maskColor; }; diff --git a/src/app/undoers/set_total_frames.cpp b/src/app/undoers/set_total_frames.cpp index c50c7415f..2fe146525 100644 --- a/src/app/undoers/set_total_frames.cpp +++ b/src/app/undoers/set_total_frames.cpp @@ -24,7 +24,7 @@ #include "app/document.h" #include "app/document_api.h" -#include "raster/sprite.h" +#include "doc/sprite.h" #include "undo/objects_container.h" #include "undo/undoers_collector.h" diff --git a/src/app/undoers/set_total_frames.h b/src/app/undoers/set_total_frames.h index d9122ffca..e559afaa2 100644 --- a/src/app/undoers/set_total_frames.h +++ b/src/app/undoers/set_total_frames.h @@ -21,12 +21,12 @@ #pragma once #include "app/undoers/undoer_base.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" #include "undo/object_id.h" #include -namespace raster { +namespace doc { class Sprite; } @@ -34,7 +34,7 @@ namespace app { class Document; namespace undoers { - using namespace raster; + using namespace doc; using namespace undo; class SetTotalFrames : public UndoerBase { @@ -46,8 +46,8 @@ namespace app { void revert(ObjectsContainer* objects, UndoersCollector* redoers) override; private: - ObjectId m_documentId; - ObjectId m_spriteId; + undo::ObjectId m_documentId; + undo::ObjectId m_spriteId; FrameNumber m_totalFrames; }; diff --git a/src/app/util/autocrop.cpp b/src/app/util/autocrop.cpp index 5d243815a..c33391ff8 100644 --- a/src/app/util/autocrop.cpp +++ b/src/app/util/autocrop.cpp @@ -20,14 +20,14 @@ #include "config.h" #endif -#include "raster/image.h" -#include "raster/mask.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/mask.h" +#include "doc/sprite.h" #include "app/util/autocrop.h" namespace app { -using namespace raster; +using namespace doc; bool get_shrink_rect(int *x1, int *y1, int *x2, int *y2, Image *image, int refpixel) diff --git a/src/app/util/autocrop.h b/src/app/util/autocrop.h index 616ca932f..ecae5ca82 100644 --- a/src/app/util/autocrop.h +++ b/src/app/util/autocrop.h @@ -20,16 +20,16 @@ #define APP_UTIL_AUTOCROP_H_INCLUDED #pragma once -namespace raster { +namespace doc { class Image; } namespace app { bool get_shrink_rect(int* x1, int* y1, int* x2, int* y2, - raster::Image *image, int refpixel); + doc::Image *image, int refpixel); bool get_shrink_rect2(int* x1, int* y1, int* x2, int* y2, - raster::Image* image, raster::Image* regimage); + doc::Image* image, doc::Image* regimage); } // namespace app diff --git a/src/app/util/boundary.cpp b/src/app/util/boundary.cpp index ef0ccefb2..a546bb486 100644 --- a/src/app/util/boundary.cpp +++ b/src/app/util/boundary.cpp @@ -32,8 +32,8 @@ // For Aseprite #include #include "base/memory.h" -#include "raster/image.h" -#include "raster/image_bits.h" +#include "doc/image.h" +#include "doc/image_bits.h" #include "app/util/boundary.h" #define g_new(struct_type, n_structs) \ @@ -46,7 +46,7 @@ #define gboolean bool #define G_MAXINT INT_MAX #define g_message(msg) {} -#define PixelRegion const raster::Image +#define PixelRegion const doc::Image namespace app { ////////////////////////////////////////////////////////////////////// diff --git a/src/app/util/boundary.h b/src/app/util/boundary.h index 5f8d0e3be..0f5c246de 100644 --- a/src/app/util/boundary.h +++ b/src/app/util/boundary.h @@ -25,12 +25,12 @@ #define APP_UTIL_BOUNDARY_H_INCLUDED #pragma once -namespace raster { +namespace doc { class Image; } namespace app { - using namespace raster; + using namespace doc; enum BoundaryType { WithinBounds, diff --git a/src/app/util/clipboard.cpp b/src/app/util/clipboard.cpp index 2ec7a5530..b9b2e4218 100644 --- a/src/app/util/clipboard.cpp +++ b/src/app/util/clipboard.cpp @@ -44,7 +44,7 @@ #include "app/undoers/image_area.h" #include "app/util/clipboard.h" #include "app/util/misc.h" -#include "raster/raster.h" +#include "doc/doc.h" #include "undo/undo_history.h" #if defined WIN32 @@ -87,7 +87,7 @@ namespace { } -using namespace raster; +using namespace doc; static void set_clipboard_image(Image* image, Palette* palette, bool set_system_clipboard); static bool copy_from_document(const DocumentLocation& location); diff --git a/src/app/util/clipboard.h b/src/app/util/clipboard.h index 05614f051..2349d185b 100644 --- a/src/app/util/clipboard.h +++ b/src/app/util/clipboard.h @@ -24,7 +24,7 @@ #include "gfx/size.h" #include "ui/base.h" -namespace raster { +namespace doc { class Image; class Palette; } @@ -35,7 +35,7 @@ namespace app { class DocumentRange; namespace clipboard { - using namespace raster; + using namespace doc; enum ClipboardFormat { ClipboardNone, diff --git a/src/app/util/clipboard_win32.h b/src/app/util/clipboard_win32.h index 9238c2b36..d7cc5de11 100644 --- a/src/app/util/clipboard_win32.h +++ b/src/app/util/clipboard_win32.h @@ -18,7 +18,7 @@ // included by clipboard.cpp -#include "raster/color_scales.h" +#include "doc/color_scales.h" #include "she/display.h" #include "she/system.h" #include "ui/alert.h" @@ -33,7 +33,7 @@ namespace { -using namespace raster; +using namespace doc; static uint32_t get_shift_from_mask(uint32_t mask) { diff --git a/src/app/util/expand_cel_canvas.cpp b/src/app/util/expand_cel_canvas.cpp index 4199b4ae0..0bc2eea78 100644 --- a/src/app/util/expand_cel_canvas.cpp +++ b/src/app/util/expand_cel_canvas.cpp @@ -33,17 +33,17 @@ #include "app/undoers/replace_image.h" #include "app/undoers/set_cel_position.h" #include "base/unique_ptr.h" -#include "raster/cel.h" -#include "raster/dirty.h" -#include "raster/layer.h" -#include "raster/primitives.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/dirty.h" +#include "doc/layer.h" +#include "doc/primitives.h" +#include "doc/sprite.h" +#include "doc/stock.h" namespace { -static raster::ImageBufferPtr src_buffer; -static raster::ImageBufferPtr dst_buffer; +static doc::ImageBufferPtr src_buffer; +static doc::ImageBufferPtr dst_buffer; static void destroy_buffers() { @@ -56,8 +56,8 @@ static void create_buffers() if (!src_buffer) { app::App::instance()->Exit.connect(&destroy_buffers); - src_buffer.reset(new raster::ImageBuffer(1)); - dst_buffer.reset(new raster::ImageBuffer(1)); + src_buffer.reset(new doc::ImageBuffer(1)); + dst_buffer.reset(new doc::ImageBuffer(1)); } } diff --git a/src/app/util/expand_cel_canvas.h b/src/app/util/expand_cel_canvas.h index bb4bf9338..5785f9816 100644 --- a/src/app/util/expand_cel_canvas.h +++ b/src/app/util/expand_cel_canvas.h @@ -23,7 +23,7 @@ #include "filters/tiled_mode.h" #include "gfx/rect.h" -namespace raster { +namespace doc { class Cel; class Image; class Layer; @@ -36,7 +36,7 @@ namespace app { class UndoTransaction; using namespace filters; - using namespace raster; + using namespace doc; // This class can be used to expand the canvas of the current cel to // the visible portion of sprite. If the user cancels the operation, diff --git a/src/app/util/misc.cpp b/src/app/util/misc.cpp index 3ef557af1..89279c4d6 100644 --- a/src/app/util/misc.cpp +++ b/src/app/util/misc.cpp @@ -30,14 +30,14 @@ #include "app/ui/editor/editor.h" #include "app/ui/status_bar.h" #include "app/util/misc.h" -#include "raster/raster.h" +#include "doc/doc.h" #include "ui/manager.h" #include "ui/system.h" #include "ui/widget.h" namespace app { -using namespace raster; +using namespace doc; Image* NewImageFromMask(const DocumentLocation& location) { diff --git a/src/app/util/misc.h b/src/app/util/misc.h index ac86dbcdc..6fb678ea6 100644 --- a/src/app/util/misc.h +++ b/src/app/util/misc.h @@ -20,14 +20,14 @@ #define APP_UTIL_MISC_H_INCLUDED #pragma once -namespace raster { +namespace doc { class Image; } namespace app { class DocumentLocation; - raster::Image* NewImageFromMask(const DocumentLocation& location); + doc::Image* NewImageFromMask(const DocumentLocation& location); } // namespace app diff --git a/src/app/util/msk_file.cpp b/src/app/util/msk_file.cpp index e4b7ac9ab..e9367b834 100644 --- a/src/app/util/msk_file.cpp +++ b/src/app/util/msk_file.cpp @@ -25,12 +25,12 @@ #include "base/file_handle.h" #include "base/fs.h" #include "base/unique_ptr.h" -#include "raster/image.h" -#include "raster/mask.h" +#include "doc/image.h" +#include "doc/mask.h" namespace app { -using namespace raster; +using namespace doc; // Loads a MSK file (Animator and Animator Pro format) Mask* load_msk_file(const char* filename) diff --git a/src/app/util/msk_file.h b/src/app/util/msk_file.h index abff80a45..a4554848d 100644 --- a/src/app/util/msk_file.h +++ b/src/app/util/msk_file.h @@ -20,14 +20,14 @@ #define APP_UTIL_MSK_FILE_H_INCLUDED #pragma once -namespace raster { +namespace doc { class Mask; } namespace app { - raster::Mask* load_msk_file(const char* filename); - int save_msk_file(const raster::Mask* mask, const char* filename); + doc::Mask* load_msk_file(const char* filename); + int save_msk_file(const doc::Mask* mask, const char* filename); } // namespace app diff --git a/src/app/util/pic_file.cpp b/src/app/util/pic_file.cpp index f1edf9955..04f074bf2 100644 --- a/src/app/util/pic_file.cpp +++ b/src/app/util/pic_file.cpp @@ -23,16 +23,16 @@ #include "base/cfile.h" #include "base/file_handle.h" #include "base/unique_ptr.h" -#include "raster/color_scales.h" -#include "raster/image.h" -#include "raster/palette.h" -#include "raster/primitives.h" +#include "doc/color_scales.h" +#include "doc/image.h" +#include "doc/palette.h" +#include "doc/primitives.h" #include namespace app { -using namespace raster; +using namespace doc; // Loads a PIC file (Animator and Animator Pro format) Image* load_pic_file(const char* filename, int* x, int* y, Palette** palette) diff --git a/src/app/util/pic_file.h b/src/app/util/pic_file.h index f7bfba072..727679b20 100644 --- a/src/app/util/pic_file.h +++ b/src/app/util/pic_file.h @@ -20,15 +20,15 @@ #define APP_UTIL_PIC_FILE_H_INCLUDED #pragma once -namespace raster { +namespace doc { class Image; class Palette; } namespace app { - raster::Image* load_pic_file(const char* filename, int *x, int *y, raster::Palette** palette); - int save_pic_file(const char* filename, int x, int y, const raster::Palette* palette, const raster::Image* image); + doc::Image* load_pic_file(const char* filename, int *x, int *y, doc::Palette** palette); + int save_pic_file(const char* filename, int x, int y, const doc::Palette* palette, const doc::Image* image); } // namespace app diff --git a/src/app/util/range_utils.cpp b/src/app/util/range_utils.cpp index 771e3e5a9..4a3b0771f 100644 --- a/src/app/util/range_utils.cpp +++ b/src/app/util/range_utils.cpp @@ -23,12 +23,12 @@ #include "app/context_access.h" #include "app/document.h" #include "app/document_range.h" -#include "raster/layer.h" -#include "raster/sprite.h" +#include "doc/layer.h" +#include "doc/sprite.h" namespace app { -using namespace raster; +using namespace doc; // TODO the DocumentRange should be "iteratable" to replace this function CelList get_cels_in_range(Sprite* sprite, const DocumentRange& range) diff --git a/src/app/util/range_utils.h b/src/app/util/range_utils.h index 554378461..7ac63cac9 100644 --- a/src/app/util/range_utils.h +++ b/src/app/util/range_utils.h @@ -20,14 +20,14 @@ #define APP_UTIL_RANGE_UTILS_H_INCLUDED #pragma once -#include "raster/object.h" +#include "doc/object.h" #include namespace app { class DocumentRange; - CelList get_cels_in_range(raster::Sprite* sprite, const DocumentRange& range); + CelList get_cels_in_range(doc::Sprite* sprite, const DocumentRange& range); } // namespace app diff --git a/src/app/util/render.cpp b/src/app/util/render.cpp index 4ee2633cb..a44c87028 100644 --- a/src/app/util/render.cpp +++ b/src/app/util/render.cpp @@ -25,7 +25,7 @@ #include "app/color_utils.h" #include "app/document.h" #include "app/ini_file.h" -#include "raster/raster.h" +#include "doc/doc.h" #include "app/settings/document_settings.h" #include "app/settings/settings.h" #include "app/ui_context.h" @@ -576,7 +576,7 @@ void RenderEngine::renderLayer( switch (layer->type()) { - case OBJECT_LAYER_IMAGE: { + case ObjectType::LayerImage: { if ((!render_background && layer->isBackground()) || (!render_transparent && !layer->isBackground())) break; @@ -617,7 +617,7 @@ void RenderEngine::renderLayer( break; } - case OBJECT_LAYER_FOLDER: { + case ObjectType::LayerFolder: { LayerConstIterator it = static_cast(layer)->getLayerBegin(); LayerConstIterator end = static_cast(layer)->getLayerEnd(); diff --git a/src/app/util/render.h b/src/app/util/render.h index 7e62807be..dd33e9ec7 100644 --- a/src/app/util/render.h +++ b/src/app/util/render.h @@ -21,9 +21,9 @@ #pragma once #include "app/color.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" -namespace raster { +namespace doc { class Image; class Layer; class Palette; @@ -33,7 +33,7 @@ namespace raster { namespace app { class Document; - using namespace raster; + using namespace doc; class RenderEngine { public: diff --git a/src/doc/CMakeLists.txt b/src/doc/CMakeLists.txt index 1d59d4fa6..218b77819 100644 --- a/src/doc/CMakeLists.txt +++ b/src/doc/CMakeLists.txt @@ -1,9 +1,43 @@ # Aseprite Document Library -# Copyright (C) 2014 David Capello +# Copyright (C) 2001-2014 David Capello add_library(doc-lib + algo.cpp + algorithm/flip_image.cpp + algorithm/floodfill.cpp + algorithm/polygon.cpp + algorithm/resize_image.cpp + algorithm/rotate.cpp + algorithm/rotsprite.cpp + algorithm/shrink_bounds.cpp + blend.cpp + brush.cpp + cel.cpp + cel_io.cpp + color_scales.cpp context.cpp + conversion_she.cpp + dirty.cpp + dirty_io.cpp document.cpp documents.cpp + file/col_file.cpp + file/gpl_file.cpp + image.cpp + image_io.cpp + images_collector.cpp + layer.cpp + layer_index.cpp + layer_io.cpp + mask.cpp + mask_io.cpp object.cpp - sprites.cpp) + object.cpp + palette.cpp + palette_io.cpp + primitives.cpp + quantization.cpp + rgbmap.cpp + sprite.cpp + sprites.cpp + stock.cpp) diff --git a/src/doc/LICENSE.txt b/src/doc/LICENSE.txt index aea0f6e8f..220ac0d42 100644 --- a/src/doc/LICENSE.txt +++ b/src/doc/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2014 David Capello +Copyright (c) 2001-2014 David Capello Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/src/doc/README.md b/src/doc/README.md index 8cbebfe38..762bfeb36 100644 --- a/src/doc/README.md +++ b/src/doc/README.md @@ -1,4 +1,4 @@ # Aseprite Document Library -*Copyright (C) 2014 David Capello* +*Copyright (C) 2001-2014 David Capello* > Distributed under [MIT license](LICENSE.txt) diff --git a/src/raster/algo.cpp b/src/doc/algo.cpp similarity index 94% rename from src/raster/algo.cpp rename to src/doc/algo.cpp index a6c1476a5..9475f8490 100644 --- a/src/raster/algo.cpp +++ b/src/doc/algo.cpp @@ -1,20 +1,8 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" @@ -22,10 +10,10 @@ #include -#include "raster/algo.h" -#include "raster/dirty.h" +#include "doc/algo.h" +#include "doc/dirty.h" -namespace raster { +namespace doc { // Algorightm from Allegro (allegro/src/gfx.c) // Adapted for Aseprite by David Capello. @@ -616,4 +604,4 @@ double algo_spline_get_tan(double x0, double y0, double x1, double y1, return dy / dx; } -} // namespace raster +} // namespace doc diff --git a/src/doc/algo.h b/src/doc/algo.h new file mode 100644 index 000000000..6474c879c --- /dev/null +++ b/src/doc/algo.h @@ -0,0 +1,37 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_ALGO_H_INCLUDED +#define DOC_ALGO_H_INCLUDED +#pragma once + +#include "gfx/fwd.h" +#include "doc/algorithm/hline.h" + +namespace doc { + + class Image; + + typedef void (*AlgoPixel)(int x, int y, void *data); + typedef void (*AlgoLine)(int x1, int y1, int x2, int y2, void *data); + + void algo_line(int x1, int y1, int x2, int y2, void *data, AlgoPixel proc); + void algo_ellipse(int x1, int y1, int x2, int y2, void *data, AlgoPixel proc); + void algo_ellipsefill(int x1, int y1, int x2, int y2, void *data, AlgoHLine proc); + + void algo_spline(double x0, double y0, double x1, double y1, + double x2, double y2, double x3, double y3, + void *data, AlgoLine proc); + double algo_spline_get_y(double x0, double y0, double x1, double y1, + double x2, double y2, double x3, double y3, + double x); + double algo_spline_get_tan(double x0, double y0, double x1, double y1, + double x2, double y2, double x3, double y3, + double in_x); + +} // namespace doc + +#endif diff --git a/src/raster/algorithm/flip_image.cpp b/src/doc/algorithm/flip_image.cpp similarity index 69% rename from src/raster/algorithm/flip_image.cpp rename to src/doc/algorithm/flip_image.cpp index 1017a36e3..2176026b6 100644 --- a/src/raster/algorithm/flip_image.cpp +++ b/src/doc/algorithm/flip_image.cpp @@ -1,36 +1,24 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/algorithm/flip_image.h" +#include "doc/algorithm/flip_image.h" #include "base/unique_ptr.h" #include "gfx/rect.h" -#include "raster/image.h" -#include "raster/mask.h" -#include "raster/primitives.h" +#include "doc/image.h" +#include "doc/mask.h" +#include "doc/primitives.h" #include -namespace raster { +namespace doc { namespace algorithm { void flip_image(Image* image, const gfx::Rect& bounds, FlipType flipType) @@ -112,4 +100,4 @@ void flip_image_with_mask(Image* image, const Mask* mask, FlipType flipType, int } } // namespace algorithm -} // namespace raster +} // namespace doc diff --git a/src/doc/algorithm/flip_image.h b/src/doc/algorithm/flip_image.h new file mode 100644 index 000000000..fd2888a7a --- /dev/null +++ b/src/doc/algorithm/flip_image.h @@ -0,0 +1,31 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_ALGORITHM_FLIP_IMAGE_H_INCLUDED +#define DOC_ALGORITHM_FLIP_IMAGE_H_INCLUDED +#pragma once + +#include "gfx/fwd.h" +#include "doc/algorithm/flip_type.h" + +namespace doc { + class Image; + class Mask; + + namespace algorithm { + + // Flips the rectangular region specified in the "bounds" parameter. + void flip_image(Image* image, const gfx::Rect& bounds, FlipType flipType); + + // Flips an irregular region specified by the "mask". The + // "bgcolor" is used to clear areas that aren't covered by a + // mirrored pixel. + void flip_image_with_mask(Image* image, const Mask* mask, FlipType flipType, int bgcolor); + + } +} + +#endif diff --git a/src/doc/algorithm/flip_type.h b/src/doc/algorithm/flip_type.h new file mode 100644 index 000000000..efc547de0 --- /dev/null +++ b/src/doc/algorithm/flip_type.h @@ -0,0 +1,22 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_ALGORITHM_FLIP_TYPE_H_INCLUDED +#define DOC_ALGORITHM_FLIP_TYPE_H_INCLUDED +#pragma once + +namespace doc { + namespace algorithm { + + enum FlipType { + FlipHorizontal, + FlipVertical, + }; + + } +} + +#endif diff --git a/src/raster/algofill.cpp b/src/doc/algorithm/floodfill.cpp similarity index 97% rename from src/raster/algofill.cpp rename to src/doc/algorithm/floodfill.cpp index 96bbe018f..2f495855c 100644 --- a/src/raster/algofill.cpp +++ b/src/doc/algorithm/floodfill.cpp @@ -1,24 +1,28 @@ // The floodfill routine. // By Shawn Hargreaves. +// // Adapted to Aseprite by David Capello // Added non-contiguous mode by David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. +// +// TODO rewrite this algorithm from scratch #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/algo.h" -#include "raster/image.h" -#include "raster/primitives.h" +#include "doc/algo.h" +#include "doc/image.h" +#include "doc/primitives.h" #include #include #include -namespace raster { +namespace doc { +namespace algorithm { struct FLOODED_LINE { // store segments which have been flooded short flags; // status of the segment @@ -317,7 +321,7 @@ static void replace_color(Image* image, const gfx::Rect& bounds, int src_color, /* floodfill: * Fills an enclosed area (starting at point x, y) with the specified color. */ -void algo_floodfill(Image* image, int x, int y, +void floodfill(Image* image, int x, int y, const gfx::Rect& bounds, int tolerance, bool contiguous, void* data, AlgoHLine proc) @@ -396,4 +400,5 @@ void algo_floodfill(Image* image, int x, int y, } while (!done); } -} // namespace raster +} // namespace algorithm +} // namespace doc diff --git a/src/doc/algorithm/floodfill.h b/src/doc/algorithm/floodfill.h new file mode 100644 index 000000000..6a8e58a20 --- /dev/null +++ b/src/doc/algorithm/floodfill.h @@ -0,0 +1,28 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_ALGORITHM_FLOODFILL_H_INCLUDED +#define DOC_ALGORITHM_FLOODFILL_H_INCLUDED +#pragma once + +#include "doc/algorithm/hline.h" +#include "gfx/fwd.h" + +namespace doc { + + class Image; + + namespace algorithm { + + void floodfill(Image* image, int x, int y, + const gfx::Rect& bounds, + int tolerance, bool contiguous, + void* data, AlgoHLine proc); + + } +} + +#endif diff --git a/src/doc/algorithm/hline.h b/src/doc/algorithm/hline.h new file mode 100644 index 000000000..bc516af61 --- /dev/null +++ b/src/doc/algorithm/hline.h @@ -0,0 +1,17 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_ALGORITHM_HLINE_H_INCLUDED +#define DOC_ALGORITHM_HLINE_H_INCLUDED +#pragma once + +namespace doc { + + typedef void (*AlgoHLine)(int x1, int y, int x2, void *data); + +} // namespace doc + +#endif diff --git a/src/raster/algo_polygon.cpp b/src/doc/algorithm/polygon.cpp similarity index 74% rename from src/raster/algo_polygon.cpp rename to src/doc/algorithm/polygon.cpp index 172980aed..b9df38127 100644 --- a/src/raster/algo_polygon.cpp +++ b/src/doc/algorithm/polygon.cpp @@ -1,44 +1,35 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. +// +// TODO rewrite this algorithm from scratch #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include +#include "doc/algorithm/polygon.h" #include "gfx/point.h" -#include "raster/algo.h" -namespace raster { +#include + +namespace doc { using namespace gfx; -// algo_polygon is an adaptation from Matthieu Haller code of GD library +// polygon() is an adaptation from Matthieu Haller code of GD library -/* THANKS to Kirsten Schulz for the polygon fixes! */ +// THANKS to Kirsten Schulz for the polygon fixes! /* The intersection finding technique of this code could be improved */ /* by remembering the previous intertersection, and by using the slope. */ /* That could help to adjust intersections to produce a nice */ /* interior_extrema. */ -void algo_polygon(int vertices, const int* points, void* data, AlgoHLine proc) +void algorithm::polygon(int vertices, const int* points, void* data, AlgoHLine proc) { int n = vertices; if (!n) @@ -150,4 +141,4 @@ void algo_polygon(int vertices, const int* points, void* data, AlgoHLine proc) } } -} // namespace raster +} // namespace doc diff --git a/src/doc/algorithm/polygon.h b/src/doc/algorithm/polygon.h new file mode 100644 index 000000000..16f061a05 --- /dev/null +++ b/src/doc/algorithm/polygon.h @@ -0,0 +1,22 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_ALGORITHM_POLYGON_H_INCLUDED +#define DOC_ALGORITHM_POLYGON_H_INCLUDED +#pragma once + +#include "doc/algorithm/hline.h" +#include "gfx/fwd.h" + +namespace doc { + namespace algorithm { + + void polygon(int vertices, const int* points, void* data, AlgoHLine proc); + + } +} + +#endif diff --git a/src/raster/algorithm/resize_image.cpp b/src/doc/algorithm/resize_image.cpp similarity index 87% rename from src/raster/algorithm/resize_image.cpp rename to src/doc/algorithm/resize_image.cpp index 006ee9638..f2a4f7ec5 100644 --- a/src/raster/algorithm/resize_image.cpp +++ b/src/doc/algorithm/resize_image.cpp @@ -1,34 +1,22 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/algorithm/resize_image.h" +#include "doc/algorithm/resize_image.h" #include "gfx/point.h" -#include "raster/image.h" -#include "raster/image_bits.h" -#include "raster/palette.h" -#include "raster/rgbmap.h" +#include "doc/image.h" +#include "doc/image_bits.h" +#include "doc/palette.h" +#include "doc/rgbmap.h" -namespace raster { +namespace doc { namespace algorithm { void resize_image(const Image* src, Image* dst, ResizeMethod method, const Palette* pal, const RgbMap* rgbmap) @@ -235,4 +223,4 @@ void fixup_image_transparent_colors(Image* image) } } // namespace algorithm -} // namespace raster +} // namespace doc diff --git a/src/raster/algorithm/resize_image.h b/src/doc/algorithm/resize_image.h similarity index 52% rename from src/raster/algorithm/resize_image.h rename to src/doc/algorithm/resize_image.h index 551eb1900..c3b1ac1a9 100644 --- a/src/raster/algorithm/resize_image.h +++ b/src/doc/algorithm/resize_image.h @@ -1,28 +1,16 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_ALGORITHM_RESIZE_IMAGE_H_INCLUDED -#define RASTER_ALGORITHM_RESIZE_IMAGE_H_INCLUDED +#ifndef DOC_ALGORITHM_RESIZE_IMAGE_H_INCLUDED +#define DOC_ALGORITHM_RESIZE_IMAGE_H_INCLUDED #pragma once #include "gfx/fwd.h" -namespace raster { +namespace doc { class Image; class Palette; class RgbMap; diff --git a/src/raster/rotate.cpp b/src/doc/algorithm/rotate.cpp similarity index 97% rename from src/raster/rotate.cpp rename to src/doc/algorithm/rotate.cpp index f12fee379..a19df028e 100644 --- a/src/raster/rotate.cpp +++ b/src/doc/algorithm/rotate.cpp @@ -12,15 +12,16 @@ #endif #include "fixmath/fixmath.h" -#include "raster/blend.h" -#include "raster/image.h" -#include "raster/image_bits.h" -#include "raster/primitives.h" -#include "raster/primitives_fast.h" +#include "doc/blend.h" +#include "doc/image.h" +#include "doc/image_bits.h" +#include "doc/primitives.h" +#include "doc/primitives_fast.h" #include -namespace raster { +namespace doc { +namespace algorithm { using namespace fixmath; @@ -70,7 +71,7 @@ private: color_t m_mask; }; -void image_scale(Image *dst, Image *src, int x, int y, int w, int h) +void scale_image(Image *dst, Image *src, int x, int y, int w, int h) { if (w == src->width() && src->height() == h) composite_image(dst, src, x, y, 255, BLEND_MODE_NORMAL); @@ -96,8 +97,8 @@ void image_scale(Image *dst, Image *src, int x, int y, int w, int h) } } -void image_rotate(Image *dst, Image *src, int x, int y, int w, int h, - int cx, int cy, double angle) +void rotate_image(Image *dst, Image *src, int x, int y, int w, int h, + int cx, int cy, double angle) { fixed xs[4], ys[4]; @@ -116,9 +117,9 @@ void image_rotate(Image *dst, Image *src, int x, int y, int w, int h, | | 4-----3 */ -void image_parallelogram (Image *bmp, Image *sprite, - int x1, int y1, int x2, int y2, - int x3, int y3, int x4, int y4) +void parallelogram(Image *bmp, Image *sprite, + int x1, int y1, int x2, int y2, + int x3, int y3, int x4, int y4) { fixed xs[4], ys[4]; @@ -795,4 +796,5 @@ static void ase_rotate_scale_flip_coordinates(fixed w, fixed h, ys[br] = ys[tr] + ys[bl] - ys[tl]; } -} // namespace raster +} // namespace algorithm +} // namespace doc diff --git a/src/doc/algorithm/rotate.h b/src/doc/algorithm/rotate.h new file mode 100644 index 000000000..4e48fe289 --- /dev/null +++ b/src/doc/algorithm/rotate.h @@ -0,0 +1,30 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_ALGORITHM_ROTATE_H_INCLUDED +#define DOC_ALGORITHM_ROTATE_H_INCLUDED +#pragma once + +namespace doc { + class Image; + + namespace algorithm { + + void scale_image(Image* dst, Image* src, + int x, int y, int w, int h); + + void rotate_image(Image* dst, Image* src, + int x, int y, int w, int h, + int cx, int cy, double angle); + + void parallelogram(Image* bmp, Image* sprite, + int x1, int y1, int x2, int y2, + int x3, int y3, int x4, int y4); + + } // namespace algorithm +} // namespace doc + +#endif diff --git a/src/raster/rotsprite.cpp b/src/doc/algorithm/rotsprite.cpp similarity index 82% rename from src/raster/rotsprite.cpp rename to src/doc/algorithm/rotsprite.cpp index 4f021e5c5..8daeec4ea 100644 --- a/src/raster/rotsprite.cpp +++ b/src/doc/algorithm/rotsprite.cpp @@ -1,34 +1,23 @@ -/* Aseprite - * Copyright (C) 2001-2014 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "base/unique_ptr.h" -#include "raster/blend.h" -#include "raster/image.h" -#include "raster/image_bits.h" -#include "raster/primitives.h" -#include "raster/primitives_fast.h" -#include "raster/rotate.h" +#include "doc/algorithm/rotate.h" +#include "doc/blend.h" +#include "doc/image.h" +#include "doc/image_bits.h" +#include "doc/primitives.h" +#include "doc/primitives_fast.h" -namespace raster { +namespace doc { +namespace algorithm { // More information about EPX/Scale2x: // http://en.wikipedia.org/wiki/Pixel_art_scaling_algorithms#EPX.2FScale2.C3.97.2FAdvMAME2.C3.97 @@ -163,10 +152,10 @@ static void image_scale2x(Image* dst, const Image* src, int src_w, int src_h) case IMAGE_BITMAP: image_scale2x_tpl(dst, src, src_w, src_h); break; } } - -void image_rotsprite(Image* bmp, Image* spr, - int x1, int y1, int x2, int y2, - int x3, int y3, int x4, int y4) + +void rotsprite_image(Image* bmp, Image* spr, + int x1, int y1, int x2, int y2, + int x3, int y3, int x4, int y4) { static ImageBufferPtr buf1, buf2, buf3; // TODO non-thread safe @@ -195,10 +184,13 @@ void image_rotsprite(Image* bmp, Image* spr, spr_copy->copy(tmp_copy, 0, 0); } - image_parallelogram(bmp_copy, spr_copy, + doc::algorithm::parallelogram(bmp_copy, spr_copy, x1*scale, y1*scale, x2*scale, y2*scale, x3*scale, y3*scale, x4*scale, y4*scale); - image_scale(bmp, bmp_copy, 0, 0, bmp->width(), bmp->height()); + + doc::algorithm::scale_image(bmp, bmp_copy, + 0, 0, bmp->width(), bmp->height()); } -} // namespace raster +} // namespace algorithm +} // namespace doc diff --git a/src/doc/algorithm/rotsprite.h b/src/doc/algorithm/rotsprite.h new file mode 100644 index 000000000..578d4abab --- /dev/null +++ b/src/doc/algorithm/rotsprite.h @@ -0,0 +1,23 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_ALGORITHM_ROTSPRITE_H_INCLUDED +#define DOC_ALGORITHM_ROTSPRITE_H_INCLUDED +#pragma once + +namespace doc { + class Image; + + namespace algorithm { + + void rotsprite_image(Image* bmp, Image* spr, + int x1, int y1, int x2, int y2, + int x3, int y3, int x4, int y4); + + } // namespace algorithm +} // namespace doc + +#endif diff --git a/src/raster/algorithm/shrink_bounds.cpp b/src/doc/algorithm/shrink_bounds.cpp similarity index 69% rename from src/raster/algorithm/shrink_bounds.cpp rename to src/doc/algorithm/shrink_bounds.cpp index b0e4d77da..2e8d2d43a 100644 --- a/src/raster/algorithm/shrink_bounds.cpp +++ b/src/doc/algorithm/shrink_bounds.cpp @@ -1,30 +1,18 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/algorithm/shrink_bounds.h" +#include "doc/algorithm/shrink_bounds.h" -#include "raster/image.h" +#include "doc/image.h" -namespace raster { +namespace doc { namespace algorithm { static bool is_same_pixel(PixelFormat pixelFormat, color_t pixel1, color_t pixel2) @@ -111,4 +99,4 @@ bool shrink_bounds(Image *image, gfx::Rect& bounds, color_t refpixel) } } // namespace algorithm -} // namespace raster +} // namespace doc diff --git a/src/doc/algorithm/shrink_bounds.h b/src/doc/algorithm/shrink_bounds.h new file mode 100644 index 000000000..f75c1b2b8 --- /dev/null +++ b/src/doc/algorithm/shrink_bounds.h @@ -0,0 +1,25 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_ALGORITHM_SHRINK_BOUNDS_H_INCLUDED +#define DOC_ALGORITHM_SHRINK_BOUNDS_H_INCLUDED +#pragma once + +#include "gfx/fwd.h" +#include "doc/algorithm/flip_type.h" +#include "doc/color.h" + +namespace doc { + class Image; + + namespace algorithm { + + bool shrink_bounds(Image* image, gfx::Rect& bounds, color_t refpixel); + + } // algorithm +} // doc + +#endif diff --git a/src/raster/blend.cpp b/src/doc/blend.cpp similarity index 87% rename from src/raster/blend.cpp rename to src/doc/blend.cpp index 2399bab6d..7715e7ff7 100644 --- a/src/raster/blend.cpp +++ b/src/doc/blend.cpp @@ -1,29 +1,17 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/blend.h" -#include "raster/image.h" +#include "doc/blend.h" +#include "doc/image.h" -namespace raster { +namespace doc { BLEND_COLOR rgba_blenders[] = { @@ -314,4 +302,4 @@ int graya_blend_blackandwhite(int back, int front, int opacity) return graya(D_k, 255); } -} // namespace raster +} // namespace doc diff --git a/src/raster/blend.h b/src/doc/blend.h similarity index 57% rename from src/raster/blend.h rename to src/doc/blend.h index 83aa45944..6ab30f166 100644 --- a/src/raster/blend.h +++ b/src/doc/blend.h @@ -1,29 +1,17 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_BLEND_H_INCLUDED -#define RASTER_BLEND_H_INCLUDED +#ifndef DOC_BLEND_H_INCLUDED +#define DOC_BLEND_H_INCLUDED #pragma once #define INT_MULT(a, b, t) \ ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8)) -namespace raster { +namespace doc { enum { BLEND_MODE_NORMAL, @@ -54,6 +42,6 @@ namespace raster { int graya_blend_merge(int back, int front, int opacity); int graya_blend_blackandwhite(int back, int front, int opacity); -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/brush.cpp b/src/doc/brush.cpp similarity index 76% rename from src/raster/brush.cpp rename to src/doc/brush.cpp index e8f8f5aed..0565a6dee 100644 --- a/src/raster/brush.cpp +++ b/src/doc/brush.cpp @@ -1,34 +1,23 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/brush.h" +#include "doc/brush.h" -#include "raster/algo.h" -#include "raster/image.h" -#include "raster/primitives.h" +#include "doc/algo.h" +#include "doc/algorithm/polygon.h" +#include "doc/image.h" +#include "doc/primitives.h" #include -namespace raster { +namespace doc { Brush::Brush() { @@ -142,7 +131,7 @@ void Brush::regenerate() int y4 = y3 - d*sin(a+PI); int points[8] = { x1, y1, x2, y2, x3, y3, x4, y4 }; - algo_polygon(4, points, m_image, algo_hline); + doc::algorithm::polygon(4, points, m_image, algo_hline); } break; @@ -185,4 +174,4 @@ void Brush::regenerate() m_image->width(), m_image->height()); } -} // namespace raster +} // namespace doc diff --git a/src/raster/brush.h b/src/doc/brush.h similarity index 53% rename from src/raster/brush.h rename to src/doc/brush.h index 78e79df82..a9f3c91e3 100644 --- a/src/raster/brush.h +++ b/src/doc/brush.h @@ -1,31 +1,19 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_BRUSH_H_INCLUDED -#define RASTER_BRUSH_H_INCLUDED +#ifndef DOC_BRUSH_H_INCLUDED +#define DOC_BRUSH_H_INCLUDED #pragma once #include "gfx/point.h" #include "gfx/rect.h" -#include "raster/brush_type.h" +#include "doc/brush_type.h" #include -namespace raster { +namespace doc { class Image; @@ -64,6 +52,6 @@ namespace raster { gfx::Rect m_bounds; }; -} // namespace raster +} // namespace doc #endif diff --git a/src/doc/brush_type.h b/src/doc/brush_type.h new file mode 100644 index 000000000..e4986fe6b --- /dev/null +++ b/src/doc/brush_type.h @@ -0,0 +1,24 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_BRUSH_TYPE_H_INCLUDED +#define DOC_BRUSH_TYPE_H_INCLUDED +#pragma once + +namespace doc { + + enum BrushType { + kCircleBrushType = 0, + kSquareBrushType = 1, + kLineBrushType = 2, + + kFirstBrushType = kCircleBrushType, + kLastBrushType = kLineBrushType, + }; + +} // namespace doc + +#endif diff --git a/src/raster/cel.cpp b/src/doc/cel.cpp similarity index 55% rename from src/raster/cel.cpp rename to src/doc/cel.cpp index d418ed7b0..469010d73 100644 --- a/src/raster/cel.cpp +++ b/src/doc/cel.cpp @@ -1,37 +1,25 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/cel.h" +#include "doc/cel.h" #include "gfx/rect.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/sprite.h" +#include "doc/stock.h" -namespace raster { +namespace doc { Cel::Cel(FrameNumber frame, int image) - : Object(OBJECT_CEL) + : Object(ObjectType::Cel) , m_layer(NULL) , m_frame(frame) , m_image(image) @@ -97,4 +85,4 @@ gfx::Rect Cel::bounds() const return gfx::Rect(); } -} // namespace raster +} // namespace doc diff --git a/src/raster/cel.h b/src/doc/cel.h similarity index 59% rename from src/raster/cel.h rename to src/doc/cel.h index 1594cb1df..1d57e9096 100644 --- a/src/raster/cel.h +++ b/src/doc/cel.h @@ -1,30 +1,18 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_CEL_H_INCLUDED -#define RASTER_CEL_H_INCLUDED +#ifndef DOC_CEL_H_INCLUDED +#define DOC_CEL_H_INCLUDED #pragma once #include "gfx/fwd.h" -#include "raster/frame_number.h" -#include "raster/object.h" +#include "doc/frame_number.h" +#include "doc/object.h" -namespace raster { +namespace doc { class Image; class LayerImage; @@ -71,6 +59,6 @@ namespace raster { int m_opacity; // Opacity level }; -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/cel_io.cpp b/src/doc/cel_io.cpp similarity index 56% rename from src/raster/cel_io.cpp rename to src/doc/cel_io.cpp index c9de749d1..eae45776a 100644 --- a/src/raster/cel_io.cpp +++ b/src/doc/cel_io.cpp @@ -1,34 +1,22 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/cel_io.h" +#include "doc/cel_io.h" #include "base/serialization.h" #include "base/unique_ptr.h" -#include "raster/cel.h" +#include "doc/cel.h" #include -namespace raster { +namespace doc { using namespace base::serialization; using namespace base::serialization::little_endian; diff --git a/src/doc/cel_io.h b/src/doc/cel_io.h new file mode 100644 index 000000000..46a9757d6 --- /dev/null +++ b/src/doc/cel_io.h @@ -0,0 +1,22 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_CEL_IO_H_INCLUDED +#define DOC_CEL_IO_H_INCLUDED +#pragma once + +#include + +namespace doc { + + class Cel; + + void write_cel(std::ostream& os, Cel* cel); + Cel* read_cel(std::istream& is); + +} // namespace doc + +#endif diff --git a/src/doc/cel_list.h b/src/doc/cel_list.h new file mode 100644 index 000000000..174e3967c --- /dev/null +++ b/src/doc/cel_list.h @@ -0,0 +1,23 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_CEL_LIST_H_INCLUDED +#define DOC_CEL_LIST_H_INCLUDED +#pragma once + +#include + +namespace doc { + + class Cel; + + typedef std::list CelList; + typedef std::list::iterator CelIterator; + typedef std::list::const_iterator CelConstIterator; + +} // namespace doc + +#endif // DOC_CEL_LIST_H_INCLUDED diff --git a/src/raster/color.h b/src/doc/color.h similarity index 67% rename from src/raster/color.h rename to src/doc/color.h index 0200827c5..ae3feac72 100644 --- a/src/raster/color.h +++ b/src/doc/color.h @@ -1,26 +1,14 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_COLOR_H_INCLUDED -#define RASTER_COLOR_H_INCLUDED +#ifndef DOC_COLOR_H_INCLUDED +#define DOC_COLOR_H_INCLUDED #pragma once -namespace raster { +namespace doc { // The greatest int type to storage a color for an image in the // available pixel formats. @@ -93,6 +81,6 @@ namespace raster { return graya(v, 255); } -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/color_histogram.h b/src/doc/color_histogram.h similarity index 79% rename from src/raster/color_histogram.h rename to src/doc/color_histogram.h index c1e8a15f6..8c3fb409f 100644 --- a/src/raster/color_histogram.h +++ b/src/doc/color_histogram.h @@ -1,34 +1,22 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_COLOR_HISTOGRAM_H_INCLUDED -#define RASTER_COLOR_HISTOGRAM_H_INCLUDED +#ifndef DOC_COLOR_HISTOGRAM_H_INCLUDED +#define DOC_COLOR_HISTOGRAM_H_INCLUDED #pragma once #include #include -#include "raster/image.h" -#include "raster/image_traits.h" -#include "raster/median_cut.h" -#include "raster/palette.h" +#include "doc/image.h" +#include "doc/image_traits.h" +#include "doc/median_cut.h" +#include "doc/palette.h" -namespace raster { +namespace doc { namespace quantization { template // Number of bits for each component in the histogram @@ -141,6 +129,6 @@ namespace quantization { }; } // namespace quantization -} // namespace raster +} // namespace doc #endif diff --git a/src/doc/color_mode.h b/src/doc/color_mode.h index fa64f0691..f9675159a 100644 --- a/src/doc/color_mode.h +++ b/src/doc/color_mode.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/raster/color_scales.cpp b/src/doc/color_scales.cpp similarity index 54% rename from src/raster/color_scales.cpp rename to src/doc/color_scales.cpp index 39cd3a7e0..5a5039b5c 100644 --- a/src/raster/color_scales.cpp +++ b/src/doc/color_scales.cpp @@ -1,20 +1,8 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" @@ -24,7 +12,7 @@ // Based on Allegro _rgb_scale_5 and _rgb_scale_6 tables -namespace raster { +namespace doc { int scale_5bits_to_8bits(int channel5bits) { @@ -57,4 +45,4 @@ int scale_6bits_to_8bits(int channel6bits) return scale[channel6bits]; } -} // namespace raster +} // namespace doc diff --git a/src/doc/color_scales.h b/src/doc/color_scales.h new file mode 100644 index 000000000..d6b2f687b --- /dev/null +++ b/src/doc/color_scales.h @@ -0,0 +1,23 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_COLOR_SCALES_H_INCLUDED +#define DOC_COLOR_SCALES_H_INCLUDED +#pragma once + +#include "doc/frame_number.h" +#include "doc/object.h" + +#include + +namespace doc { + + int scale_5bits_to_8bits(int channel5bits); + int scale_6bits_to_8bits(int channel6bits); + +} // namespace doc + +#endif diff --git a/src/doc/context.cpp b/src/doc/context.cpp index dbaa941de..24a853225 100644 --- a/src/doc/context.cpp +++ b/src/doc/context.cpp @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/doc/context.h b/src/doc/context.h index 0bcca348c..9ffaf9e87 100644 --- a/src/doc/context.h +++ b/src/doc/context.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/doc/context_observer.h b/src/doc/context_observer.h index d53ab9248..2715c9196 100644 --- a/src/doc/context_observer.h +++ b/src/doc/context_observer.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/doc/context_tests.cpp b/src/doc/context_tests.cpp index 790a8660f..826339eee 100644 --- a/src/doc/context_tests.cpp +++ b/src/doc/context_tests.cpp @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/raster/conversion_she.cpp b/src/doc/conversion_she.cpp similarity index 84% rename from src/raster/conversion_she.cpp rename to src/doc/conversion_she.cpp index 3b95b28a3..7a6376161 100644 --- a/src/raster/conversion_she.cpp +++ b/src/doc/conversion_she.cpp @@ -1,41 +1,29 @@ -/* Aseprite - * Copyright (C) 2001-2014 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/conversion_she.h" +#include "doc/conversion_she.h" -#include "raster/algo.h" -#include "raster/blend.h" -#include "raster/color_scales.h" -#include "raster/image.h" -#include "raster/image_impl.h" -#include "raster/palette.h" -#include "raster/rgbmap.h" +#include "doc/algo.h" +#include "doc/blend.h" +#include "doc/color_scales.h" +#include "doc/image.h" +#include "doc/image_impl.h" +#include "doc/palette.h" +#include "doc/rgbmap.h" #include "she/surface.h" #include "she/surface_format.h" #include "she/scoped_surface_lock.h" #include -namespace raster { +namespace doc { namespace { @@ -196,4 +184,4 @@ void convert_image_to_surface(const Image* image, const Palette* palette, } } -} // namespace raster +} // namespace doc diff --git a/src/doc/conversion_she.h b/src/doc/conversion_she.h new file mode 100644 index 000000000..11608a94c --- /dev/null +++ b/src/doc/conversion_she.h @@ -0,0 +1,25 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_CONVERSION_SHE_H_INCLUDED +#define DOC_CONVERSION_SHE_H_INCLUDED +#pragma once + +namespace she { + class Surface; +} + +namespace doc { + class Image; + class Palette; + + void convert_image_to_surface(const Image* image, const Palette* palette, + she::Surface* surface, + int src_x, int src_y, int dst_x, int dst_y, int w, int h); + +} // namespace doc + +#endif diff --git a/src/raster/dirty.cpp b/src/doc/dirty.cpp similarity index 81% rename from src/raster/dirty.cpp rename to src/doc/dirty.cpp index 3596f5ac3..8a8c7f803 100644 --- a/src/raster/dirty.cpp +++ b/src/doc/dirty.cpp @@ -1,34 +1,22 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/dirty.h" +#include "doc/dirty.h" -#include "raster/image.h" -#include "raster/primitives.h" -#include "raster/primitives_fast.h" +#include "doc/image.h" +#include "doc/primitives.h" +#include "doc/primitives_fast.h" #include -namespace raster { +namespace doc { Dirty::Dirty(PixelFormat format, int x1, int y1, int x2, int y2) : m_format(format) @@ -194,4 +182,4 @@ void Dirty::swapImagePixels(Image* image) } } -} // namespace raster +} // namespace doc diff --git a/src/raster/dirty.h b/src/doc/dirty.h similarity index 65% rename from src/raster/dirty.h rename to src/doc/dirty.h index 23e6194f7..67e974005 100644 --- a/src/raster/dirty.h +++ b/src/doc/dirty.h @@ -1,33 +1,21 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_DIRTY_H_INCLUDED -#define RASTER_DIRTY_H_INCLUDED +#ifndef DOC_DIRTY_H_INCLUDED +#define DOC_DIRTY_H_INCLUDED #pragma once -#include "raster/image.h" +#include "doc/image.h" #include #define DIRTY_VALID_COLUMN 1 #define DIRTY_MUSTBE_UPDATED 2 -namespace raster { +namespace doc { class Pen; class Image; @@ -97,6 +85,6 @@ public: }; -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/dirty_io.cpp b/src/doc/dirty_io.cpp similarity index 72% rename from src/raster/dirty_io.cpp rename to src/doc/dirty_io.cpp index 63608e3de..7b82d4f92 100644 --- a/src/raster/dirty_io.cpp +++ b/src/doc/dirty_io.cpp @@ -1,34 +1,22 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/dirty_io.h" +#include "doc/dirty_io.h" #include "base/serialization.h" #include "base/unique_ptr.h" -#include "raster/dirty.h" +#include "doc/dirty.h" #include -namespace raster { +namespace doc { using namespace base::serialization; using namespace base::serialization::little_endian; diff --git a/src/doc/dirty_io.h b/src/doc/dirty_io.h new file mode 100644 index 000000000..68a5b28d6 --- /dev/null +++ b/src/doc/dirty_io.h @@ -0,0 +1,22 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_DIRTY_IO_H_INCLUDED +#define DOC_DIRTY_IO_H_INCLUDED +#pragma once + +#include + +namespace doc { + + class Dirty; + + void write_dirty(std::ostream& os, Dirty* dirty); + Dirty* read_dirty(std::istream& is); + +} // namespace doc + +#endif diff --git a/src/doc/dithering_method.h b/src/doc/dithering_method.h new file mode 100644 index 000000000..8438504ef --- /dev/null +++ b/src/doc/dithering_method.h @@ -0,0 +1,21 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_DITHERING_METHOD_H_INCLUDED +#define DOC_DITHERING_METHOD_H_INCLUDED +#pragma once + +namespace doc { + + // Dithering methods + enum DitheringMethod { + DITHERING_NONE, + DITHERING_ORDERED, + }; + +} // namespace doc + +#endif diff --git a/src/doc/doc.h b/src/doc/doc.h new file mode 100644 index 000000000..a4bce4f80 --- /dev/null +++ b/src/doc/doc.h @@ -0,0 +1,33 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_DOC_H_INCLUDED +#define DOC_DOC_H_INCLUDED +#pragma once + +#include "doc/blend.h" +#include "doc/brush.h" +#include "doc/cel.h" +#include "doc/color.h" +#include "doc/color_scales.h" +#include "doc/dirty.h" +#include "doc/document.h" +#include "doc/frame_number.h" +#include "doc/image.h" +#include "doc/image_bits.h" +#include "doc/layer.h" +#include "doc/mask.h" +#include "doc/object.h" +#include "doc/palette.h" +#include "doc/pixel_format.h" +#include "doc/primitives.h" +#include "doc/primitives_fast.h" +#include "doc/quantization.h" +#include "doc/rgbmap.h" +#include "doc/sprite.h" +#include "doc/stock.h" + +#endif diff --git a/src/doc/document.cpp b/src/doc/document.cpp index 318cf853b..bfe505041 100644 --- a/src/doc/document.cpp +++ b/src/doc/document.cpp @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. @@ -18,7 +18,8 @@ namespace doc { Document::Document() - : m_sprites(this) + : Object(ObjectType::Document) + , m_sprites(this) , m_ctx(NULL) { } diff --git a/src/doc/document.h b/src/doc/document.h index 804e2d2c9..1b3ebd20e 100644 --- a/src/doc/document.h +++ b/src/doc/document.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/doc/document_event.h b/src/doc/document_event.h index 98b4ac702..5d8f3b8b9 100644 --- a/src/doc/document_event.h +++ b/src/doc/document_event.h @@ -9,9 +9,9 @@ #pragma once #include "gfx/region.h" -#include "raster/frame_number.h" +#include "doc/frame_number.h" -namespace raster { +namespace doc { class Cel; class Image; class Layer; @@ -22,7 +22,7 @@ namespace raster { namespace doc { class Document; - using namespace raster; + using namespace doc; class DocumentEvent { public: diff --git a/src/doc/documents.cpp b/src/doc/documents.cpp index 466748e90..991bbe8aa 100644 --- a/src/doc/documents.cpp +++ b/src/doc/documents.cpp @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/doc/documents.h b/src/doc/documents.h index 248f8cd77..eb7616973 100644 --- a/src/doc/documents.h +++ b/src/doc/documents.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/doc/documents_observer.h b/src/doc/documents_observer.h index 14ad15282..92593af0e 100644 --- a/src/doc/documents_observer.h +++ b/src/doc/documents_observer.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/doc/export_data.h b/src/doc/export_data.h index ff6727aa7..7f478f508 100644 --- a/src/doc/export_data.h +++ b/src/doc/export_data.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/raster/file/col_file.cpp b/src/doc/file/col_file.cpp similarity index 73% rename from src/raster/file/col_file.cpp rename to src/doc/file/col_file.cpp index e8d383ab8..b609ca1bd 100644 --- a/src/raster/file/col_file.cpp +++ b/src/doc/file/col_file.cpp @@ -1,20 +1,8 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" @@ -22,15 +10,15 @@ #include "base/cfile.h" #include "base/clamp.h" -#include "raster/color_scales.h" -#include "raster/image.h" -#include "raster/palette.h" +#include "doc/color_scales.h" +#include "doc/image.h" +#include "doc/palette.h" #include #define PROCOL_MAGIC_NUMBER 0xB123 -namespace raster { +namespace doc { namespace file { using namespace base; @@ -134,4 +122,4 @@ bool save_col_file(const Palette* pal, const char* filename) } } // namespace file -} // namespace raster +} // namespace doc diff --git a/src/doc/file/col_file.h b/src/doc/file/col_file.h new file mode 100644 index 000000000..1fc6d5dd6 --- /dev/null +++ b/src/doc/file/col_file.h @@ -0,0 +1,24 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_FILE_COL_FILE_H_INCLUDED +#define DOC_FILE_COL_FILE_H_INCLUDED +#pragma once + +namespace doc { + + class Palette; + + namespace file { + + Palette* load_col_file(const char* filename); + bool save_col_file(const Palette* pal, const char* filename); + + } // namespace file + +} // namespace doc + +#endif diff --git a/src/raster/file/gpl_file.cpp b/src/doc/file/gpl_file.cpp similarity index 68% rename from src/raster/file/gpl_file.cpp rename to src/doc/file/gpl_file.cpp index 7166959f7..a7a2ae779 100644 --- a/src/raster/file/gpl_file.cpp +++ b/src/doc/file/gpl_file.cpp @@ -1,20 +1,8 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" @@ -23,8 +11,8 @@ #include "base/split_string.h" #include "base/trim_string.h" #include "base/unique_ptr.h" -#include "raster/image.h" -#include "raster/palette.h" +#include "doc/image.h" +#include "doc/palette.h" #include #include @@ -32,7 +20,7 @@ #include #include -namespace raster { +namespace doc { namespace file { Palette* load_gpl_file(const char *filename) @@ -97,4 +85,4 @@ bool save_gpl_file(const Palette *pal, const char *filename) } } // namespace file -} // namespace raster +} // namespace doc diff --git a/src/doc/file/gpl_file.h b/src/doc/file/gpl_file.h new file mode 100644 index 000000000..db759ff63 --- /dev/null +++ b/src/doc/file/gpl_file.h @@ -0,0 +1,23 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_FILE_GPL_FILE_H_INCLUDED +#define DOC_FILE_GPL_FILE_H_INCLUDED +#pragma once + +namespace doc { + + class Palette; + + namespace file { + + Palette* load_gpl_file(const char* filename); + bool save_gpl_file(const Palette* pal, const char* filename); + + } // namespace file +} // namespace doc + +#endif diff --git a/src/raster/frame_number.h b/src/doc/frame_number.h similarity index 65% rename from src/raster/frame_number.h rename to src/doc/frame_number.h index d8d0e1916..886a99601 100644 --- a/src/raster/frame_number.h +++ b/src/doc/frame_number.h @@ -1,26 +1,14 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_FRAME_NUMBER_H_INCLUDED -#define RASTER_FRAME_NUMBER_H_INCLUDED +#ifndef DOC_FRAME_NUMBER_H_INCLUDED +#define DOC_FRAME_NUMBER_H_INCLUDED #pragma once -namespace raster { +namespace doc { class FrameNumber { public: @@ -59,6 +47,6 @@ namespace raster { return FrameNumber((int)x - (int)y); } -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/image.cpp b/src/doc/image.cpp similarity index 53% rename from src/raster/image.cpp rename to src/doc/image.cpp index 459ed6c4d..45e3bce9c 100644 --- a/src/raster/image.cpp +++ b/src/doc/image.cpp @@ -1,39 +1,27 @@ -/* Aseprite - * Copyright (C) 2001-2014 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/image.h" +#include "doc/image.h" -#include "raster/algo.h" -#include "raster/blend.h" -#include "raster/brush.h" -#include "raster/image_impl.h" -#include "raster/palette.h" -#include "raster/primitives.h" -#include "raster/rgbmap.h" +#include "doc/algo.h" +#include "doc/blend.h" +#include "doc/brush.h" +#include "doc/image_impl.h" +#include "doc/palette.h" +#include "doc/primitives.h" +#include "doc/rgbmap.h" -namespace raster { +namespace doc { Image::Image(PixelFormat format, int width, int height) - : Object(OBJECT_IMAGE) + : Object(ObjectType::Image) , m_format(format) { m_width = width; @@ -81,4 +69,4 @@ Image* Image::createCopy(const Image* image, const ImageBufferPtr& buffer) image->maskColor(), buffer); } -} // namespace raster +} // namespace doc diff --git a/src/raster/image.h b/src/doc/image.h similarity index 73% rename from src/raster/image.h rename to src/doc/image.h index 3a48870f8..91f75a77a 100644 --- a/src/raster/image.h +++ b/src/doc/image.h @@ -1,34 +1,22 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_IMAGE_H_INCLUDED -#define RASTER_IMAGE_H_INCLUDED +#ifndef DOC_IMAGE_H_INCLUDED +#define DOC_IMAGE_H_INCLUDED #pragma once #include "gfx/rect.h" #include "gfx/size.h" -#include "raster/blend.h" -#include "raster/color.h" -#include "raster/image_buffer.h" -#include "raster/object.h" -#include "raster/pixel_format.h" +#include "doc/blend.h" +#include "doc/color.h" +#include "doc/image_buffer.h" +#include "doc/object.h" +#include "doc/pixel_format.h" -namespace raster { +namespace doc { template class ImageBits; class Palette; @@ -78,7 +66,7 @@ namespace raster { } // Warning: These functions doesn't have (and shouldn't have) - // bounds checks. Use the primitives defined in raster/primitives.h + // bounds checks. Use the primitives defined in doc/primitives.h // in case that you need bounds check. virtual uint8_t* getPixelAddress(int x, int y) const = 0; virtual color_t getPixel(int x, int y) const = 0; @@ -100,13 +88,13 @@ namespace raster { color_t m_maskColor; // Skipped color in merge process. }; -} // namespace raster +} // namespace doc // It's here because it needs a complete definition of Image class, // and then ImageTraits are used in the next functions below. -#include "raster/image_traits.h" +#include "doc/image_traits.h" -namespace raster { +namespace doc { inline int calculate_rowstride_bytes(PixelFormat pixelFormat, int pixels_per_row) { @@ -119,6 +107,6 @@ namespace raster { return 0; } -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/image_bits.h b/src/doc/image_bits.h similarity index 81% rename from src/raster/image_bits.h rename to src/doc/image_bits.h index 57f54650e..01c795210 100644 --- a/src/raster/image_bits.h +++ b/src/doc/image_bits.h @@ -1,29 +1,17 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_IMAGE_BITS_H_INCLUDED -#define RASTER_IMAGE_BITS_H_INCLUDED +#ifndef DOC_IMAGE_BITS_H_INCLUDED +#define DOC_IMAGE_BITS_H_INCLUDED #pragma once -#include "raster/image.h" -#include "raster/image_iterator.h" +#include "doc/image.h" +#include "doc/image_iterator.h" -namespace raster { +namespace doc { template class ImageBits { @@ -163,6 +151,6 @@ namespace raster { LockImageBits(); // Undefined }; -} // namespace raster +} // namespace doc #endif diff --git a/src/doc/image_buffer.h b/src/doc/image_buffer.h new file mode 100644 index 000000000..2191a9a54 --- /dev/null +++ b/src/doc/image_buffer.h @@ -0,0 +1,38 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_IMAGE_BUFFER_H_INCLUDED +#define DOC_IMAGE_BUFFER_H_INCLUDED +#pragma once + +#include "base/shared_ptr.h" + +#include + +namespace doc { + + class ImageBuffer { + public: + ImageBuffer(size_t size) : m_buffer(size) { + } + + size_t size() const { return m_buffer.size(); } + uint8_t* buffer() { return &m_buffer[0]; } + + void resizeIfNecessary(size_t size) { + if (size > m_buffer.size()) + m_buffer.resize(size); + } + + private: + std::vector m_buffer; + }; + + typedef SharedPtr ImageBufferPtr; + +} // namespace doc + +#endif diff --git a/src/raster/image_impl.h b/src/doc/image_impl.h similarity index 91% rename from src/raster/image_impl.h rename to src/doc/image_impl.h index d02e3fc72..808bc8c91 100644 --- a/src/raster/image_impl.h +++ b/src/doc/image_impl.h @@ -1,32 +1,20 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_IMAGE_IMPL_H_INCLUDED -#define RASTER_IMAGE_IMPL_H_INCLUDED +#ifndef DOC_IMAGE_IMPL_H_INCLUDED +#define DOC_IMAGE_IMPL_H_INCLUDED #pragma once -#include "raster/blend.h" -#include "raster/image.h" -#include "raster/image_bits.h" -#include "raster/image_iterator.h" -#include "raster/palette.h" +#include "doc/blend.h" +#include "doc/image.h" +#include "doc/image_bits.h" +#include "doc/image_iterator.h" +#include "doc/palette.h" -namespace raster { +namespace doc { template class ImageImpl : public Image { @@ -472,6 +460,6 @@ namespace raster { } } -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/image_io.cpp b/src/doc/image_io.cpp similarity index 64% rename from src/raster/image_io.cpp rename to src/doc/image_io.cpp index 65847b72b..f832a6892 100644 --- a/src/raster/image_io.cpp +++ b/src/doc/image_io.cpp @@ -1,34 +1,22 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/image_io.h" +#include "doc/image_io.h" #include "base/serialization.h" #include "base/unique_ptr.h" -#include "raster/image.h" +#include "doc/image.h" #include -namespace raster { +namespace doc { using namespace base::serialization; using namespace base::serialization::little_endian; diff --git a/src/doc/image_io.h b/src/doc/image_io.h new file mode 100644 index 000000000..36bd2083c --- /dev/null +++ b/src/doc/image_io.h @@ -0,0 +1,22 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_IMAGE_IO_H_INCLUDED +#define DOC_IMAGE_IO_H_INCLUDED +#pragma once + +#include + +namespace doc { + + class Image; + + void write_image(std::ostream& os, Image* image); + Image* read_image(std::istream& is); + +} // namespace doc + +#endif diff --git a/src/raster/image_iterator.h b/src/doc/image_iterator.h similarity index 91% rename from src/raster/image_iterator.h rename to src/doc/image_iterator.h index a2ac4f478..b525dd80f 100644 --- a/src/raster/image_iterator.h +++ b/src/doc/image_iterator.h @@ -1,37 +1,25 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_IMAGE_ITERATOR_H_INCLUDED -#define RASTER_IMAGE_ITERATOR_H_INCLUDED +#ifndef DOC_IMAGE_ITERATOR_H_INCLUDED +#define DOC_IMAGE_ITERATOR_H_INCLUDED #pragma once #include "gfx/point.h" #include "gfx/rect.h" -#include "raster/color.h" -#include "raster/image.h" -#include "raster/image_traits.h" +#include "doc/color.h" +#include "doc/image.h" +#include "doc/image_traits.h" #include #include #include -namespace raster { +namespace doc { template #include "base/unique_ptr.h" -#include "raster/image.h" -#include "raster/image_bits.h" -#include "raster/primitives.h" +#include "doc/image.h" +#include "doc/image_bits.h" +#include "doc/primitives.h" using namespace base; -using namespace raster; +using namespace doc; template class ImageAllTypes : public testing::Test { diff --git a/src/raster/image_traits.h b/src/doc/image_traits.h similarity index 73% rename from src/raster/image_traits.h rename to src/doc/image_traits.h index c8af60c7c..6a12896f1 100644 --- a/src/raster/image_traits.h +++ b/src/doc/image_traits.h @@ -1,28 +1,16 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_IMAGE_TRAITS_H_INCLUDED -#define RASTER_IMAGE_TRAITS_H_INCLUDED +#ifndef DOC_IMAGE_TRAITS_H_INCLUDED +#define DOC_IMAGE_TRAITS_H_INCLUDED #pragma once -#include "raster/pixel_format.h" +#include "doc/pixel_format.h" -namespace raster { +namespace doc { struct RgbTraits { static const PixelFormat pixel_format = IMAGE_RGB; @@ -132,6 +120,6 @@ namespace raster { } }; -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/images_collector.cpp b/src/doc/images_collector.cpp similarity index 56% rename from src/raster/images_collector.cpp rename to src/doc/images_collector.cpp index 85daa208c..96192ea94 100644 --- a/src/raster/images_collector.cpp +++ b/src/doc/images_collector.cpp @@ -1,34 +1,22 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/images_collector.h" -#include "raster/layer.h" -#include "raster/mask.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/image.h" +#include "doc/images_collector.h" +#include "doc/layer.h" +#include "doc/mask.h" +#include "doc/sprite.h" +#include "doc/stock.h" -namespace raster { +namespace doc { ImagesCollector::ImagesCollector(Layer* layer, FrameNumber frame, @@ -52,7 +40,7 @@ void ImagesCollector::collectFromLayer(Layer* layer, FrameNumber frame) switch (layer->type()) { - case OBJECT_LAYER_IMAGE: { + case ObjectType::LayerImage: { if (m_allFrames) { for (FrameNumber frame(0); frametotalFrames(); ++frame) { Cel* cel = static_cast(layer)->getCel(frame); @@ -68,7 +56,7 @@ void ImagesCollector::collectFromLayer(Layer* layer, FrameNumber frame) break; } - case OBJECT_LAYER_FOLDER: { + case ObjectType::LayerFolder: { LayerIterator it = static_cast(layer)->getLayerBegin(); LayerIterator end = static_cast(layer)->getLayerEnd(); @@ -86,4 +74,4 @@ void ImagesCollector::collectImage(Layer* layer, Cel* cel) m_items.push_back(Item(layer, cel, cel->image())); } -} // namespace raster +} // namespace doc diff --git a/src/raster/images_collector.h b/src/doc/images_collector.h similarity index 63% rename from src/raster/images_collector.h rename to src/doc/images_collector.h index 5bdc49bef..a945eff4c 100644 --- a/src/raster/images_collector.h +++ b/src/doc/images_collector.h @@ -1,30 +1,18 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_IMAGES_REF_H_INCLUDED -#define RASTER_IMAGES_REF_H_INCLUDED +#ifndef DOC_IMAGES_REF_H_INCLUDED +#define DOC_IMAGES_REF_H_INCLUDED #pragma once -#include "raster/frame_number.h" +#include "doc/frame_number.h" #include -namespace raster { +namespace doc { class Sprite; class Image; @@ -81,6 +69,6 @@ namespace raster { bool m_forWrite; }; -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/layer.cpp b/src/doc/layer.cpp similarity index 83% rename from src/raster/layer.cpp rename to src/doc/layer.cpp index 10500abd1..1bd6d0189 100644 --- a/src/raster/layer.cpp +++ b/src/doc/layer.cpp @@ -1,43 +1,31 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/layer.h" +#include "doc/layer.h" -#include "raster/blend.h" -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/primitives.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/blend.h" +#include "doc/cel.h" +#include "doc/image.h" +#include "doc/primitives.h" +#include "doc/sprite.h" +#include "doc/stock.h" #include #include -namespace raster { +namespace doc { Layer::Layer(ObjectType type, Sprite* sprite) : Object(type) { - ASSERT(type == OBJECT_LAYER_IMAGE || type == OBJECT_LAYER_FOLDER); + ASSERT(type == ObjectType::LayerImage || type == ObjectType::LayerFolder); setName("Layer"); @@ -93,7 +81,7 @@ Layer* Layer::getNext() const // LayerImage class LayerImage::LayerImage(Sprite* sprite) - : Layer(OBJECT_LAYER_IMAGE, sprite) + : Layer(ObjectType::LayerImage, sprite) { } @@ -233,7 +221,7 @@ void LayerImage::configureAsBackground() // LayerFolder class LayerFolder::LayerFolder(Sprite* sprite) - : Layer(OBJECT_LAYER_FOLDER, sprite) + : Layer(ObjectType::LayerFolder, sprite) { setName("Layer Set"); } @@ -320,7 +308,7 @@ void layer_render(const Layer* layer, Image* image, int x, int y, FrameNumber fr switch (layer->type()) { - case OBJECT_LAYER_IMAGE: { + case ObjectType::LayerImage: { const Cel* cel = static_cast(layer)->getCel(frame); Image* src_image; @@ -342,7 +330,7 @@ void layer_render(const Layer* layer, Image* image, int x, int y, FrameNumber fr break; } - case OBJECT_LAYER_FOLDER: { + case ObjectType::LayerFolder: { LayerConstIterator it = static_cast(layer)->getLayerBegin(); LayerConstIterator end = static_cast(layer)->getLayerEnd(); @@ -355,4 +343,4 @@ void layer_render(const Layer* layer, Image* image, int x, int y, FrameNumber fr } } -} // namespace raster +} // namespace doc diff --git a/src/raster/layer.h b/src/doc/layer.h similarity index 78% rename from src/raster/layer.h rename to src/doc/layer.h index 3caf81d73..e18f2c9d6 100644 --- a/src/raster/layer.h +++ b/src/doc/layer.h @@ -1,32 +1,22 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_LAYER_H_INCLUDED -#define RASTER_LAYER_H_INCLUDED +#ifndef DOC_LAYER_H_INCLUDED +#define DOC_LAYER_H_INCLUDED #pragma once -#include "raster/blend.h" -#include "raster/frame_number.h" -#include "raster/object.h" +#include "doc/blend.h" +#include "doc/cel_list.h" +#include "doc/frame_number.h" +#include "doc/layer_list.h" +#include "doc/object.h" #include -namespace raster { +namespace doc { class Cel; class Image; @@ -65,8 +55,8 @@ namespace raster { Layer* getPrevious() const; Layer* getNext() const; - bool isImage() const { return type() == OBJECT_LAYER_IMAGE; } - bool isFolder() const { return type() == OBJECT_LAYER_FOLDER; } + bool isImage() const { return type() == ObjectType::LayerImage; } + bool isFolder() const { return type() == ObjectType::LayerFolder; } bool isBackground() const { return (m_flags & LAYER_IS_BACKGROUND) == LAYER_IS_BACKGROUND; } bool isMoveable() const { return (m_flags & LAYER_IS_LOCKMOVE) == 0; } bool isReadable() const { return (m_flags & LAYER_IS_READABLE) == LAYER_IS_READABLE; } @@ -95,8 +85,7 @@ namespace raster { ////////////////////////////////////////////////////////////////////// // LayerImage class - class LayerImage : public Layer - { + class LayerImage : public Layer { public: explicit LayerImage(Sprite* sprite); virtual ~LayerImage(); @@ -130,8 +119,7 @@ namespace raster { ////////////////////////////////////////////////////////////////////// // LayerFolder class - class LayerFolder : public Layer - { + class LayerFolder : public Layer { public: explicit LayerFolder(Sprite* sprite); virtual ~LayerFolder(); @@ -162,6 +150,6 @@ namespace raster { void layer_render(const Layer* layer, Image *image, int x, int y, FrameNumber frame); -} // namespace raster +} // namespace doc #endif diff --git a/src/doc/layer_index.cpp b/src/doc/layer_index.cpp new file mode 100644 index 000000000..0b1bdb828 --- /dev/null +++ b/src/doc/layer_index.cpp @@ -0,0 +1,17 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "doc/layer_index.h" + +namespace doc { + +const LayerIndex LayerIndex::NoLayer(-1); + +} // namespace doc diff --git a/src/raster/layer_index.h b/src/doc/layer_index.h similarity index 65% rename from src/raster/layer_index.h rename to src/doc/layer_index.h index 2a039d32a..af3393c65 100644 --- a/src/raster/layer_index.h +++ b/src/doc/layer_index.h @@ -1,26 +1,14 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_LAYER_INDEX_H_INCLUDED -#define RASTER_LAYER_INDEX_H_INCLUDED +#ifndef DOC_LAYER_INDEX_H_INCLUDED +#define DOC_LAYER_INDEX_H_INCLUDED #pragma once -namespace raster { +namespace doc { class LayerIndex { public: @@ -61,6 +49,6 @@ namespace raster { return LayerIndex((int)x - (int)y); } -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/layer_io.cpp b/src/doc/layer_io.cpp similarity index 73% rename from src/raster/layer_io.cpp rename to src/doc/layer_io.cpp index 3260ecd74..487d9cefb 100644 --- a/src/raster/layer_io.cpp +++ b/src/doc/layer_io.cpp @@ -1,38 +1,26 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/layer_io.h" +#include "doc/layer_io.h" #include "base/serialization.h" #include "base/unique_ptr.h" -#include "raster/cel.h" -#include "raster/layer.h" -#include "raster/sprite.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/layer.h" +#include "doc/sprite.h" +#include "doc/stock.h" #include #include -namespace raster { +namespace doc { using namespace base::serialization; using namespace base::serialization::little_endian; @@ -48,11 +36,11 @@ void write_layer(std::ostream& os, LayerSubObjectsSerializer* subObjects, Layer* os.write(name.c_str(), name.size()); // Name write32(os, layer->getFlags()); // Flags - write16(os, layer->type()); // Type + write16(os, static_cast(layer->type())); // Type switch (layer->type()) { - case OBJECT_LAYER_IMAGE: { + case ObjectType::LayerImage: { // Number of cels write16(os, static_cast(layer)->getCelsCount()); @@ -71,7 +59,7 @@ void write_layer(std::ostream& os, LayerSubObjectsSerializer* subObjects, Layer* break; } - case OBJECT_LAYER_FOLDER: { + case ObjectType::LayerFolder: { LayerIterator it = static_cast(layer)->getLayerBegin(); LayerIterator end = static_cast(layer)->getLayerEnd(); @@ -104,7 +92,7 @@ Layer* read_layer(std::istream& is, LayerSubObjectsSerializer* subObjects, Sprit switch (layer_type) { - case OBJECT_LAYER_IMAGE: { + case ObjectType::LayerImage: { // Create layer layer.reset(new LayerImage(sprite)); @@ -125,7 +113,7 @@ Layer* read_layer(std::istream& is, LayerSubObjectsSerializer* subObjects, Sprit break; } - case OBJECT_LAYER_FOLDER: { + case ObjectType::LayerFolder: { // Create the layer set layer.reset(new LayerFolder(sprite)); diff --git a/src/raster/layer_io.h b/src/doc/layer_io.h similarity index 55% rename from src/raster/layer_io.h rename to src/doc/layer_io.h index 148bf841e..2d22f29ee 100644 --- a/src/raster/layer_io.h +++ b/src/doc/layer_io.h @@ -1,30 +1,18 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_LAYER_IO_H_INCLUDED -#define RASTER_LAYER_IO_H_INCLUDED +#ifndef DOC_LAYER_IO_H_INCLUDED +#define DOC_LAYER_IO_H_INCLUDED #pragma once #include "base/exception.h" #include -namespace raster { +namespace doc { class Cel; class Image; @@ -56,6 +44,6 @@ namespace raster { void write_layer(std::ostream& os, LayerSubObjectsSerializer* subObjects, Layer* layer); Layer* read_layer(std::istream& is, LayerSubObjectsSerializer* subObjects, Sprite* sprite); -} // namespace raster +} // namespace doc #endif diff --git a/src/doc/layer_list.h b/src/doc/layer_list.h new file mode 100644 index 000000000..941a4537e --- /dev/null +++ b/src/doc/layer_list.h @@ -0,0 +1,23 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_LAYER_LIST_H_INCLUDED +#define DOC_LAYER_LIST_H_INCLUDED +#pragma once + +#include + +namespace doc { + + class Layer; + + typedef std::list LayerList; + typedef std::list::iterator LayerIterator; + typedef std::list::const_iterator LayerConstIterator; + +} // namespace doc + +#endif // DOC_LAYER_LIST_H_INCLUDED diff --git a/src/raster/mask.cpp b/src/doc/mask.cpp similarity index 92% rename from src/raster/mask.cpp rename to src/doc/mask.cpp index b845df923..6ff52d14e 100644 --- a/src/raster/mask.cpp +++ b/src/doc/mask.cpp @@ -1,38 +1,26 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/mask.h" +#include "doc/mask.h" #include "base/memory.h" -#include "raster/image.h" -#include "raster/image_bits.h" +#include "doc/image.h" +#include "doc/image_bits.h" #include #include -namespace raster { +namespace doc { Mask::Mask() - : Object(OBJECT_MASK) + : Object(ObjectType::Mask) { initialize(); } @@ -45,7 +33,7 @@ Mask::Mask(const Mask& mask) } Mask::Mask(int x, int y, Image* bitmap) - : Object(OBJECT_MASK) + : Object(ObjectType::Mask) , m_freeze_count(0) , m_bounds(x, y, bitmap->width(), bitmap->height()) , m_bitmap(bitmap) @@ -489,4 +477,4 @@ void Mask::shrink() #undef SHRINK_SIDE } -} // namespace raster +} // namespace doc diff --git a/src/raster/mask.h b/src/doc/mask.h similarity index 75% rename from src/raster/mask.h rename to src/doc/mask.h index d6cd3da2b..f302401ef 100644 --- a/src/raster/mask.h +++ b/src/doc/mask.h @@ -1,33 +1,21 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_MASK_H_INCLUDED -#define RASTER_MASK_H_INCLUDED +#ifndef DOC_MASK_H_INCLUDED +#define DOC_MASK_H_INCLUDED #pragma once #include "gfx/rect.h" -#include "raster/image.h" -#include "raster/object.h" -#include "raster/primitives.h" +#include "doc/image.h" +#include "doc/object.h" +#include "doc/primitives.h" #include -namespace raster { +namespace doc { // Represents the selection (selected pixels, 0/1, 0=non-selected, 1=selected) class Mask : public Object { @@ -122,6 +110,6 @@ namespace raster { Image* m_bitmap; // Bitmapped image mask }; -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/mask_io.cpp b/src/doc/mask_io.cpp similarity index 63% rename from src/raster/mask_io.cpp rename to src/doc/mask_io.cpp index 86fecf153..d87fcadc0 100644 --- a/src/raster/mask_io.cpp +++ b/src/doc/mask_io.cpp @@ -1,34 +1,22 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/mask_io.h" +#include "doc/mask_io.h" #include "base/serialization.h" #include "base/unique_ptr.h" -#include "raster/mask.h" +#include "doc/mask.h" #include -namespace raster { +namespace doc { using namespace base::serialization; using namespace base::serialization::little_endian; diff --git a/src/doc/mask_io.h b/src/doc/mask_io.h new file mode 100644 index 000000000..1aee78f37 --- /dev/null +++ b/src/doc/mask_io.h @@ -0,0 +1,22 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_MASK_IO_H_INCLUDED +#define DOC_MASK_IO_H_INCLUDED +#pragma once + +#include + +namespace doc { + + class Mask; + + void write_mask(std::ostream& os, Mask* mask); + Mask* read_mask(std::istream& is); + +} // namespace doc + +#endif diff --git a/src/raster/median_cut.h b/src/doc/median_cut.h similarity index 92% rename from src/raster/median_cut.h rename to src/doc/median_cut.h index 11d13b2b1..35bc0bddc 100644 --- a/src/raster/median_cut.h +++ b/src/doc/median_cut.h @@ -1,29 +1,17 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_MEDIAN_CUT_H_INCLUDED -#define RASTER_MEDIAN_CUT_H_INCLUDED +#ifndef DOC_MEDIAN_CUT_H_INCLUDED +#define DOC_MEDIAN_CUT_H_INCLUDED #pragma once #include #include -namespace raster { +namespace doc { namespace quantization { template @@ -300,6 +288,6 @@ namespace quantization { } } // namespace quantization -} // namespace raster +} // namespace doc #endif diff --git a/src/doc/object.cpp b/src/doc/object.cpp index 43e140ef8..869507cc6 100644 --- a/src/doc/object.cpp +++ b/src/doc/object.cpp @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. @@ -14,8 +14,9 @@ namespace doc { static ObjectId newId = 0; -Object::Object() - : m_id(++newId) +Object::Object(ObjectType type) + : m_type(type) + , m_id(++newId) { } @@ -23,4 +24,9 @@ Object::~Object() { } +int Object::getMemSize() const +{ + return sizeof(Object); +} + } // namespace doc diff --git a/src/doc/object.h b/src/doc/object.h index 0b533a8d8..024585b36 100644 --- a/src/doc/object.h +++ b/src/doc/object.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. @@ -9,19 +9,27 @@ #pragma once #include "doc/object_id.h" +#include "doc/object_type.h" namespace doc { class Object { public: - Object(); + Object(ObjectType type); virtual ~Object(); + const ObjectType type() const { return m_type; } const ObjectId id() const { return m_id; } void setId(ObjectId id) { m_id = id; } + // Returns the approximate amount of memory (in bytes) which this + // object use. + virtual int getMemSize() const; + private: + ObjectType m_type; + // Unique identifier for this object (it is assigned by // Objects class). ObjectId m_id; diff --git a/src/doc/object_id.h b/src/doc/object_id.h index 5d7d76120..f2d3fbffd 100644 --- a/src/doc/object_id.h +++ b/src/doc/object_id.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/doc/object_type.h b/src/doc/object_type.h new file mode 100644 index 000000000..ed477a497 --- /dev/null +++ b/src/doc/object_type.h @@ -0,0 +1,30 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_OBJECT_TYPE_H_INCLUDED +#define DOC_OBJECT_TYPE_H_INCLUDED +#pragma once + +namespace doc { + + enum class ObjectType { + Unknown, + Image, + Palette, + RgbMap, + Path, + Mask, + Cel, + LayerImage, + LayerFolder, + Stock, + Sprite, + Document, + }; + +} // namespace doc + +#endif // DOC_OBJECT_TYPE_H_INCLUDED diff --git a/src/raster/palette.cpp b/src/doc/palette.cpp similarity index 91% rename from src/raster/palette.cpp rename to src/doc/palette.cpp index a9be7d93d..add91b1a1 100644 --- a/src/raster/palette.cpp +++ b/src/doc/palette.cpp @@ -1,39 +1,27 @@ -/* Aseprite - * Copyright (C) 2001-2014 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/palette.h" +#include "doc/palette.h" #include "gfx/hsv.h" #include "gfx/rgb.h" -#include "raster/image.h" +#include "doc/image.h" #include -namespace raster { +namespace doc { using namespace gfx; Palette::Palette(FrameNumber frame, int ncolors) - : Object(OBJECT_PALETTE) + : Object(ObjectType::Palette) { ASSERT(ncolors >= 0 && ncolors <= MaxColors); @@ -470,4 +458,4 @@ int Palette::findBestfit(int r, int g, int b, int mask_index) const return bestfit; } -} // namespace raster +} // namespace doc diff --git a/src/raster/palette.h b/src/doc/palette.h similarity index 67% rename from src/raster/palette.h rename to src/doc/palette.h index 3ccf2725e..91324b7ca 100644 --- a/src/raster/palette.h +++ b/src/doc/palette.h @@ -1,33 +1,21 @@ -/* Aseprite - * Copyright (C) 2001-2014 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_PALETTE_H_INCLUDED -#define RASTER_PALETTE_H_INCLUDED +#ifndef DOC_PALETTE_H_INCLUDED +#define DOC_PALETTE_H_INCLUDED #pragma once -#include "raster/color.h" -#include "raster/frame_number.h" -#include "raster/object.h" +#include "doc/color.h" +#include "doc/frame_number.h" +#include "doc/object.h" #include #include -namespace raster { +namespace doc { class SortPalette { public: @@ -108,6 +96,6 @@ namespace raster { std::string m_filename; // If the palette is associated with a file. }; -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/palette_io.cpp b/src/doc/palette_io.cpp similarity index 54% rename from src/raster/palette_io.cpp rename to src/doc/palette_io.cpp index b398be6c2..313e9967c 100644 --- a/src/raster/palette_io.cpp +++ b/src/doc/palette_io.cpp @@ -1,34 +1,22 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/palette_io.h" +#include "doc/palette_io.h" #include "base/serialization.h" #include "base/unique_ptr.h" -#include "raster/palette.h" +#include "doc/palette.h" #include -namespace raster { +namespace doc { using namespace base::serialization; using namespace base::serialization::little_endian; diff --git a/src/doc/palette_io.h b/src/doc/palette_io.h new file mode 100644 index 000000000..2530cdc33 --- /dev/null +++ b/src/doc/palette_io.h @@ -0,0 +1,22 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_PALETTE_IO_H_INCLUDED +#define DOC_PALETTE_IO_H_INCLUDED +#pragma once + +#include + +namespace doc { + + class Palette; + + void write_palette(std::ostream& os, Palette* palette); + Palette* read_palette(std::istream& is); + +} // namespace doc + +#endif diff --git a/src/raster/path.cpp b/src/doc/path.cpp similarity index 91% rename from src/raster/path.cpp rename to src/doc/path.cpp index 86a8821cb..e599c8539 100644 --- a/src/raster/path.cpp +++ b/src/doc/path.cpp @@ -1,20 +1,8 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #error This file is deprecated @@ -24,13 +12,13 @@ #include -#include "raster/blend.h" -#include "raster/image.h" -#include "raster/path.h" +#include "doc/blend.h" +#include "doc/image.h" +#include "doc/path.h" #include "libart_lgpl/libart.h" -namespace raster { +namespace doc { static int path_get_element(Path* path, double x, double y); static void draw_path(Path* path, Image *image, int color, double brush_size, int fill); @@ -418,4 +406,4 @@ static void draw_path (Path* path, Image *image, int color, double brush_size, i art_free (svp); } -} // namespace raster +} // namespace doc diff --git a/src/raster/path.h b/src/doc/path.h similarity index 59% rename from src/raster/path.h rename to src/doc/path.h index e31e349bc..f7d73e0d6 100644 --- a/src/raster/path.h +++ b/src/doc/path.h @@ -1,31 +1,19 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_PATH_H_INCLUDED -#define RASTER_PATH_H_INCLUDED +#ifndef DOC_PATH_H_INCLUDED +#define DOC_PATH_H_INCLUDED #pragma once #error This file is deprecated -#include "raster/object.h" +#include "doc/object.h" #include -namespace raster { +namespace doc { class Image; struct _ArtBpath; @@ -77,6 +65,6 @@ namespace raster { void path_stroke(Path* path, Image* image, int color, double brush_size); void path_fill(Path* path, Image* image, int color); -} // namespace raster +} // namespace doc #endif diff --git a/src/doc/pixel_format.h b/src/doc/pixel_format.h new file mode 100644 index 000000000..f15819e21 --- /dev/null +++ b/src/doc/pixel_format.h @@ -0,0 +1,22 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_PIXEL_FORMAT_H_INCLUDED +#define DOC_PIXEL_FORMAT_H_INCLUDED +#pragma once + +namespace doc { + + enum PixelFormat { + IMAGE_RGB, + IMAGE_GRAYSCALE, + IMAGE_INDEXED, + IMAGE_BITMAP + }; + +} // namespace doc + +#endif diff --git a/src/raster/primitives.cpp b/src/doc/primitives.cpp similarity index 87% rename from src/raster/primitives.cpp rename to src/doc/primitives.cpp index f835fa049..6d35c62a0 100644 --- a/src/raster/primitives.cpp +++ b/src/doc/primitives.cpp @@ -1,38 +1,26 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/primitives.h" +#include "doc/primitives.h" -#include "raster/algo.h" -#include "raster/blend.h" -#include "raster/brush.h" -#include "raster/image.h" -#include "raster/image_impl.h" -#include "raster/palette.h" -#include "raster/rgbmap.h" +#include "doc/algo.h" +#include "doc/blend.h" +#include "doc/brush.h" +#include "doc/image.h" +#include "doc/image_impl.h" +#include "doc/palette.h" +#include "doc/rgbmap.h" #include -namespace raster { +namespace doc { color_t get_pixel(const Image* image, int x, int y) { @@ -335,4 +323,4 @@ int count_diff_between_images(const Image* i1, const Image* i2) return -1; } -} // namespace raster +} // namespace doc diff --git a/src/raster/primitives.h b/src/doc/primitives.h similarity index 58% rename from src/raster/primitives.h rename to src/doc/primitives.h index b32c3c962..723915a90 100644 --- a/src/raster/primitives.h +++ b/src/doc/primitives.h @@ -1,29 +1,17 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_PRIMITIVES_H_INCLUDED -#define RASTER_PRIMITIVES_H_INCLUDED +#ifndef DOC_PRIMITIVES_H_INCLUDED +#define DOC_PRIMITIVES_H_INCLUDED #pragma once -#include "raster/color.h" -#include "raster/image_buffer.h" +#include "doc/color.h" +#include "doc/image_buffer.h" -namespace raster { +namespace doc { class Brush; class Image; class Palette; @@ -51,6 +39,6 @@ namespace raster { int count_diff_between_images(const Image* i1, const Image* i2); -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/primitives_fast.h b/src/doc/primitives_fast.h similarity index 57% rename from src/raster/primitives_fast.h rename to src/doc/primitives_fast.h index e7863aab8..debc5f428 100644 --- a/src/raster/primitives_fast.h +++ b/src/doc/primitives_fast.h @@ -1,29 +1,17 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_PRIMITIVES_FAST_H_INCLUDED -#define RASTER_PRIMITIVES_FAST_H_INCLUDED +#ifndef DOC_PRIMITIVES_FAST_H_INCLUDED +#define DOC_PRIMITIVES_FAST_H_INCLUDED #pragma once -#include "raster/color.h" -#include "raster/image_impl.h" +#include "doc/color.h" +#include "doc/image_impl.h" -namespace raster { +namespace doc { class Image; template @@ -64,6 +52,6 @@ namespace raster { *image->getPixelAddress(x, y) &= ~(1 << (x % 8)); } -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/quantization.cpp b/src/doc/quantization.cpp similarity index 92% rename from src/raster/quantization.cpp rename to src/doc/quantization.cpp index d51304c53..be59627b0 100644 --- a/src/raster/quantization.cpp +++ b/src/doc/quantization.cpp @@ -1,44 +1,32 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/quantization.h" +#include "doc/quantization.h" #include "gfx/hsv.h" #include "gfx/rgb.h" -#include "raster/blend.h" -#include "raster/image.h" -#include "raster/image_bits.h" -#include "raster/images_collector.h" -#include "raster/layer.h" -#include "raster/palette.h" -#include "raster/primitives.h" -#include "raster/rgbmap.h" -#include "raster/sprite.h" +#include "doc/blend.h" +#include "doc/image.h" +#include "doc/image_bits.h" +#include "doc/images_collector.h" +#include "doc/layer.h" +#include "doc/palette.h" +#include "doc/primitives.h" +#include "doc/rgbmap.h" +#include "doc/sprite.h" #include #include #include -namespace raster { +namespace doc { namespace quantization { using namespace gfx; @@ -499,4 +487,4 @@ void create_palette_from_images(const std::vector& images, Palette* pale } } // namespace quantization -} // namespace raster +} // namespace doc diff --git a/src/raster/quantization.h b/src/doc/quantization.h similarity index 53% rename from src/raster/quantization.h rename to src/doc/quantization.h index 2d318b342..8f569d73f 100644 --- a/src/raster/quantization.h +++ b/src/doc/quantization.h @@ -1,33 +1,21 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_QUANTIZATION_H_INCLUDED -#define RASTER_QUANTIZATION_H_INCLUDED +#ifndef DOC_QUANTIZATION_H_INCLUDED +#define DOC_QUANTIZATION_H_INCLUDED #pragma once -#include "raster/color_histogram.h" -#include "raster/dithering_method.h" -#include "raster/frame_number.h" -#include "raster/pixel_format.h" +#include "doc/color_histogram.h" +#include "doc/dithering_method.h" +#include "doc/frame_number.h" +#include "doc/pixel_format.h" #include -namespace raster { +namespace doc { class Image; class Palette; @@ -69,6 +57,6 @@ namespace raster { bool is_background); } // namespace quantization -} // namespace raster +} // namespace doc #endif diff --git a/src/raster/resize_image_tests.cpp b/src/doc/resize_image_tests.cpp similarity index 95% rename from src/raster/resize_image_tests.cpp rename to src/doc/resize_image_tests.cpp index 2cbc2cc80..100ccd6be 100644 --- a/src/raster/resize_image_tests.cpp +++ b/src/doc/resize_image_tests.cpp @@ -1,5 +1,5 @@ -// Aseprite Gfx Library -// Copyright (C) 2001-2013 David Capello +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. @@ -10,12 +10,12 @@ #include -#include "raster/color.h" -#include "raster/image.h" -#include "raster/algorithm/resize_image.h" +#include "doc/color.h" +#include "doc/image.h" +#include "doc/algorithm/resize_image.h" using namespace std; -using namespace raster; +using namespace doc; /*************************** * Test dat diff --git a/src/raster/rgbmap.cpp b/src/doc/rgbmap.cpp similarity index 50% rename from src/raster/rgbmap.cpp rename to src/doc/rgbmap.cpp index 25ffa8426..b53158b1d 100644 --- a/src/raster/rgbmap.cpp +++ b/src/doc/rgbmap.cpp @@ -1,36 +1,24 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/rgbmap.h" +#include "doc/rgbmap.h" -#include "raster/color_scales.h" -#include "raster/palette.h" +#include "doc/color_scales.h" +#include "doc/palette.h" -namespace raster { +namespace doc { #define MAPSIZE 32*32*32 RgbMap::RgbMap() - : Object(OBJECT_RGBMAP) + : Object(ObjectType::RgbMap) , m_map(MAPSIZE) , m_palette(NULL) , m_modifications(0) @@ -70,4 +58,4 @@ int RgbMap::mapColor(int r, int g, int b) const return m_map[((r>>3) << 10) + ((g>>3) << 5) + (b>>3)]; } -} // namespace raster +} // namespace doc diff --git a/src/doc/rgbmap.h b/src/doc/rgbmap.h new file mode 100644 index 000000000..1bf228131 --- /dev/null +++ b/src/doc/rgbmap.h @@ -0,0 +1,39 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_RGBMAP_H_INCLUDED +#define DOC_RGBMAP_H_INCLUDED +#pragma once + +#include "base/disable_copying.h" +#include "doc/object.h" + +#include + +namespace doc { + + class Palette; + + class RgbMap : public Object { + public: + RgbMap(); + + bool match(const Palette* palette) const; + void regenerate(const Palette* palette, int mask_index); + + int mapColor(int r, int g, int b) const; + + private: + std::vector m_map; + const Palette* m_palette; + int m_modifications; + + DISABLE_COPYING(RgbMap); + }; + +} // namespace doc + +#endif diff --git a/src/doc/settings.h b/src/doc/settings.h index ce4d71bd1..a0ed66c6d 100644 --- a/src/doc/settings.h +++ b/src/doc/settings.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/raster/sprite.cpp b/src/doc/sprite.cpp similarity index 88% rename from src/raster/sprite.cpp rename to src/doc/sprite.cpp index 6c1551a87..86acc32d2 100644 --- a/src/raster/sprite.cpp +++ b/src/doc/sprite.cpp @@ -1,38 +1,26 @@ -/* Aseprite - * Copyright (C) 2001-2014 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/sprite.h" +#include "doc/sprite.h" #include "base/memory.h" #include "base/remove_from_container.h" #include "base/unique_ptr.h" -#include "raster/image_bits.h" -#include "raster/primitives.h" -#include "raster/raster.h" +#include "doc/image_bits.h" +#include "doc/primitives.h" +#include "doc/doc.h" #include #include -namespace raster { +namespace doc { static Layer* index2layer(const Layer* layer, const LayerIndex& index, int* index_count); static LayerIndex layer2index(const Layer* layer, const Layer* find_layer, int* index_count); @@ -41,7 +29,7 @@ static LayerIndex layer2index(const Layer* layer, const Layer* find_layer, int* // Constructors/Destructor Sprite::Sprite(PixelFormat format, int width, int height, int ncolors) - : Object(OBJECT_SPRITE) + : Object(ObjectType::Sprite) , m_format(format) , m_width(width) , m_height(height) @@ -106,19 +94,19 @@ Sprite::~Sprite() } // static -Sprite* Sprite::createBasicSprite(raster::PixelFormat format, int width, int height, int ncolors) +Sprite* Sprite::createBasicSprite(doc::PixelFormat format, int width, int height, int ncolors) { // Create the sprite. - base::UniquePtr sprite(new raster::Sprite(format, width, height, ncolors)); - sprite->setTotalFrames(raster::FrameNumber(1)); + base::UniquePtr sprite(new doc::Sprite(format, width, height, ncolors)); + sprite->setTotalFrames(doc::FrameNumber(1)); // Create the main image. int indexInStock; { - base::UniquePtr image(raster::Image::create(format, width, height)); + base::UniquePtr image(doc::Image::create(format, width, height)); // Clear the image with mask color. - raster::clear_image(image, 0); + doc::clear_image(image, 0); // Add image in the sprite's stock. indexInStock = sprite->stock()->addImage(image); @@ -127,12 +115,12 @@ Sprite* Sprite::createBasicSprite(raster::PixelFormat format, int width, int hei // Create the first transparent layer. { - base::UniquePtr layer(new raster::LayerImage(sprite)); + base::UniquePtr layer(new doc::LayerImage(sprite)); layer->setName("Layer 1"); // Create the cel. { - base::UniquePtr cel(new raster::Cel(raster::FrameNumber(0), indexInStock)); + base::UniquePtr cel(new doc::Cel(doc::FrameNumber(0), indexInStock)); cel->setPosition(0, 0); // Add the cel in the layer. @@ -539,4 +527,4 @@ static LayerIndex layer2index(const Layer* layer, const Layer* find_layer, int* } } -} // namespace raster +} // namespace doc diff --git a/src/doc/sprite.h b/src/doc/sprite.h index 26750ede4..d25c71aed 100644 --- a/src/doc/sprite.h +++ b/src/doc/sprite.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. @@ -8,11 +8,152 @@ #define DOC_SPRITE_H_INCLUDED #pragma once -#include "raster/sprite.h" +#include "base/disable_copying.h" +#include "doc/cel_list.h" +#include "doc/color.h" +#include "doc/frame_number.h" +#include "doc/layer_index.h" +#include "doc/object.h" +#include "doc/pixel_format.h" +#include "doc/sprite_position.h" + +#include namespace doc { - typedef raster::Sprite Sprite; + class Image; + class Layer; + class LayerFolder; + class LayerImage; + class Mask; + class Palette; + class Path; + class RgbMap; + class Sprite; + class Stock; + + typedef std::vector PalettesList; + + // The main structure used in the whole program to handle a sprite. + class Sprite : public Object { + public: + + //////////////////////////////////////// + // Constructors/Destructor + + Sprite(PixelFormat format, int width, int height, int ncolors); + virtual ~Sprite(); + + static Sprite* createBasicSprite(PixelFormat format, int width, int height, int ncolors); + + //////////////////////////////////////// + // Main properties + + PixelFormat pixelFormat() const { return m_format; } + void setPixelFormat(PixelFormat format); + + int width() const { return m_width; } + int height() const { return m_height; } + void setSize(int width, int height); + + // Returns true if the rendered images will contain alpha values less + // than 255. Only RGBA and Grayscale images without background needs + // alpha channel in the render. + bool needAlpha() const; + bool supportAlpha() const; + + color_t transparentColor() const { return m_transparentColor; } + void setTransparentColor(color_t color); + + int getMemSize() const; + + //////////////////////////////////////// + // Layers + + LayerFolder* folder() const; + LayerImage* backgroundLayer() const; + + LayerIndex countLayers() const; + + Layer* indexToLayer(LayerIndex index) const; + LayerIndex layerToIndex(const Layer* layer) const; + + void getLayersList(std::vector& layers) const; + + //////////////////////////////////////// + // Palettes + + Palette* getPalette(FrameNumber frame) const; + const PalettesList& getPalettes() const; + + void setPalette(const Palette* pal, bool truncate); + + // Removes all palettes from the sprites except the first one. + void resetPalettes(); + + void deletePalette(Palette* pal); + + RgbMap* getRgbMap(FrameNumber frame); + + //////////////////////////////////////// + // Frames + + FrameNumber totalFrames() const { return m_frames; } + FrameNumber lastFrame() const { return m_frames.previous(); } + + void addFrame(FrameNumber newFrame); + void removeFrame(FrameNumber newFrame); + void setTotalFrames(FrameNumber frames); + + int getFrameDuration(FrameNumber frame) const; + void setFrameDuration(FrameNumber frame, int msecs); + void setFrameRangeDuration(FrameNumber from, FrameNumber to, int msecs); + void setDurationForAllFrames(int msecs); + + //////////////////////////////////////// + // Images + + Stock* stock() const; + + void getCels(CelList& cels) const; + + // Returns the how many cels are referencing the given imageIndex. + size_t getImageRefs(int imageIndex) const; + + void remapImages(FrameNumber frameFrom, FrameNumber frameTo, const std::vector& mapping); + + // Draws the sprite in the given image at the given position. Before + // drawing the sprite, this function clears (with the sprite's + // background color) the rectangle area that will occupy the drawn + // sprite. + void render(Image* image, int x, int y, FrameNumber frame) const; + + // Gets a pixel from the sprite in the specified position. If in the + // specified coordinates there're background this routine will + // return the 0 color (the mask-color). + int getPixel(int x, int y, FrameNumber frame) const; + + private: + Sprite* m_self; // pointer to the Sprite + PixelFormat m_format; // pixel format + int m_width; // image width (in pixels) + int m_height; // image height (in pixels) + FrameNumber m_frames; // how many frames has this sprite + std::vector m_frlens; // duration per frame + PalettesList m_palettes; // list of palettes + Stock* m_stock; // stock to get images + LayerFolder* m_folder; // main folder of layers + + // Current rgb map + RgbMap* m_rgbMap; + + // Transparent color used in indexed images + color_t m_transparentColor; + + // Disable default constructor and copying + Sprite(); + DISABLE_COPYING(Sprite); + }; } // namespace doc diff --git a/src/doc/sprite_position.h b/src/doc/sprite_position.h new file mode 100644 index 000000000..67c104f92 --- /dev/null +++ b/src/doc/sprite_position.h @@ -0,0 +1,42 @@ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. + +#ifndef DOC_SPRITE_POSITION_H_INCLUDED +#define DOC_SPRITE_POSITION_H_INCLUDED +#pragma once + +#include "doc/frame_number.h" +#include "doc/layer_index.h" + +namespace doc { + + class Sprite; + + class SpritePosition { + public: + SpritePosition() { } + SpritePosition(LayerIndex layerIndex, FrameNumber frameNumber) + : m_layerIndex(layerIndex) + , m_frameNumber(frameNumber) { + } + + const LayerIndex& layerIndex() const { return m_layerIndex; } + const FrameNumber& frameNumber() const { return m_frameNumber; } + + void layerIndex(LayerIndex layerIndex) { m_layerIndex = layerIndex; } + void frameNumber(FrameNumber frameNumber) { m_frameNumber = frameNumber; } + + bool operator==(const SpritePosition& o) const { return m_layerIndex == o.m_layerIndex && m_frameNumber == o.m_frameNumber; } + bool operator!=(const SpritePosition& o) const { return m_layerIndex != o.m_layerIndex || m_frameNumber != o.m_frameNumber; } + + private: + LayerIndex m_layerIndex; + FrameNumber m_frameNumber; + }; + +} // namespace doc + +#endif diff --git a/src/doc/sprites.cpp b/src/doc/sprites.cpp index 75e396d49..b2ec77f74 100644 --- a/src/doc/sprites.cpp +++ b/src/doc/sprites.cpp @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. @@ -13,11 +13,11 @@ #include "base/mutex.h" #include "base/unique_ptr.h" #include "doc/sprite.h" -#include "raster/cel.h" -#include "raster/image.h" -#include "raster/layer.h" -#include "raster/primitives.h" -#include "raster/stock.h" +#include "doc/cel.h" +#include "doc/image.h" +#include "doc/layer.h" +#include "doc/primitives.h" +#include "doc/stock.h" #include @@ -37,8 +37,8 @@ Sprites::~Sprites() Sprite* Sprites::add(int width, int height, ColorMode mode, int ncolors) { base::UniquePtr spr( - raster::Sprite::createBasicSprite( - (raster::PixelFormat)mode, width, height, ncolors)); + doc::Sprite::createBasicSprite( + (doc::PixelFormat)mode, width, height, ncolors)); add(spr); diff --git a/src/doc/sprites.h b/src/doc/sprites.h index 66e2d43e2..a9abd5fc0 100644 --- a/src/doc/sprites.h +++ b/src/doc/sprites.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/doc/sprites_observer.h b/src/doc/sprites_observer.h index 719b436f7..50856d991 100644 --- a/src/doc/sprites_observer.h +++ b/src/doc/sprites_observer.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2014 David Capello +// Copyright (c) 2001-2014 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. diff --git a/src/raster/stock.cpp b/src/doc/stock.cpp similarity index 57% rename from src/raster/stock.cpp rename to src/doc/stock.cpp index d5999851d..a9a1f870a 100644 --- a/src/raster/stock.cpp +++ b/src/doc/stock.cpp @@ -1,36 +1,24 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "raster/stock.h" +#include "doc/stock.h" -#include "raster/image.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/sprite.h" #include -namespace raster { +namespace doc { Stock::Stock(Sprite* sprite, PixelFormat format) - : Object(OBJECT_STOCK) + : Object(ObjectType::Stock) , m_format(format) , m_sprite(sprite) { @@ -100,4 +88,4 @@ void Stock::fixupImage(Image* image) image->setMaskColor(m_sprite->transparentColor()); } -} // namespace raster +} // namespace doc diff --git a/src/raster/stock.h b/src/doc/stock.h similarity index 60% rename from src/raster/stock.h rename to src/doc/stock.h index a00fc2f70..5d8623692 100644 --- a/src/raster/stock.h +++ b/src/doc/stock.h @@ -1,32 +1,20 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +// Aseprite Document Library +// Copyright (c) 2001-2014 David Capello +// +// This file is released under the terms of the MIT license. +// Read LICENSE.txt for more information. -#ifndef RASTER_STOCK_H_INCLUDED -#define RASTER_STOCK_H_INCLUDED +#ifndef DOC_STOCK_H_INCLUDED +#define DOC_STOCK_H_INCLUDED #pragma once #include "base/disable_copying.h" -#include "raster/object.h" -#include "raster/pixel_format.h" +#include "doc/object.h" +#include "doc/pixel_format.h" #include -namespace raster { +namespace doc { class Image; class Sprite; @@ -77,6 +65,6 @@ namespace raster { DISABLE_COPYING(Stock); }; -} // namespace raster +} // namespace doc #endif diff --git a/src/filters/color_curve_filter.cpp b/src/filters/color_curve_filter.cpp index 2ef22d9ee..5386c35f8 100644 --- a/src/filters/color_curve_filter.cpp +++ b/src/filters/color_curve_filter.cpp @@ -27,14 +27,14 @@ #include "filters/color_curve.h" #include "filters/filter_indexed_data.h" #include "filters/filter_manager.h" -#include "raster/image.h" -#include "raster/palette.h" -#include "raster/rgbmap.h" -#include "raster/sprite.h" +#include "doc/image.h" +#include "doc/palette.h" +#include "doc/rgbmap.h" +#include "doc/sprite.h" namespace filters { -using namespace raster; +using namespace doc; ColorCurveFilter::ColorCurveFilter() : m_curve(NULL) diff --git a/src/filters/convolution_matrix_filter.cpp b/src/filters/convolution_matrix_filter.cpp index 7d4520db2..7d6bdaa24 100644 --- a/src/filters/convolution_matrix_filter.cpp +++ b/src/filters/convolution_matrix_filter.cpp @@ -26,14 +26,14 @@ #include "filters/filter_indexed_data.h" #include "filters/filter_manager.h" #include "filters/neighboring_pixels.h" -#include "raster/image.h" -#include "raster/palette.h" -#include "raster/primitives_fast.h" -#include "raster/rgbmap.h" +#include "doc/image.h" +#include "doc/palette.h" +#include "doc/primitives_fast.h" +#include "doc/rgbmap.h" namespace filters { -using namespace raster; +using namespace doc; namespace { diff --git a/src/filters/filter_indexed_data.h b/src/filters/filter_indexed_data.h index 55f9f825e..2635cb03e 100644 --- a/src/filters/filter_indexed_data.h +++ b/src/filters/filter_indexed_data.h @@ -20,7 +20,7 @@ #define FILTERS_FILTER_INDEXED_DATA_H_INCLUDED #pragma once -namespace raster { +namespace doc { class Palette; class RgbMap; } @@ -32,8 +32,8 @@ namespace filters { class FilterIndexedData { public: virtual ~FilterIndexedData() { } - virtual raster::Palette* getPalette() = 0; - virtual raster::RgbMap* getRgbMap() = 0; + virtual doc::Palette* getPalette() = 0; + virtual doc::RgbMap* getRgbMap() = 0; }; } // namespace filters diff --git a/src/filters/filter_manager.h b/src/filters/filter_manager.h index 406dc37c7..d1c6491b0 100644 --- a/src/filters/filter_manager.h +++ b/src/filters/filter_manager.h @@ -22,7 +22,7 @@ #include "filters/target.h" -namespace raster { +namespace doc { class Image; } @@ -73,7 +73,7 @@ namespace filters { // Special members for 2D filters like convolution matrices. // Returns the source image. - virtual const raster::Image* getSourceImage() = 0; + virtual const doc::Image* getSourceImage() = 0; // Returns the first X coordinate of the row to apply the filter. virtual int x() = 0; diff --git a/src/filters/invert_color_filter.cpp b/src/filters/invert_color_filter.cpp index 09c3e9e71..45c2febe6 100644 --- a/src/filters/invert_color_filter.cpp +++ b/src/filters/invert_color_filter.cpp @@ -24,13 +24,13 @@ #include "filters/filter_indexed_data.h" #include "filters/filter_manager.h" -#include "raster/image.h" -#include "raster/palette.h" -#include "raster/rgbmap.h" +#include "doc/image.h" +#include "doc/palette.h" +#include "doc/rgbmap.h" namespace filters { -using namespace raster; +using namespace doc; const char* InvertColorFilter::getName() { diff --git a/src/filters/median_filter.cpp b/src/filters/median_filter.cpp index 5d9450cd9..35cb550ac 100644 --- a/src/filters/median_filter.cpp +++ b/src/filters/median_filter.cpp @@ -27,16 +27,16 @@ #include "filters/filter_manager.h" #include "filters/neighboring_pixels.h" #include "filters/tiled_mode.h" -#include "raster/image.h" -#include "raster/palette.h" -#include "raster/primitives_fast.h" -#include "raster/rgbmap.h" +#include "doc/image.h" +#include "doc/palette.h" +#include "doc/primitives_fast.h" +#include "doc/rgbmap.h" #include namespace filters { -using namespace raster; +using namespace doc; namespace { struct GetPixelsDelegateRgba { diff --git a/src/filters/neighboring_pixels.h b/src/filters/neighboring_pixels.h index 9573e284e..f8a8b028c 100644 --- a/src/filters/neighboring_pixels.h +++ b/src/filters/neighboring_pixels.h @@ -21,19 +21,19 @@ #pragma once #include "filters/tiled_mode.h" -#include "raster/image.h" -#include "raster/image_traits.h" +#include "doc/image.h" +#include "doc/image_traits.h" #include namespace filters { - using namespace raster; + using namespace doc; // Calls the specified "delegate" for all neighboring pixels in a 2D // (width*height) matrix located in (x,y) where its center is the // (centerX,centerY) element of the matrix. template - inline void get_neighboring_pixels(const raster::Image* sourceImage, int x, int y, + inline void get_neighboring_pixels(const doc::Image* sourceImage, int x, int y, int width, int height, int centerX, int centerY, TiledMode tiledMode, diff --git a/src/filters/replace_color_filter.cpp b/src/filters/replace_color_filter.cpp index ebacc3370..84d992759 100644 --- a/src/filters/replace_color_filter.cpp +++ b/src/filters/replace_color_filter.cpp @@ -23,11 +23,11 @@ #include "filters/replace_color_filter.h" #include "filters/filter_manager.h" -#include "raster/image.h" +#include "doc/image.h" namespace filters { -using namespace raster; +using namespace doc; ReplaceColorFilter::ReplaceColorFilter() { diff --git a/src/raster/CMakeLists.txt b/src/raster/CMakeLists.txt deleted file mode 100644 index e02b98bdf..000000000 --- a/src/raster/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# Aseprite -# Copyright (C) 2001-2014 David Capello - -add_library(raster-lib - algo.cpp - algo_polygon.cpp - algofill.cpp - algorithm/flip_image.cpp - algorithm/resize_image.cpp - algorithm/shrink_bounds.cpp - blend.cpp - brush.cpp - cel.cpp - cel_io.cpp - color_scales.cpp - conversion_she.cpp - dirty.cpp - dirty_io.cpp - file/col_file.cpp - file/gpl_file.cpp - image.cpp - image_io.cpp - images_collector.cpp - layer.cpp - layer_index.cpp - layer_io.cpp - mask.cpp - mask_io.cpp - object.cpp - palette.cpp - palette_io.cpp - primitives.cpp - quantization.cpp - rgbmap.cpp - rotate.cpp - rotsprite.cpp - sprite.cpp - stock.cpp) diff --git a/src/raster/algo.h b/src/raster/algo.h deleted file mode 100644 index 33abc2916..000000000 --- a/src/raster/algo.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2014 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_ALGO_H_INCLUDED -#define RASTER_ALGO_H_INCLUDED -#pragma once - -#include "gfx/fwd.h" - -namespace raster { - - class Image; - - typedef void (*AlgoPixel)(int x, int y, void *data); - typedef void (*AlgoHLine)(int x1, int y, int x2, void *data); - typedef void (*AlgoLine)(int x1, int y1, int x2, int y2, void *data); - - void algo_line(int x1, int y1, int x2, int y2, void *data, AlgoPixel proc); - void algo_ellipse(int x1, int y1, int x2, int y2, void *data, AlgoPixel proc); - void algo_ellipsefill(int x1, int y1, int x2, int y2, void *data, AlgoHLine proc); - - void algo_spline(double x0, double y0, double x1, double y1, - double x2, double y2, double x3, double y3, - void *data, AlgoLine proc); - double algo_spline_get_y(double x0, double y0, double x1, double y1, - double x2, double y2, double x3, double y3, - double x); - double algo_spline_get_tan(double x0, double y0, double x1, double y1, - double x2, double y2, double x3, double y3, - double in_x); - - void algo_floodfill(Image* image, int x, int y, - const gfx::Rect& bounds, - int tolerance, bool contiguous, - void* data, AlgoHLine proc); - - void algo_polygon(int vertices, const int* points, void* data, AlgoHLine proc); - -} // namespace raster - -#endif diff --git a/src/raster/algorithm/flip_image.h b/src/raster/algorithm/flip_image.h deleted file mode 100644 index 003ec8ae9..000000000 --- a/src/raster/algorithm/flip_image.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_ALGORITHM_FLIP_IMAGE_H_INCLUDED -#define RASTER_ALGORITHM_FLIP_IMAGE_H_INCLUDED -#pragma once - -#include "gfx/fwd.h" -#include "raster/algorithm/flip_type.h" - -namespace raster { - class Image; - class Mask; - - namespace algorithm { - - // Flips the rectangular region specified in the "bounds" parameter. - void flip_image(Image* image, const gfx::Rect& bounds, FlipType flipType); - - // Flips an irregular region specified by the "mask". The - // "bgcolor" is used to clear areas that aren't covered by a - // mirrored pixel. - void flip_image_with_mask(Image* image, const Mask* mask, FlipType flipType, int bgcolor); - - } -} - -#endif diff --git a/src/raster/algorithm/flip_type.h b/src/raster/algorithm/flip_type.h deleted file mode 100644 index 7e434a78f..000000000 --- a/src/raster/algorithm/flip_type.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_ALGORITHM_FLIP_TYPE_H_INCLUDED -#define RASTER_ALGORITHM_FLIP_TYPE_H_INCLUDED -#pragma once - -namespace raster { - namespace algorithm { - - enum FlipType { - FlipHorizontal, - FlipVertical, - }; - - } -} - -#endif diff --git a/src/raster/algorithm/shrink_bounds.h b/src/raster/algorithm/shrink_bounds.h deleted file mode 100644 index 7e0afaf15..000000000 --- a/src/raster/algorithm/shrink_bounds.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_ALGORITHM_SHRINK_BOUNDS_H_INCLUDED -#define RASTER_ALGORITHM_SHRINK_BOUNDS_H_INCLUDED -#pragma once - -#include "gfx/fwd.h" -#include "raster/algorithm/flip_type.h" -#include "raster/color.h" - -namespace raster { - class Image; - - namespace algorithm { - - bool shrink_bounds(Image* image, gfx::Rect& bounds, color_t refpixel); - - } // algorithm -} // raster - -#endif diff --git a/src/raster/brush_type.h b/src/raster/brush_type.h deleted file mode 100644 index f8a4b91d5..000000000 --- a/src/raster/brush_type.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_BRUSH_TYPE_H_INCLUDED -#define RASTER_BRUSH_TYPE_H_INCLUDED -#pragma once - -namespace raster { - - enum BrushType { - kCircleBrushType = 0, - kSquareBrushType = 1, - kLineBrushType = 2, - - kFirstBrushType = kCircleBrushType, - kLastBrushType = kLineBrushType, - }; - -} // namespace raster - -#endif diff --git a/src/raster/cel_io.h b/src/raster/cel_io.h deleted file mode 100644 index 3c4c80cda..000000000 --- a/src/raster/cel_io.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_CEL_IO_H_INCLUDED -#define RASTER_CEL_IO_H_INCLUDED -#pragma once - -#include - -namespace raster { - - class Cel; - - void write_cel(std::ostream& os, Cel* cel); - Cel* read_cel(std::istream& is); - -} // namespace raster - -#endif diff --git a/src/raster/color_scales.h b/src/raster/color_scales.h deleted file mode 100644 index ee4a62628..000000000 --- a/src/raster/color_scales.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_COLOR_SCALES_H_INCLUDED -#define RASTER_COLOR_SCALES_H_INCLUDED -#pragma once - -#include "raster/frame_number.h" -#include "raster/object.h" - -#include - -namespace raster { - - int scale_5bits_to_8bits(int channel5bits); - int scale_6bits_to_8bits(int channel6bits); - -} // namespace raster - -#endif diff --git a/src/raster/conversion_she.h b/src/raster/conversion_she.h deleted file mode 100644 index 210fc7ba6..000000000 --- a/src/raster/conversion_she.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2014 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_CONVERSION_SHE_H_INCLUDED -#define RASTER_CONVERSION_SHE_H_INCLUDED -#pragma once - -namespace she { - class Surface; -} - -namespace raster { - class Image; - class Palette; - - void convert_image_to_surface(const Image* image, const Palette* palette, - she::Surface* surface, - int src_x, int src_y, int dst_x, int dst_y, int w, int h); - -} // namespace raster - -#endif diff --git a/src/raster/dirty_io.h b/src/raster/dirty_io.h deleted file mode 100644 index 9376880ec..000000000 --- a/src/raster/dirty_io.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_DIRTY_IO_H_INCLUDED -#define RASTER_DIRTY_IO_H_INCLUDED -#pragma once - -#include - -namespace raster { - - class Dirty; - - void write_dirty(std::ostream& os, Dirty* dirty); - Dirty* read_dirty(std::istream& is); - -} // namespace raster - -#endif diff --git a/src/raster/dithering_method.h b/src/raster/dithering_method.h deleted file mode 100644 index 81a052c4c..000000000 --- a/src/raster/dithering_method.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_DITHERING_METHOD_H_INCLUDED -#define RASTER_DITHERING_METHOD_H_INCLUDED -#pragma once - -namespace raster { - - // Dithering methods - enum DitheringMethod { - DITHERING_NONE, - DITHERING_ORDERED, - }; - -} // namespace raster - -#endif diff --git a/src/raster/file/col_file.h b/src/raster/file/col_file.h deleted file mode 100644 index 4bc59eaa3..000000000 --- a/src/raster/file/col_file.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_FILE_COL_FILE_H_INCLUDED -#define RASTER_FILE_COL_FILE_H_INCLUDED -#pragma once - -namespace raster { - - class Palette; - - namespace file { - - Palette* load_col_file(const char* filename); - bool save_col_file(const Palette* pal, const char* filename); - - } // namespace file - -} // namespace raster - -#endif diff --git a/src/raster/file/gpl_file.h b/src/raster/file/gpl_file.h deleted file mode 100644 index ac60f9c56..000000000 --- a/src/raster/file/gpl_file.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_FILE_GPL_FILE_H_INCLUDED -#define RASTER_FILE_GPL_FILE_H_INCLUDED -#pragma once - -namespace raster { - - class Palette; - - namespace file { - - Palette* load_gpl_file(const char* filename); - bool save_gpl_file(const Palette* pal, const char* filename); - - } // namespace file -} // namespace raster - -#endif diff --git a/src/raster/image_buffer.h b/src/raster/image_buffer.h deleted file mode 100644 index 2013f5a21..000000000 --- a/src/raster/image_buffer.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_IMAGE_BUFFER_H_INCLUDED -#define RASTER_IMAGE_BUFFER_H_INCLUDED -#pragma once - -#include "base/shared_ptr.h" - -#include - -namespace raster { - - class ImageBuffer { - public: - ImageBuffer(size_t size) : m_buffer(size) { - } - - size_t size() const { return m_buffer.size(); } - uint8_t* buffer() { return &m_buffer[0]; } - - void resizeIfNecessary(size_t size) { - if (size > m_buffer.size()) - m_buffer.resize(size); - } - - private: - std::vector m_buffer; - }; - - typedef SharedPtr ImageBufferPtr; - -} // namespace raster - -#endif diff --git a/src/raster/image_io.h b/src/raster/image_io.h deleted file mode 100644 index e5b23b195..000000000 --- a/src/raster/image_io.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_IMAGE_IO_H_INCLUDED -#define RASTER_IMAGE_IO_H_INCLUDED -#pragma once - -#include - -namespace raster { - - class Image; - - void write_image(std::ostream& os, Image* image); - Image* read_image(std::istream& is); - -} // namespace raster - -#endif diff --git a/src/raster/layer_index.cpp b/src/raster/layer_index.cpp deleted file mode 100644 index 4a8a9fdd7..000000000 --- a/src/raster/layer_index.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2014 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "raster/layer_index.h" - -namespace raster { - -const LayerIndex LayerIndex::NoLayer(-1); - -} // namespace raster diff --git a/src/raster/mask_io.h b/src/raster/mask_io.h deleted file mode 100644 index 7ae805862..000000000 --- a/src/raster/mask_io.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_MASK_IO_H_INCLUDED -#define RASTER_MASK_IO_H_INCLUDED -#pragma once - -#include - -namespace raster { - - class Mask; - - void write_mask(std::ostream& os, Mask* mask); - Mask* read_mask(std::istream& is); - -} // namespace raster - -#endif diff --git a/src/raster/object.cpp b/src/raster/object.cpp deleted file mode 100644 index 96fed401d..000000000 --- a/src/raster/object.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "raster/object.h" - -namespace raster { - -Object::Object(ObjectType type) -{ - m_type = type; -} - -Object::Object(const Object& object) -{ - m_type = object.m_type; -} - -Object::~Object() -{ -} - -int Object::getMemSize() const -{ - return sizeof(Object); -} - -} // namespace raster diff --git a/src/raster/object.h b/src/raster/object.h deleted file mode 100644 index 1d7e32e95..000000000 --- a/src/raster/object.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_OBJECT_H_INCLUDED -#define RASTER_OBJECT_H_INCLUDED -#pragma once - -#include - -namespace raster { - - enum ObjectType { - OBJECT_CEL, - OBJECT_IMAGE, - OBJECT_LAYER_IMAGE, - OBJECT_LAYER_FOLDER, - OBJECT_MASK, - OBJECT_PALETTE, - OBJECT_PATH, - OBJECT_SPRITE, - OBJECT_STOCK, - OBJECT_RGBMAP, - }; - - class Cel; - class Layer; - - typedef std::list CelList; - typedef std::list::iterator CelIterator; - typedef std::list::const_iterator CelConstIterator; - - typedef std::list LayerList; - typedef std::list::iterator LayerIterator; - typedef std::list::const_iterator LayerConstIterator; - - class Object { - public: - Object(ObjectType type); - Object(const Object& object); - virtual ~Object(); - - ObjectType type() const { return m_type; } - - // Returns the approximate amount of memory (in bytes) which this - // object use. - virtual int getMemSize() const; - - private: - ObjectType m_type; - - Object& operator=(const Object&); - }; - -} // namespace raster - -#endif diff --git a/src/raster/palette_io.h b/src/raster/palette_io.h deleted file mode 100644 index 1db8d3bdd..000000000 --- a/src/raster/palette_io.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_PALETTE_IO_H_INCLUDED -#define RASTER_PALETTE_IO_H_INCLUDED -#pragma once - -#include - -namespace raster { - - class Palette; - - void write_palette(std::ostream& os, Palette* palette); - Palette* read_palette(std::istream& is); - -} // namespace raster - -#endif diff --git a/src/raster/pixel_format.h b/src/raster/pixel_format.h deleted file mode 100644 index 4a0cd9829..000000000 --- a/src/raster/pixel_format.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_PIXEL_FORMAT_H_INCLUDED -#define RASTER_PIXEL_FORMAT_H_INCLUDED -#pragma once - -namespace raster { - - enum PixelFormat { - IMAGE_RGB, - IMAGE_GRAYSCALE, - IMAGE_INDEXED, - IMAGE_BITMAP - }; - -} // namespace raster - -#endif diff --git a/src/raster/raster.h b/src/raster/raster.h deleted file mode 100644 index 24499ee29..000000000 --- a/src/raster/raster.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_RASTER_H_INCLUDED -#define RASTER_RASTER_H_INCLUDED -#pragma once - -#include "raster/algo.h" -#include "raster/blend.h" -#include "raster/brush.h" -#include "raster/cel.h" -#include "raster/color.h" -#include "raster/color_scales.h" -#include "raster/dirty.h" -#include "raster/frame_number.h" -#include "raster/image.h" -#include "raster/image_bits.h" -#include "raster/layer.h" -#include "raster/mask.h" -#include "raster/object.h" -#include "raster/palette.h" -#include "raster/pixel_format.h" -#include "raster/primitives.h" -#include "raster/primitives_fast.h" -#include "raster/quantization.h" -#include "raster/rgbmap.h" -#include "raster/rotate.h" -#include "raster/sprite.h" -#include "raster/stock.h" - -#endif diff --git a/src/raster/rgbmap.h b/src/raster/rgbmap.h deleted file mode 100644 index 273f561f6..000000000 --- a/src/raster/rgbmap.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_RGBMAP_H_INCLUDED -#define RASTER_RGBMAP_H_INCLUDED -#pragma once - -#include "base/disable_copying.h" -#include "raster/object.h" - -#include - -namespace raster { - - class Palette; - - class RgbMap : public Object { - public: - RgbMap(); - - bool match(const Palette* palette) const; - void regenerate(const Palette* palette, int mask_index); - - int mapColor(int r, int g, int b) const; - - private: - std::vector m_map; - const Palette* m_palette; - int m_modifications; - - DISABLE_COPYING(RgbMap); - }; - -} // namespace raster - -#endif diff --git a/src/raster/rotate.h b/src/raster/rotate.h deleted file mode 100644 index 52eb78d27..000000000 --- a/src/raster/rotate.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_ROTATE_H_INCLUDED -#define RASTER_ROTATE_H_INCLUDED -#pragma once - -namespace raster { - - class Image; - - void image_scale(Image* dst, Image* src, - int x, int y, int w, int h); - - void image_rotate(Image* dst, Image* src, - int x, int y, int w, int h, - int cx, int cy, double angle); - - void image_parallelogram(Image* bmp, Image* sprite, - int x1, int y1, int x2, int y2, - int x3, int y3, int x4, int y4); - -} // namespace raster - -#endif diff --git a/src/raster/rotsprite.h b/src/raster/rotsprite.h deleted file mode 100644 index 319e44294..000000000 --- a/src/raster/rotsprite.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_ROTSPRITE_H_INCLUDED -#define RASTER_ROTSPRITE_H_INCLUDED -#pragma once - -namespace raster { - class Image; - - void image_rotsprite(Image* bmp, Image* spr, - int x1, int y1, int x2, int y2, - int x3, int y3, int x4, int y4); - -} // namespace raster - -#endif diff --git a/src/raster/sprite.h b/src/raster/sprite.h deleted file mode 100644 index e537554be..000000000 --- a/src/raster/sprite.h +++ /dev/null @@ -1,171 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2014 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_SPRITE_H_INCLUDED -#define RASTER_SPRITE_H_INCLUDED -#pragma once - -#include "base/disable_copying.h" -#include "raster/color.h" -#include "raster/frame_number.h" -#include "raster/layer_index.h" -#include "raster/object.h" -#include "raster/pixel_format.h" -#include "raster/sprite_position.h" - -#include - -namespace raster { - - class Image; - class Layer; - class LayerFolder; - class LayerImage; - class Mask; - class Palette; - class Path; - class Stock; - class Sprite; - class RgbMap; - - typedef std::vector PalettesList; - - // The main structure used in the whole program to handle a sprite. - class Sprite : public Object { - public: - - //////////////////////////////////////// - // Constructors/Destructor - - Sprite(PixelFormat format, int width, int height, int ncolors); - virtual ~Sprite(); - - static Sprite* createBasicSprite(PixelFormat format, int width, int height, int ncolors); - - //////////////////////////////////////// - // Main properties - - PixelFormat pixelFormat() const { return m_format; } - void setPixelFormat(PixelFormat format); - - int width() const { return m_width; } - int height() const { return m_height; } - void setSize(int width, int height); - - // Returns true if the rendered images will contain alpha values less - // than 255. Only RGBA and Grayscale images without background needs - // alpha channel in the render. - bool needAlpha() const; - bool supportAlpha() const; - - color_t transparentColor() const { return m_transparentColor; } - void setTransparentColor(color_t color); - - int getMemSize() const; - - //////////////////////////////////////// - // Layers - - LayerFolder* folder() const; - LayerImage* backgroundLayer() const; - - LayerIndex countLayers() const; - - Layer* indexToLayer(LayerIndex index) const; - LayerIndex layerToIndex(const Layer* layer) const; - - void getLayersList(std::vector& layers) const; - - //////////////////////////////////////// - // Palettes - - Palette* getPalette(FrameNumber frame) const; - const PalettesList& getPalettes() const; - - void setPalette(const Palette* pal, bool truncate); - - // Removes all palettes from the sprites except the first one. - void resetPalettes(); - - void deletePalette(Palette* pal); - - RgbMap* getRgbMap(FrameNumber frame); - - //////////////////////////////////////// - // Frames - - FrameNumber totalFrames() const { return m_frames; } - FrameNumber lastFrame() const { return m_frames.previous(); } - - void addFrame(FrameNumber newFrame); - void removeFrame(FrameNumber newFrame); - void setTotalFrames(FrameNumber frames); - - int getFrameDuration(FrameNumber frame) const; - void setFrameDuration(FrameNumber frame, int msecs); - void setFrameRangeDuration(FrameNumber from, FrameNumber to, int msecs); - void setDurationForAllFrames(int msecs); - - //////////////////////////////////////// - // Images - - Stock* stock() const; - - void getCels(CelList& cels) const; - - // Returns the how many cels are referencing the given imageIndex. - size_t getImageRefs(int imageIndex) const; - - void remapImages(FrameNumber frameFrom, FrameNumber frameTo, const std::vector& mapping); - - // Draws the sprite in the given image at the given position. Before - // drawing the sprite, this function clears (with the sprite's - // background color) the rectangle area that will occupy the drawn - // sprite. - void render(Image* image, int x, int y, FrameNumber frame) const; - - // Gets a pixel from the sprite in the specified position. If in the - // specified coordinates there're background this routine will - // return the 0 color (the mask-color). - int getPixel(int x, int y, FrameNumber frame) const; - - private: - Sprite* m_self; // pointer to the Sprite - PixelFormat m_format; // pixel format - int m_width; // image width (in pixels) - int m_height; // image height (in pixels) - FrameNumber m_frames; // how many frames has this sprite - std::vector m_frlens; // duration per frame - PalettesList m_palettes; // list of palettes - Stock* m_stock; // stock to get images - LayerFolder* m_folder; // main folder of layers - - // Current rgb map - RgbMap* m_rgbMap; - - // Transparent color used in indexed images - color_t m_transparentColor; - - // Disable default constructor and copying - Sprite(); - DISABLE_COPYING(Sprite); - }; - -} // namespace raster - -#endif diff --git a/src/raster/sprite_position.h b/src/raster/sprite_position.h deleted file mode 100644 index e15f67b50..000000000 --- a/src/raster/sprite_position.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Aseprite - * Copyright (C) 2001-2013 David Capello - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RASTER_SPRITE_POSITION_H_INCLUDED -#define RASTER_SPRITE_POSITION_H_INCLUDED -#pragma once - -#include "raster/frame_number.h" -#include "raster/layer_index.h" - -namespace raster { - - class Sprite; - - class SpritePosition { - public: - SpritePosition() { } - SpritePosition(LayerIndex layerIndex, FrameNumber frameNumber) - : m_layerIndex(layerIndex) - , m_frameNumber(frameNumber) { - } - - const LayerIndex& layerIndex() const { return m_layerIndex; } - const FrameNumber& frameNumber() const { return m_frameNumber; } - - void layerIndex(LayerIndex layerIndex) { m_layerIndex = layerIndex; } - void frameNumber(FrameNumber frameNumber) { m_frameNumber = frameNumber; } - - bool operator==(const SpritePosition& o) const { return m_layerIndex == o.m_layerIndex && m_frameNumber == o.m_frameNumber; } - bool operator!=(const SpritePosition& o) const { return m_layerIndex != o.m_layerIndex || m_frameNumber != o.m_frameNumber; } - - private: - LayerIndex m_layerIndex; - FrameNumber m_frameNumber; - }; - -} // namespace raster - -#endif