[nostalgia] Start on new TileSheetEditor

This commit is contained in:
2021-12-17 20:57:56 -06:00
parent ed074d07be
commit 775008a513
122 changed files with 651 additions and 2592 deletions
+7 -12
View File
@@ -1,9 +1,5 @@
/*
* Copyright 2016 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <QColor>
@@ -16,9 +12,8 @@
namespace nostalgia::core {
namespace {
[[nodiscard]] uint16_t toGbaColor(QColor c) {
[[nodiscard]]
static uint16_t toGbaColor(QColor c) {
const auto r = static_cast<uint32_t>(c.red()) >> 3;
const auto g = static_cast<uint32_t>(c.green()) >> 3;
const auto b = static_cast<uint32_t>(c.blue()) >> 3;
@@ -26,9 +21,8 @@ namespace {
return (a << 15) | (r << 10) | (g << 5) | (b << 0);
}
}
[[nodiscard]] static int countColors(const QImage &img, int argTiles) {
[[nodiscard]]
static int countColors(const QImage &img, int argTiles) {
QMap<QRgb, bool> colors;
// copy pixels as color ids
for (int x = 0; x < img.width(); x++) {
@@ -46,7 +40,8 @@ namespace {
return colors.size();
}
[[nodiscard]] std::unique_ptr<core::NostalgiaGraphic> imgToNg(QString argSrc, int argBpp) {
[[nodiscard]]
ox::UniquePtr<core::NostalgiaGraphic> imgToNg(QString argSrc, int argBpp) {
QImage src(argSrc);
if (src.isNull()) {