mirror of https://github.com/aseprite/aseprite.git
Compare commits
4 Commits
de85332a9a
...
0b302fdeff
| Author | SHA1 | Date |
|---|---|---|
|
|
0b302fdeff | |
|
|
577caa4793 | |
|
|
f3a372e78e | |
|
|
5afa9e6b82 |
|
|
@ -1,5 +1,5 @@
|
||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2024 Igara Studio S.A.
|
// Copyright (C) 2019-2025 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
|
|
@ -104,7 +104,7 @@ void ColorPicker::pickColor(const Site& site,
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
// Pick from the composed image
|
// Pick from the composed image
|
||||||
case FromComposition: {
|
case FromComposition: {
|
||||||
doc::RenderPlan plan(pref.experimental.composeGroups());
|
doc::RenderPlan plan;
|
||||||
plan.addLayer(sprite->root(), site.frame());
|
plan.addLayer(sprite->root(), site.frame());
|
||||||
|
|
||||||
doc::CelList cels;
|
doc::CelList cels;
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@
|
||||||
#include "base/scoped_value.h"
|
#include "base/scoped_value.h"
|
||||||
#include "doc/doc.h"
|
#include "doc/doc.h"
|
||||||
#include "doc/mask_boundaries.h"
|
#include "doc/mask_boundaries.h"
|
||||||
|
#include "doc/render_plan.h"
|
||||||
#include "doc/slice.h"
|
#include "doc/slice.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
#include "os/color_space.h"
|
#include "os/color_space.h"
|
||||||
|
|
@ -3097,13 +3098,16 @@ void Editor::updateAutoCelGuides(ui::Message* msg)
|
||||||
// tool to show automatic guides.
|
// tool to show automatic guides.
|
||||||
if (m_showAutoCelGuides && m_state->allowLayerEdges()) {
|
if (m_showAutoCelGuides && m_state->allowLayerEdges()) {
|
||||||
auto mouseMsg = dynamic_cast<ui::MouseMessage*>(msg);
|
auto mouseMsg = dynamic_cast<ui::MouseMessage*>(msg);
|
||||||
|
doc::RenderPlan plan;
|
||||||
ColorPicker picker;
|
Sprite* sprite = getSite().sprite();
|
||||||
picker.pickColor(getSite(),
|
plan.addLayer(sprite->root(), getSite().frame());
|
||||||
screenToEditorF(mouseMsg ? mouseMsg->position() : mousePosInDisplay()),
|
doc::CelList cels;
|
||||||
m_proj,
|
sprite->pickCels(screenToEditorF(mouseMsg ? mouseMsg->position() : mousePosInDisplay()),
|
||||||
ColorPicker::FromComposition);
|
1,
|
||||||
m_showGuidesThisCel = (picker.layer() ? picker.layer()->cel(m_frame) : nullptr);
|
plan,
|
||||||
|
cels);
|
||||||
|
m_showGuidesThisCel =
|
||||||
|
((!cels.empty() && cels.front()->layer()) ? cels.front()->layer()->cel(m_frame) : nullptr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_showGuidesThisCel = nullptr;
|
m_showGuidesThisCel = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/layer_tilemap.h"
|
#include "doc/layer_tilemap.h"
|
||||||
#include "doc/mask.h"
|
#include "doc/mask.h"
|
||||||
|
#include "doc/render_plan.h"
|
||||||
#include "doc/slice.h"
|
#include "doc/slice.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
|
@ -153,16 +154,15 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
|
||||||
// Handle "Auto Select Layer"
|
// Handle "Auto Select Layer"
|
||||||
if (editor->isAutoSelectLayer()) {
|
if (editor->isAutoSelectLayer()) {
|
||||||
gfx::PointF cursor = editor->screenToEditorF(msg->position());
|
gfx::PointF cursor = editor->screenToEditorF(msg->position());
|
||||||
ColorPicker picker;
|
RenderPlan plan;
|
||||||
picker.pickColor(site, cursor, editor->projection(), ColorPicker::FromComposition);
|
plan.addLayer(site.sprite()->root(), site.frame());
|
||||||
|
doc::CelList cels;
|
||||||
|
site.sprite()->pickCels(cursor, 1, plan, cels);
|
||||||
|
|
||||||
const view::RealRange& range = context->range();
|
const view::RealRange& range = context->range();
|
||||||
if (picker.layer() && !range.contains(picker.layer())) {
|
if (!cels.empty() && cels.front()->layer() && !range.contains(cels.front()->layer())) {
|
||||||
layer = picker.layer();
|
editor->setLayer(cels.front()->layer());
|
||||||
if (layer) {
|
editor->flashCurrentLayer();
|
||||||
editor->setLayer(layer);
|
|
||||||
editor->flashCurrentLayer();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4631,13 +4631,13 @@ void Timeline::onDrop(ui::DragEvent& e)
|
||||||
std::string txmsg;
|
std::string txmsg;
|
||||||
std::unique_ptr<docapi::DocProvider> docProvider = nullptr;
|
std::unique_ptr<docapi::DocProvider> docProvider = nullptr;
|
||||||
if (droppedImage) {
|
if (droppedImage) {
|
||||||
txmsg = "Dropped image on timeline";
|
txmsg = "Drop Image";
|
||||||
doc::ImageRef image = nullptr;
|
doc::ImageRef image = nullptr;
|
||||||
convert_surface_to_image(surface.get(), 0, 0, surface->width(), surface->height(), image);
|
convert_surface_to_image(surface.get(), 0, 0, surface->width(), surface->height(), image);
|
||||||
docProvider = std::make_unique<DocProviderFromImage>(image);
|
docProvider = std::make_unique<DocProviderFromImage>(image);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
txmsg = "Dropped paths on timeline";
|
txmsg = "Drop File";
|
||||||
docProvider = std::make_unique<DocProviderFromPaths>(m_document->context(), paths);
|
docProvider = std::make_unique<DocProviderFromPaths>(m_document->context(), paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (c) 2024 Igara Studio S.A.
|
// Copyright (c) 2024-2025 Igara Studio S.A.
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
@ -26,7 +26,7 @@ uint32_t convert_color_to_image(gfx::Color c, const os::SurfaceFormatData* fd)
|
||||||
uint8_t b = ((c & fd->blueMask) >> fd->blueShift);
|
uint8_t b = ((c & fd->blueMask) >> fd->blueShift);
|
||||||
uint8_t a = ((c & fd->alphaMask) >> fd->alphaShift);
|
uint8_t a = ((c & fd->alphaMask) >> fd->alphaShift);
|
||||||
|
|
||||||
if (fd->pixelAlpha == os::PixelAlpha::kPremultiplied) {
|
if (a > 0 && fd->pixelAlpha == os::PixelAlpha::kPremultiplied) {
|
||||||
r = r * 255 / a;
|
r = r * 255 / a;
|
||||||
g = g * 255 / a;
|
g = g * 255 / a;
|
||||||
b = b * 255 / a;
|
b = b * 255 / a;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue