mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-28 16:11:35 +00:00
Remove raster::Palette <-> Allegro PALETTE conversion routines
This commit is contained in:
parent
0defe27dc6
commit
d71fb000a0
@ -23,12 +23,10 @@
|
|||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
#include "app/modules/palettes.h"
|
#include "app/modules/palettes.h"
|
||||||
#include "raster/blend.h"
|
#include "raster/blend.h"
|
||||||
#include "raster/conversion_alleg.h"
|
|
||||||
#include "raster/image.h"
|
#include "raster/image.h"
|
||||||
#include "raster/palette.h"
|
#include "raster/palette.h"
|
||||||
#include "raster/sprite.h"
|
#include "raster/sprite.h"
|
||||||
|
|
||||||
#include <allegro.h>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
@ -47,11 +45,7 @@ static Palette* ase_current_palette = NULL;
|
|||||||
int init_module_palette()
|
int init_module_palette()
|
||||||
{
|
{
|
||||||
ase_default_palette = new Palette(FrameNumber(0), 256);
|
ase_default_palette = new Palette(FrameNumber(0), 256);
|
||||||
convert_palette_from_allegro(default_palette, ase_default_palette);
|
|
||||||
|
|
||||||
ase_current_palette = new Palette(FrameNumber(0), 256);
|
ase_current_palette = new Palette(FrameNumber(0), 256);
|
||||||
convert_palette_from_allegro(black_palette, ase_current_palette);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,11 +87,6 @@ bool set_current_palette(const Palette *_palette, bool forced)
|
|||||||
// Copy current palette
|
// Copy current palette
|
||||||
palette->copyColorsTo(ase_current_palette);
|
palette->copyColorsTo(ase_current_palette);
|
||||||
|
|
||||||
// Change system color palette
|
|
||||||
PALETTE allegPal;
|
|
||||||
convert_palette_to_allegro(palette, allegPal);
|
|
||||||
set_palette(allegPal);
|
|
||||||
|
|
||||||
// Call slots in signals
|
// Call slots in signals
|
||||||
App::instance()->PaletteChange();
|
App::instance()->PaletteChange();
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ add_library(raster-lib
|
|||||||
cel.cpp
|
cel.cpp
|
||||||
cel_io.cpp
|
cel_io.cpp
|
||||||
color_scales.cpp
|
color_scales.cpp
|
||||||
conversion_alleg.cpp
|
|
||||||
conversion_she.cpp
|
conversion_she.cpp
|
||||||
dirty.cpp
|
dirty.cpp
|
||||||
dirty_io.cpp
|
dirty_io.cpp
|
||||||
|
@ -1,61 +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/conversion_alleg.h"
|
|
||||||
|
|
||||||
#include "raster/algo.h"
|
|
||||||
#include "raster/blend.h"
|
|
||||||
#include "raster/color_scales.h"
|
|
||||||
#include "raster/palette.h"
|
|
||||||
#include "raster/rgbmap.h"
|
|
||||||
|
|
||||||
#include <allegro.h>
|
|
||||||
|
|
||||||
namespace raster {
|
|
||||||
|
|
||||||
void convert_palette_to_allegro(const Palette* palette, RGB* rgb)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i=0; i<palette->size(); ++i) {
|
|
||||||
color_t c = palette->getEntry(i);
|
|
||||||
rgb[i].r = rgba_getr(c) / 4;
|
|
||||||
rgb[i].g = rgba_getg(c) / 4;
|
|
||||||
rgb[i].b = rgba_getb(c) / 4;
|
|
||||||
}
|
|
||||||
for (; i<Palette::MaxColors; ++i) {
|
|
||||||
rgb[i].r = 0;
|
|
||||||
rgb[i].g = 0;
|
|
||||||
rgb[i].b = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void convert_palette_from_allegro(const RGB* rgb, Palette* palette)
|
|
||||||
{
|
|
||||||
palette->resize(Palette::MaxColors);
|
|
||||||
for (int i=0; i<Palette::MaxColors; ++i) {
|
|
||||||
palette->setEntry(i, rgba(scale_6bits_to_8bits(rgb[i].r),
|
|
||||||
scale_6bits_to_8bits(rgb[i].g),
|
|
||||||
scale_6bits_to_8bits(rgb[i].b), 255));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace raster
|
|
@ -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_CONVERSION_ALLEG_H_INCLUDED
|
|
||||||
#define RASTER_CONVERSION_ALLEG_H_INCLUDED
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <allegro/color.h>
|
|
||||||
|
|
||||||
namespace raster {
|
|
||||||
class Palette;
|
|
||||||
|
|
||||||
void convert_palette_to_allegro(const Palette* palette, RGB* rgb);
|
|
||||||
void convert_palette_from_allegro(const RGB* rgb, Palette* palette);
|
|
||||||
|
|
||||||
} // namespace raster
|
|
||||||
|
|
||||||
#endif
|
|
@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include "gfx/hsv.h"
|
#include "gfx/hsv.h"
|
||||||
#include "gfx/rgb.h"
|
#include "gfx/rgb.h"
|
||||||
#include "raster/conversion_alleg.h"
|
|
||||||
#include "raster/image.h"
|
#include "raster/image.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user