void IconDes::SetColor0(RGBA color) { FinishPaste(); doselection = false; rgbactrl.Mask(false); SaveUndo(); ImageBuffer ib(Current().image); MaskFill(ib, color, 255); Refresh(); SetCurrentImage(ib); SyncShow(); SetBar(); }
NAMESPACE_UPP void IconDes::LeftDown(Point p, dword flags) { SetFocus(); if(!IsCurrent()) return; SaveUndo(); startpoint = GetPos(p); if(IsPasting()) { if(Rect(Current().pastepos, Current().paste_image.GetSize()).Contains(startpoint)) { startpoint -= Current().pastepos; SetCapture(); } else FinishPaste(); return; } SetCapture(); Current().base_image = CurrentImage(); if(flags & K_SHIFT) { ImageBuffer ib(CurrentImage()); if(!doselection) { RGBA c = CurrentColor(); c.r += 127; MaskFill(ib, c, 0); } FloodFill(ib, CurrentColor(), startpoint, ib.GetSize()); SetCurrentImage(ib); if(!doselection) MaskSelection(); return; } if(selectrect) EmptyRectTool(startpoint, flags); else if(tool) (this->*tool)(startpoint, flags); }