mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +00:00
Merge branch 'dev'
This commit is contained in:
commit
347e5f941f
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- ASE menus, tools and keyboard shortcuts -->
|
||||
<gui version="1.0.0-dev">
|
||||
<gui version="1.0.1-dev">
|
||||
<!-- Keyboard shortcuts -->
|
||||
<keyboard>
|
||||
|
||||
|
@ -234,7 +234,6 @@ add_library(app-lib
|
||||
undoers/set_sprite_pixel_format.cpp
|
||||
undoers/set_sprite_size.cpp
|
||||
undoers/set_sprite_transparent_color.cpp
|
||||
undoers/set_stock_pixel_format.cpp
|
||||
undoers/set_total_frames.cpp
|
||||
util/autocrop.cpp
|
||||
util/boundary.cpp
|
||||
|
@ -86,24 +86,25 @@ void MergeDownLayerCommand::onExecute(Context* context)
|
||||
UndoTransaction undo(writer.context(), "Merge Down Layer", undo::ModifyDocument);
|
||||
Layer* src_layer = writer.layer();
|
||||
Layer* dst_layer = src_layer->getPrevious();
|
||||
Cel *src_cel, *dst_cel;
|
||||
Image *src_image;
|
||||
base::UniquePtr<Image> dst_image;
|
||||
int index;
|
||||
|
||||
for (FrameNumber frpos(0); frpos<sprite->getTotalFrames(); ++frpos) {
|
||||
// Get frames
|
||||
src_cel = static_cast<LayerImage*>(src_layer)->getCel(frpos);
|
||||
dst_cel = static_cast<LayerImage*>(dst_layer)->getCel(frpos);
|
||||
Cel* src_cel = static_cast<LayerImage*>(src_layer)->getCel(frpos);
|
||||
Cel* dst_cel = static_cast<LayerImage*>(dst_layer)->getCel(frpos);
|
||||
|
||||
// Get images
|
||||
Image* src_image;
|
||||
if (src_cel != NULL)
|
||||
src_image = sprite->getStock()->getImage(src_cel->getImage());
|
||||
else
|
||||
src_image = NULL;
|
||||
|
||||
Image* dst_image;
|
||||
if (dst_cel != NULL)
|
||||
dst_image.reset(sprite->getStock()->getImage(dst_cel->getImage()));
|
||||
dst_image = sprite->getStock()->getImage(dst_cel->getImage());
|
||||
else
|
||||
dst_image = NULL;
|
||||
|
||||
// With source image?
|
||||
if (src_image != NULL) {
|
||||
@ -112,10 +113,10 @@ void MergeDownLayerCommand::onExecute(Context* context)
|
||||
// Copy this cel to the destination layer...
|
||||
|
||||
// Creating a copy of the image
|
||||
dst_image.reset(Image::createCopy(src_image));
|
||||
dst_image = Image::createCopy(src_image);
|
||||
|
||||
// Adding it in the stock of images
|
||||
index = sprite->getStock()->addImage(dst_image.release());
|
||||
index = sprite->getStock()->addImage(dst_image);
|
||||
if (undo.isEnabled())
|
||||
undo.pushUndoer(new undoers::AddImage(
|
||||
undo.getObjects(), sprite->getStock(), index));
|
||||
@ -133,7 +134,6 @@ void MergeDownLayerCommand::onExecute(Context* context)
|
||||
// With destination
|
||||
else {
|
||||
int x1, y1, x2, y2;
|
||||
Image *new_image;
|
||||
|
||||
// Merge down in the background layer
|
||||
if (dst_layer->isBackground()) {
|
||||
@ -152,10 +152,10 @@ void MergeDownLayerCommand::onExecute(Context* context)
|
||||
|
||||
raster::color_t bgcolor = app_get_color_to_clear_layer(dst_layer);
|
||||
|
||||
new_image = raster::crop_image(dst_image,
|
||||
x1-dst_cel->getX(),
|
||||
y1-dst_cel->getY(),
|
||||
x2-x1+1, y2-y1+1, bgcolor);
|
||||
Image* new_image = raster::crop_image(dst_image,
|
||||
x1-dst_cel->getX(),
|
||||
y1-dst_cel->getY(),
|
||||
x2-x1+1, y2-y1+1, bgcolor);
|
||||
|
||||
// Merge src_image in new_image
|
||||
raster::composite_image(new_image, src_image,
|
||||
@ -174,6 +174,7 @@ void MergeDownLayerCommand::onExecute(Context* context)
|
||||
sprite->getStock(), dst_cel->getImage()));
|
||||
|
||||
sprite->getStock()->replaceImage(dst_cel->getImage(), new_image);
|
||||
delete dst_image;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,6 @@
|
||||
#include "app/undoers/set_sprite_pixel_format.h"
|
||||
#include "app/undoers/set_sprite_size.h"
|
||||
#include "app/undoers/set_sprite_transparent_color.h"
|
||||
#include "app/undoers/set_stock_pixel_format.h"
|
||||
#include "app/undoers/set_total_frames.h"
|
||||
#include "base/unique_ptr.h"
|
||||
#include "raster/algorithm/flip_image.h"
|
||||
@ -161,12 +160,6 @@ void DocumentApi::setPixelFormat(Sprite* sprite, PixelFormat newFormat, Ditherin
|
||||
if (sprite->getPixelFormat() == newFormat)
|
||||
return;
|
||||
|
||||
// Change pixel format of the stock of images.
|
||||
if (undoEnabled())
|
||||
m_undoers->pushUndoer(new undoers::SetStockPixelFormat(getObjects(), sprite->getStock()));
|
||||
|
||||
sprite->getStock()->setPixelFormat(newFormat);
|
||||
|
||||
// TODO Review this, why we use the palette in frame 0?
|
||||
FrameNumber frame(0);
|
||||
|
||||
|
@ -1,57 +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 "app/undoers/set_stock_pixel_format.h"
|
||||
|
||||
#include "raster/stock.h"
|
||||
#include "undo/objects_container.h"
|
||||
#include "undo/undoers_collector.h"
|
||||
|
||||
namespace app {
|
||||
namespace undoers {
|
||||
|
||||
using namespace raster;
|
||||
using namespace undo;
|
||||
|
||||
SetStockPixelFormat::SetStockPixelFormat(ObjectsContainer* objects, Stock* stock)
|
||||
: m_stockId(objects->addObject(stock))
|
||||
, m_format(stock->getPixelFormat())
|
||||
{
|
||||
}
|
||||
|
||||
void SetStockPixelFormat::dispose()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
void SetStockPixelFormat::revert(ObjectsContainer* objects, UndoersCollector* redoers)
|
||||
{
|
||||
Stock* stock = objects->getObjectT<Stock>(m_stockId);
|
||||
|
||||
// Push another SetStockPixelFormat as redoer
|
||||
redoers->pushUndoer(new SetStockPixelFormat(objects, stock));
|
||||
|
||||
stock->setPixelFormat(static_cast<PixelFormat>(m_format));
|
||||
}
|
||||
|
||||
} // namespace undoers
|
||||
} // namespace app
|
@ -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 APP_UNDOERS_SET_STOCK_PIXEL_FORMAT_H_INCLUDED
|
||||
#define APP_UNDOERS_SET_STOCK_PIXEL_FORMAT_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "app/undoers/undoer_base.h"
|
||||
#include "undo/object_id.h"
|
||||
|
||||
namespace raster {
|
||||
class Stock;
|
||||
}
|
||||
|
||||
namespace app {
|
||||
namespace undoers {
|
||||
using namespace raster;
|
||||
using namespace undo;
|
||||
|
||||
class SetStockPixelFormat : public UndoerBase {
|
||||
public:
|
||||
SetStockPixelFormat(ObjectsContainer* objects, Stock* stock);
|
||||
|
||||
void dispose() OVERRIDE;
|
||||
size_t getMemSize() const OVERRIDE { return sizeof(*this); }
|
||||
void revert(ObjectsContainer* objects, UndoersCollector* redoers) OVERRIDE;
|
||||
|
||||
private:
|
||||
ObjectId m_stockId;
|
||||
uint32_t m_format;
|
||||
};
|
||||
|
||||
} // namespace undoers
|
||||
} // namespace app
|
||||
|
||||
#endif // UNDOERS_SET_STOCK_PIXEL_FORMAT_H_INCLUDED
|
@ -600,7 +600,7 @@ void RenderEngine::renderLayer(
|
||||
output_opacity = MID(0, cel->getOpacity(), 255);
|
||||
output_opacity = INT_MULT(output_opacity, global_opacity, t);
|
||||
|
||||
src_image->setMaskColor(m_sprite->getTransparentColor());
|
||||
ASSERT(src_image->getMaskColor() == m_sprite->getTransparentColor());
|
||||
|
||||
(*zoomed_func)(image, src_image, m_sprite->getPalette(frame),
|
||||
(cel->getX() << zoom) - source_x,
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
// General information
|
||||
#define PACKAGE "Aseprite"
|
||||
#define VERSION "1.0.0-dev"
|
||||
#define VERSION "1.0.1-dev"
|
||||
#ifdef CUSTOM_WEBSITE_URL
|
||||
#define WEBSITE CUSTOM_WEBSITE_URL // To test web server
|
||||
#else
|
||||
|
@ -1,8 +1,8 @@
|
||||
allegro_icon ICON data/icons/ase.ico
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 1,0,0,0
|
||||
PRODUCTVERSION 1,0,0,0
|
||||
FILEVERSION 1,0,1,0
|
||||
PRODUCTVERSION 1,0,1,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -19,12 +19,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "Comments", "http://aseprite.org/"
|
||||
VALUE "FileDescription", "Aseprite - Animated sprites editor & pixel art tool"
|
||||
VALUE "FileVersion", "1,0,0,0"
|
||||
VALUE "FileVersion", "1,0,1,0"
|
||||
VALUE "InternalName", "aseprite"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2001-2014 by David Capello"
|
||||
VALUE "OriginalFilename", "aseprite.exe"
|
||||
VALUE "ProductName", "ASEPRITE"
|
||||
VALUE "ProductVersion", "1,0,0,0"
|
||||
VALUE "ProductVersion", "1,0,1,0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -325,7 +325,7 @@ void layer_render(const Layer* layer, Image* image, int x, int y, FrameNumber fr
|
||||
src_image = layer->getSprite()->getStock()->getImage(cel->getImage());
|
||||
ASSERT(src_image != NULL);
|
||||
|
||||
src_image->setMaskColor(layer->getSprite()->getTransparentColor());
|
||||
ASSERT(src_image->getMaskColor() == layer->getSprite()->getTransparentColor());
|
||||
|
||||
composite_image(image, src_image,
|
||||
cel->getX() + x,
|
||||
|
@ -50,7 +50,7 @@ Sprite::Sprite(PixelFormat format, int width, int height, int ncolors)
|
||||
ASSERT(width > 0 && height > 0);
|
||||
|
||||
m_frlens.push_back(100); // First frame with 100 msecs of duration
|
||||
m_stock = new Stock(format);
|
||||
m_stock = new Stock(this, format);
|
||||
m_folder = new LayerFolder(this);
|
||||
|
||||
// Generate palette
|
||||
@ -136,6 +136,7 @@ void Sprite::setTransparentColor(color_t color)
|
||||
{
|
||||
m_transparentColor = color;
|
||||
|
||||
// Change the mask color of all images.
|
||||
for (int i=0; i<m_stock->size(); i++) {
|
||||
Image* image = m_stock->getImage(i);
|
||||
if (image != NULL)
|
||||
|
@ -23,44 +23,21 @@
|
||||
#include "raster/stock.h"
|
||||
|
||||
#include "raster/image.h"
|
||||
#include "raster/sprite.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace raster {
|
||||
|
||||
Stock::Stock(PixelFormat format)
|
||||
Stock::Stock(Sprite* sprite, PixelFormat format)
|
||||
: Object(OBJECT_STOCK)
|
||||
, m_sprite(sprite)
|
||||
, m_format(format)
|
||||
{
|
||||
// Image with index=0 is always NULL.
|
||||
m_image.push_back(NULL);
|
||||
}
|
||||
|
||||
Stock::Stock(const Stock& stock)
|
||||
: Object(stock)
|
||||
, m_format(stock.getPixelFormat())
|
||||
{
|
||||
try {
|
||||
for (int i=0; i<stock.size(); ++i) {
|
||||
if (!stock.getImage(i))
|
||||
addImage(NULL);
|
||||
else {
|
||||
Image* image_copy = Image::createCopy(stock.getImage(i));
|
||||
addImage(image_copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
for (int i=0; i<size(); ++i) {
|
||||
if (getImage(i))
|
||||
delete getImage(i);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
|
||||
ASSERT(size() == stock.size());
|
||||
}
|
||||
|
||||
Stock::~Stock()
|
||||
{
|
||||
for (int i=0; i<size(); ++i) {
|
||||
@ -69,14 +46,9 @@ Stock::~Stock()
|
||||
}
|
||||
}
|
||||
|
||||
PixelFormat Stock::getPixelFormat() const
|
||||
Sprite* Stock::getSprite() const
|
||||
{
|
||||
return m_format;
|
||||
}
|
||||
|
||||
void Stock::setPixelFormat(PixelFormat pixelFormat)
|
||||
{
|
||||
m_format = pixelFormat;
|
||||
return m_sprite;
|
||||
}
|
||||
|
||||
Image* Stock::getImage(int index) const
|
||||
@ -97,6 +69,8 @@ int Stock::addImage(Image* image)
|
||||
throw;
|
||||
}
|
||||
m_image[i] = image;
|
||||
|
||||
fixupImage(image);
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -115,6 +89,15 @@ void Stock::replaceImage(int index, Image* image)
|
||||
{
|
||||
ASSERT((index > 0) && (index < size()));
|
||||
m_image[index] = image;
|
||||
|
||||
fixupImage(image);
|
||||
}
|
||||
|
||||
void Stock::fixupImage(Image* image)
|
||||
{
|
||||
// Change the mask color of the added image to the sprite mask color.
|
||||
if (image)
|
||||
image->setMaskColor(m_sprite->getTransparentColor());
|
||||
}
|
||||
|
||||
} // namespace raster
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define RASTER_STOCK_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "base/disable_copying.h"
|
||||
#include "raster/object.h"
|
||||
#include "raster/pixel_format.h"
|
||||
|
||||
@ -28,17 +29,16 @@
|
||||
namespace raster {
|
||||
|
||||
class Image;
|
||||
class Sprite;
|
||||
|
||||
typedef std::vector<Image*> ImagesList;
|
||||
|
||||
class Stock : public Object {
|
||||
public:
|
||||
Stock(PixelFormat format);
|
||||
Stock(const Stock& stock);
|
||||
Stock(Sprite* sprite, PixelFormat format);
|
||||
virtual ~Stock();
|
||||
|
||||
PixelFormat getPixelFormat() const;
|
||||
void setPixelFormat(PixelFormat format);
|
||||
Sprite* getSprite() const;
|
||||
|
||||
// Returns the number of image in the stock.
|
||||
int size() const {
|
||||
@ -66,9 +66,15 @@ namespace raster {
|
||||
//
|
||||
void replaceImage(int index, Image* image);
|
||||
|
||||
//private: TODO uncomment this line
|
||||
private:
|
||||
void fixupImage(Image* image);
|
||||
|
||||
PixelFormat m_format; // Type of images (all images in the stock must be of this type).
|
||||
ImagesList m_image; // The images-array where the images are.
|
||||
Sprite* m_sprite;
|
||||
|
||||
Stock();
|
||||
DISABLE_COPYING(Stock);
|
||||
};
|
||||
|
||||
} // namespace raster
|
||||
|
Loading…
x
Reference in New Issue
Block a user