mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 14:42:44 +00:00
Now the user can select mask color as foreground or background colors (e.g. now you can erase with right button using brush tool).
This commit is contained in:
parent
08cbfee5f0
commit
91b6233b48
@ -84,7 +84,6 @@ void EyedropperCommand::execute(Context* context)
|
|||||||
color_t color = color_from_image(sprite->getImgType(),
|
color_t color = color_from_image(sprite->getImgType(),
|
||||||
sprite->getPixel(x, y));
|
sprite->getPixel(x, y));
|
||||||
|
|
||||||
if (color_type(color) != COLOR_TYPE_MASK) {
|
|
||||||
// TODO replace the color in the "context", not directly from the color-bar
|
// TODO replace the color in the "context", not directly from the color-bar
|
||||||
|
|
||||||
// set the color of the color-bar
|
// set the color of the color-bar
|
||||||
@ -92,7 +91,6 @@ void EyedropperCommand::execute(Context* context)
|
|||||||
app_get_colorbar()->setBgColor(color);
|
app_get_colorbar()->setBgColor(color);
|
||||||
else
|
else
|
||||||
app_get_colorbar()->setFgColor(color);
|
app_get_colorbar()->setFgColor(color);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
@ -430,7 +430,11 @@ void draw_color(BITMAP* bmp, const Rect& rc, int imgtype, color_t color)
|
|||||||
int data;
|
int data;
|
||||||
BITMAP* graph;
|
BITMAP* graph;
|
||||||
|
|
||||||
if (type == COLOR_TYPE_INDEX) {
|
if (type == COLOR_TYPE_MASK) {
|
||||||
|
rectgrid(bmp, rc.x, rc.y, rc.x+rc.w-1, rc.y+rc.h-1, rc.w/4, rc.h/2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (type == COLOR_TYPE_INDEX) {
|
||||||
int index = color_get_index(color);
|
int index = color_get_index(color);
|
||||||
|
|
||||||
if (index >= 0 && index < get_current_palette()->size()) {
|
if (index >= 0 && index < get_current_palette()->size()) {
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "core/color.h"
|
#include "core/color.h"
|
||||||
#include "modules/editors.h"
|
#include "modules/editors.h"
|
||||||
#include "raster/image.h"
|
#include "raster/image.h"
|
||||||
|
#include "raster/layer.h"
|
||||||
#include "raster/pen.h"
|
#include "raster/pen.h"
|
||||||
#include "raster/sprite.h"
|
#include "raster/sprite.h"
|
||||||
#include "tools/tool.h"
|
#include "tools/tool.h"
|
||||||
@ -230,6 +231,7 @@ void Editor::editor_cursor_exit()
|
|||||||
void Editor::editor_draw_cursor(int x, int y, bool refresh)
|
void Editor::editor_draw_cursor(int x, int y, bool refresh)
|
||||||
{
|
{
|
||||||
assert(m_cursor_thick == 0);
|
assert(m_cursor_thick == 0);
|
||||||
|
assert(m_sprite != NULL);
|
||||||
|
|
||||||
/* get drawable region */
|
/* get drawable region */
|
||||||
clipping_region = jwidget_get_drawable_region(this, JI_GDR_CUTTOPWINDOWS);
|
clipping_region = jwidget_get_drawable_region(this, JI_GDR_CUTTOPWINDOWS);
|
||||||
@ -254,11 +256,17 @@ void Editor::editor_draw_cursor(int x, int y, bool refresh)
|
|||||||
if (current_tool->getInk(0)->isSelection()) {
|
if (current_tool->getInk(0)->isSelection()) {
|
||||||
cursor_type = CURSOR_CROSS_ONE;
|
cursor_type = CURSOR_CROSS_ONE;
|
||||||
}
|
}
|
||||||
else if (current_tool->getInk(0)->isEffect()) {
|
else if (// Use cursor bounds for inks that are effects (eraser, blur, etc.)
|
||||||
|
current_tool->getInk(0)->isEffect() ||
|
||||||
|
// or when the FG color is mask and we are not in the background layer
|
||||||
|
(color_type(UIContext::instance()->getSettings()->getFgColor()) == COLOR_TYPE_MASK &&
|
||||||
|
(m_sprite->getCurrentLayer() != NULL &&
|
||||||
|
!m_sprite->getCurrentLayer()->is_background()))) {
|
||||||
cursor_type = CURSOR_BOUNDS;
|
cursor_type = CURSOR_BOUNDS;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
cursor_type = CURSOR_PENCIL;
|
cursor_type = CURSOR_PENCIL;
|
||||||
|
}
|
||||||
|
|
||||||
// For cursor type 'bounds' we have to generate cursor boundaries
|
// For cursor type 'bounds' we have to generate cursor boundaries
|
||||||
if (cursor_type & CURSOR_BOUNDS)
|
if (cursor_type & CURSOR_BOUNDS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user