mirror of
https://gitlab.com/c3d/db48x.git
synced 2024-09-29 05:36:58 +02:00
graphics: ToGrob command
Also reorganize the graphics menu to add a few missing commands. Fixes: #876 Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit is contained in:
parent
08aa0ab5a2
commit
3e59f5febe
10 changed files with 51 additions and 8 deletions
BIN
images/eq-graph.png
Normal file
BIN
images/eq-graph.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
BIN
images/eq-xgraph.png
Normal file
BIN
images/eq-xgraph.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
BIN
images/pat-eq-graph.png
Normal file
BIN
images/pat-eq-graph.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
BIN
images/pat-eq-xgraph.png
Normal file
BIN
images/pat-eq-xgraph.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -733,6 +733,19 @@ COMMAND_BODY(Show)
|
|||
}
|
||||
|
||||
|
||||
COMMAND_BODY(ToGrob)
|
||||
// ----------------------------------------------------------------------------
|
||||
// Convert an object to graphical form
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
if (object_p obj = rt.top())
|
||||
if (grob_p gr = obj->graph())
|
||||
if (rt.top(gr))
|
||||
return OK;
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
static void graphics_dirty(coord x1, coord y1, coord x2, coord y2, size lw)
|
||||
// ----------------------------------------------------------------------------
|
||||
// Mark region as dirty with extra size
|
||||
|
|
|
@ -130,6 +130,7 @@ COMMAND_DECLARE(RRect,3);
|
|||
COMMAND_DECLARE(ClLCD,0);
|
||||
COMMAND_DECLARE(Clip,1);
|
||||
COMMAND_DECLARE(CurrentClip,0);
|
||||
COMMAND_DECLARE(ToGrob, 1);
|
||||
COMMAND_DECLARE(GXor,3);
|
||||
COMMAND_DECLARE(GOr,3);
|
||||
COMMAND_DECLARE(GAnd,3);
|
||||
|
|
|
@ -420,6 +420,7 @@ NAMED(Gray, "GrayPattern") ALIAS(Gray, "GreyPattern")
|
|||
ALIAS(Gray, "Grey")
|
||||
NAMED(RGB, "RGBPattern")
|
||||
|
||||
NAMED(ToGrob, "→Graphic") ALIAS(ToGrob, "→Grob")
|
||||
NAMED(GXor, "GraphicXor")
|
||||
NAMED(GOr, "GraphicOr")
|
||||
NAMED(GAnd, "GraphicAnd")
|
||||
|
|
21
src/menu.cc
21
src/menu.cc
|
@ -1419,25 +1419,32 @@ MENU(GraphicsMenu,
|
|||
// ----------------------------------------------------------------------------
|
||||
// Graphics operations
|
||||
// ----------------------------------------------------------------------------
|
||||
"Disp", ID_Disp,
|
||||
"Line", ID_Line,
|
||||
"Rect", ID_Rect,
|
||||
"Rounded", ID_RRect,
|
||||
"Ellipse", ID_Ellipse,
|
||||
"Circle", ID_Circle,
|
||||
|
||||
"DispXY", ID_DispXY,
|
||||
"Pict", ID_Pict,
|
||||
"→Grob", ID_ToGrob,
|
||||
"ClLCD", ID_ClLCD,
|
||||
"GOr", ID_GOr,
|
||||
"GXor", ID_GXor,
|
||||
"GXor", ID_And,
|
||||
"ClLCD", ID_ClLCD,
|
||||
"GAnd", ID_And,
|
||||
|
||||
"RGB", ID_RGB,
|
||||
"LnWidth", ID_LineWidth,
|
||||
"Pict", ID_Pict,
|
||||
"Clip", ID_Clip,
|
||||
"Current", ID_CurrentClip,
|
||||
|
||||
"Gray", ID_Gray,
|
||||
"Foregnd", ID_Foreground,
|
||||
"Bckgnd", ID_Background,
|
||||
"Clip", ID_Clip,
|
||||
"Current", ID_CurrentClip);
|
||||
"Disp", ID_Disp,
|
||||
"DispXY", ID_DispXY,
|
||||
|
||||
"Show", ID_Show,
|
||||
"Plot", ID_PlotMenu);
|
||||
|
||||
MENU(MemoryMenu,
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
23
src/tests.cc
23
src/tests.cc
|
@ -157,7 +157,7 @@ void tests::run(bool onlyCurrent)
|
|||
if (onlyCurrent)
|
||||
{
|
||||
here().begin("Current");
|
||||
global_variables();
|
||||
graphic_commands();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7154,6 +7154,27 @@ void tests::graphic_commands()
|
|||
.image("pixtest")
|
||||
.test(ENTER).expect("400");
|
||||
|
||||
step("Convert to graph")
|
||||
.test(CLEAR, "'X+Y' cbrt inv 1 + sqrt dup 1 + 2 * /", ENTER, EXIT)
|
||||
.image_noheader("eq-xgraph")
|
||||
.test("→Grob", ENTER)
|
||||
.image_noheader("eq-graph")
|
||||
.test("→Grob", ENTER)
|
||||
.image_noheader("eq-graph");
|
||||
|
||||
step("Pattern in graph conversion")
|
||||
.test(CLEAR, "0.85 GRAY FOREGROUND 0.15 GRAY BACKGROUND", ENTER)
|
||||
.noerror()
|
||||
.test(CLEAR, "'X+Y' cbrt inv 1 + sqrt dup 1 + 2 * /", ENTER, EXIT)
|
||||
.image_noheader("pat-eq-xgraph")
|
||||
.test("→Grob", ENTER)
|
||||
.image_noheader("pat-eq-graph")
|
||||
.test("→Grob", ENTER)
|
||||
.image_noheader("pat-eq-graph");
|
||||
|
||||
step("Reset pattern")
|
||||
.test(CLEAR, "0 GRAY FOREGROUND 1 GRAY BACKGROUND", ENTER)
|
||||
.noerror();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue