[MSPAINT] Introduce partial image history (#5994)

- Add IMAGE_PART structure and use as history items.
- Overload ImageModel::PushImageForUndo(const RECT& rcPartial).
- Add ToolsModel::GetToolSize.
- Implement partial image history on TwoPointDrawTool.
CORE-19094
This commit is contained in:
Katayama Hirofumi MZ 2023-11-19 12:59:39 +09:00 committed by GitHub
parent 416d63026e
commit 72081168fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 118 additions and 18 deletions

View file

@ -202,6 +202,47 @@ void ToolsModel::SetRubberRadius(int nRubberRadius)
NotifyToolSettingsChanged();
}
SIZE ToolsModel::GetToolSize() const
{
SIZE size;
switch (m_activeTool)
{
case TOOL_FREESEL:
case TOOL_RECTSEL:
case TOOL_COLOR:
case TOOL_ZOOM:
case TOOL_TEXT:
case TOOL_FILL:
size.cx = size.cy = 1;
break;
case TOOL_LINE:
case TOOL_BEZIER:
case TOOL_RECT:
case TOOL_RRECT:
case TOOL_SHAPE:
case TOOL_ELLIPSE:
size.cx = size.cy = GetLineWidth();
break;
case TOOL_AIRBRUSH:
size.cx = size.cy = GetAirBrushRadius() * 2;
break;
case TOOL_RUBBER:
size.cx = size.cy = GetRubberRadius() * 2;
break;
case TOOL_BRUSH:
size.cx = size.cy = GetBrushWidth();
break;
case TOOL_PEN:
size.cx = size.cy = GetPenWidth();
break;
}
if (size.cx < 1)
size.cx = 1;
if (size.cy < 1)
size.cy = 1;
return size;
}
BOOL ToolsModel::IsBackgroundTransparent() const
{
return m_transpBg;