mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-15 11:42:30 +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,15 +84,13 @@ void EyedropperCommand::execute(Context* context)
|
||||
color_t color = color_from_image(sprite->getImgType(),
|
||||
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
|
||||
if (m_background)
|
||||
app_get_colorbar()->setBgColor(color);
|
||||
else
|
||||
app_get_colorbar()->setFgColor(color);
|
||||
}
|
||||
// set the color of the color-bar
|
||||
if (m_background)
|
||||
app_get_colorbar()->setBgColor(color);
|
||||
else
|
||||
app_get_colorbar()->setFgColor(color);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -430,7 +430,11 @@ void draw_color(BITMAP* bmp, const Rect& rc, int imgtype, color_t color)
|
||||
int data;
|
||||
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);
|
||||
|
||||
if (index >= 0 && index < get_current_palette()->size()) {
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "core/color.h"
|
||||
#include "modules/editors.h"
|
||||
#include "raster/image.h"
|
||||
#include "raster/layer.h"
|
||||
#include "raster/pen.h"
|
||||
#include "raster/sprite.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)
|
||||
{
|
||||
assert(m_cursor_thick == 0);
|
||||
assert(m_sprite != NULL);
|
||||
|
||||
/* get drawable region */
|
||||
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()) {
|
||||
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;
|
||||
}
|
||||
else
|
||||
else {
|
||||
cursor_type = CURSOR_PENCIL;
|
||||
}
|
||||
|
||||
// For cursor type 'bounds' we have to generate cursor boundaries
|
||||
if (cursor_type & CURSOR_BOUNDS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user