Commit Graph

47 Commits

Author SHA1 Message Date
David Capello 271750129c Fix new possible crash in GifDecoder::getFrameColormap() 2015-07-31 12:25:33 -03:00
David Capello a6c24ac768 Create an optimized palette if GifDecoder generates a RGB image with more than 256 colors 2015-07-31 11:06:26 -03:00
David Capello cd1ca4c68f Try to use the global colormap in GifDecoder when possible 2015-07-31 10:53:51 -03:00
David Capello fba9213c9c Fix bug saving invalid .gif files when we use an indexed image with more than 256 colors 2015-07-30 18:46:56 -03:00
David Capello 4a1356cf78 Fix crash when the gif decoder cannot create the sprite 2015-07-30 17:12:53 -03:00
David Capello b35fc87ec1 Add progress bar when a palette is created from a RGB file 2015-07-22 18:26:25 -03:00
David Capello 96080a378c Remove frameNum from GifEncoder::writeLoopExtension() 2015-07-22 17:41:14 -03:00
David Capello e71fd36c24 Fix gif_format.cpp compilation on Linux and with giflib 4 2015-07-22 17:30:11 -03:00
David Capello 7f4d4936e1 Re-implement GIF encoder
- Correct usage of disposal methods (and possibility to generate records
  with "restore previous frame" disposal method)
- Create color maps for each frame when necessary
- Remove options to dither RGB images (to simplify encoder)
2015-07-22 16:40:44 -03:00
David Capello 65fe7dbccf A GIF color map cannot have more than 256 colors 2015-07-17 12:57:32 -03:00
David Capello ae2f04f855 Fix creation of local colormaps in GifFormat::onSave() 2015-07-17 12:45:59 -03:00
David Capello cb867b7f84 Re-implement GIF decoder to load some .gif files correctly (fix #729)
- Better palette creation depending on local colormaps
- Reuse palette colors from previous frames
- Use frame transparent index correctly
- Convert to RGB automatically if the image has more than 256 colors
- Remove onPostLoad()
- Add progress bar feedback
2015-07-17 12:26:11 -03:00
David Capello 065825c373 Change DisposalMethod type to enum class 2015-07-15 17:13:37 -03:00
David Capello 5036ffd738 Change the message to convert a GIF file to RGB on GifFormat::onPostLoad 2015-07-15 16:50:47 -03:00
David Capello 37478688c0 Fix problem loading gif files using subset of the original color map (fix #729)
There are gif files that use a subset of the original color map remapping
used entries into first indexes. E.g. the main palette contains 256 colors,
but then a frame can use 4-bit per pixel to reference 16 colors from the
original 256 color palette.
2015-07-15 15:42:54 -03:00
David Capello 008dceb55d Replace iterators with range-based loop in gif_format.cpp 2015-07-15 15:09:07 -03:00
David Capello b426171679 Add new_mask_color parameter to convert_pixel_format() function
When we converted an Indexed image to RGB, the original sprite
transparent color was being kept but the mask color of all its images
was reset to 0. With this change we kept the same mask color on all images
to avoid an assert() in the render code.

Anyway the whole RGB <-> Indexed conversion should be reviewed in these
cases. I think there are some situation where a transparent color = 0 is
expected in RGB sprites (as we shouldn't be able to change the transparent
color of an RGB sprite).
2015-07-14 09:44:31 -03:00
David Capello e9308c2d35 Add alpha channel in quantization (related to #286) 2015-07-02 11:18:43 -03:00
David Capello a2b3822730 Avoid unused variable warning in gif_format.cpp when we compile with giflib4 2015-06-09 10:37:19 -03:00
David Capello 65d03c9893 Add support to compile gif_format.cpp with giflib 4 2015-06-08 20:21:50 -03:00
David Capello a8577a4273 Rename Context::isUiAvailable to Context::isUIAvailable 2015-05-18 17:04:31 -03:00
David Capello 9fa26dc2f4 Fix problem saving transparent GIF and PNG files when the background layer is hidden 2015-04-21 13:20:36 -03:00
David Capello 22c3c4f20e Remove implicit SharedPtr conversion to T* 2015-04-02 20:42:43 -03:00
David Capello 3d63e0e1b4 Move SharedPtr to base namespace 2015-04-01 12:35:18 -03:00
David Capello 2c6067f7e4 Update license of app/ module to GPLv2 2015-02-12 12:16:25 -03:00
David Capello 3ebb708000 Add CelData to share image/position/opacity between linked cels
Changes:
- Merged app::cmd::ObjectIO into doc::SubObjectsIO
- Changed app::cmd::SetCelImage with app::cmd::SetCelData
- Added Cel::createCopy/Link() to avoid confunsion with Cel copy ctor
- Renamed Sprite::getImage() -> getImageRef()
- Added Sprite::getDataCelRef()
- Added doc::CelsRange helper to iterate cels
- Added Sprite::cels()/uniqueCels() member functions (removed
  Sprite::getCels())
- Added DocumentRange::convertToCels()
2015-02-09 11:40:43 -03:00
David Capello 06636fd16e Merge branch '1.0'
Conflicts:
	src/app/file/gif_format.cpp
	src/app/file/gif_options.h
	src/app/ui/editor/moving_cel_state.cpp
	src/app/ui/editor/standby_state.cpp
	src/app/util/range_utils.cpp
2015-01-29 12:18:13 -03:00
David Capello c4d0266b52 Add option to disable animation loop when saving GIF files (fix #585) 2015-01-29 11:24:43 -03:00
David Capello f1f24cbcdd Replace doc::Stock with doc::ImageRef shared pointer
Changes:
* Add doc::ImageRef to count references to the same image between Cels
  (at this moment we cannot generate linked cels anyway)
* Remove doc:Stock class and doc::Sprite::m_stock member variable
* Remove app::undoers::Add/RemoveImage
* Add doc::SubObjectsIO and app::undoers::ObjectIO to
  replace doc::LayerSubObjectsSerializer
2015-01-04 10:58:14 -03:00
David Capello 06d18f1e8a Replace doc::FrameNumber with doc::frame_t 2014-12-28 20:39:11 -03:00
David Capello da1358c5dc Unify all render code in one library
Changes:
* Create render library (move util/render.cpp to render/render.cpp)
* Move app::Zoom class to render::Zoom
* Remove doc::Image::merge() member function
* Add gfx::Clip helper class (to clip dst/src rectangles before a blit)
* Move doc::composite_image() to render::composite_image()
* Remove doc::Sprite::render()
* Replace Sprite::getPixel() with render::get_sprite_pixel()
* Remove doc::layer_render() function
* Convert DitheringMethod to a enum class
* Add AppRender to configure a render::Render with the app configuration
* Move checked background preferences as document-specific configuration
* Add doc::Sprite::layer() and palette() member functions
* Add doc::Layer::cel() member function
* Add doc::Palette::entry() member function()
* Add doc::frame_t type
* Move create_palette_from_rgb/convert_pixel_format to render library
* ExportSpriteSheet doesn't need a temporary image now that we can specify
  the source rectangle in the render routine
2014-12-28 11:06:11 -03:00
David Capello d176839bf4 Merge branch '1.0'
* In this branch the Alt+mnemonic issues are solved in "she" layer when the
  she::Event is generated (see src/she/alleg4/key_poller.cpp)
* Mouse cursor issues on OS X are solved in src/she/alleg4/mouse_poller.cpp

Conflicts:
	src/app/test_context.h
	src/ui/manager.cpp
2014-11-01 20:55:57 -03:00
David Capello 525fbd0d46 Don't add extra ASEPRITE block to .gif file because Photoshop cannot load them 2014-11-01 13:32:02 -03:00
David Capello 63995c6f0a Merge "raster" namespace into "doc" library 2014-10-20 22:21:31 -03:00
David Capello 6824570c4b Remove base/override.h (use override keyword directly) 2014-08-14 23:07:47 -03:00
David Capello d23fa2230b Implement option to generate one optimized palette for all frames when we save a .gif file 2014-08-09 12:51:11 -03:00
David Capello 91b0c2d071 Refactor: Remove "get" part for member functions that act like a simple getter
Additional change:
- Added Cel::image() to get the related image of the cel directly
2014-07-30 01:28:15 -03:00
David Capello 81ffb0c5bd Refactor: Create doc::Context and move some logic from app::Document to doc::Document
The objective of these changes is to create a more testable doc/logic API.

Included changes:
- Added doc::Context, doc::Documents (the old app::Documents),
  and doc::Sprites (and observers for each)
- Added raster::Sprite::createBasicSprite()
- Added doc::ColorMode (equal to raster::PixelFormat)
- Added some methods to doc::Document: context(), sprites(), sprite()
  (to replace app::Document::getSprite()), width/height(), colorMode(),
  name(), and close()
- Moved app::DocumentObserver/Event to doc::DocumentObserver/Event
- Replaced app::ContextObserver with doc::DocumentsObserver and a couple
  of signals.
- Renamed app::Context::getActiveDocument() with
  doc::Context::activeDocument()
- Renamed app::Context::getActiveLocation() with
  app::Context::activeLocation()
- Removed app::ContextObserverList
- Removed app::DocumentId (now we can use doc::ObjectId)
- Removed app::Context::getSettings()
2014-07-29 00:53:24 -03:00
David Capello 411ceda0e7 Add options to save GIF files (how to quantize palettes mainly)
* Added "context" parameter to save/load routines so we can test them.
2014-07-19 22:01:39 -03:00
David Capello 786ae48ffa Add ASEPRITE1.0 block to .gif files 2014-06-04 00:27:34 -03:00
David Capello df3b87c409 Update giflib to 5.1.0 2014-06-02 22:10:08 -03:00
David Capello 30af4e2620 Add trial-mode without save functionality 2014-04-10 00:33:28 -03:00
David Capello f2bdf38cc6 Fix bug loading/saving .gif files with Unicode file names 2014-02-17 21:43:20 -03:00
Joel Madigan dabcad1807 Add string::c_str() to several functions.
There were a number of places where a std::string was being used in a function calls that expected a c string.  These instances were trivally fixed by adding a call to string::c_str().

Note, I'm not sure if this is a GCC specific issue, however even if it is a case of MSVC simply letting these usages slide it can't hurt to be explicit.
2013-11-24 01:35:55 -05:00
David Capello e5ba8e0922 Encapsulate Image implementation (private members, accessors, iterators, etc.)
- Rename _rgba/_graya to raster::rgba()/graya()
- Add raster::color_t type (alias for uint32_t)
- Rename raster::GfxObj to Object. And GfxObj::getType() to Object::type()
- Move conversion from raster::Image/Palette to Allegro BITMAP/RGB
  to raster/conversion_alleg.h file
- Add raster/color_scales.h
- Rename image_* functions to raster/primitives.h
- Reimplement ink processing with templates instead of macros
2013-11-09 19:59:05 -03:00
David Capello cde54f3682 Change BSD license to MIT in sublibraries and fix headers 2013-08-08 21:01:20 -03:00
David Capello c88f9b172b Refactor: Move app files to src/app subdirectory inside app namespace
- Add HAVE_CONFIG_H wrapper to #include "config.h"
- Removed widgets namespace (it's in app now)
- Move some functions from src/file/file.h to src/base/cfile.h
- Move Vector2d to base library
- Rename MenuItem2 to AppMenuItem
2013-08-05 21:20:19 -03:00