Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
e3818c4e
"vscode:/vscode.git/clone" did not exist on "78c24bbbcbbcd601ea02a01c2540889c5d61fc94"
Commit
e3818c4e
authored
Nov 21, 2013
by
Davis King
Browse files
Added the option to draw crossed out rectangles onto the image_display widget.
parent
edeb4f86
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
4 deletions
+36
-4
dlib/gui_widgets/widgets.cpp
dlib/gui_widgets/widgets.cpp
+23
-0
dlib/gui_widgets/widgets.h
dlib/gui_widgets/widgets.h
+5
-4
dlib/gui_widgets/widgets_abstract.h
dlib/gui_widgets/widgets_abstract.h
+8
-0
No files found.
dlib/gui_widgets/widgets.cpp
View file @
e3818c4e
...
...
@@ -5978,6 +5978,20 @@ namespace dlib
mfont
->
draw_string
(
c
,
r
,
itr
->
first
,
overlay_rects
[
i
].
color
,
0
,
std
::
string
::
npos
,
area
);
}
if
(
overlay_rects
[
i
].
crossed_out
)
{
if
(
rect_is_selected
&&
selected_rect
==
i
)
{
draw_line
(
c
,
orect
.
tl_corner
(),
orect
.
br_corner
(),
invert_pixel
(
overlay_rects
[
i
].
color
),
area
);
draw_line
(
c
,
orect
.
bl_corner
(),
orect
.
tr_corner
(),
invert_pixel
(
overlay_rects
[
i
].
color
),
area
);
}
else
{
draw_line
(
c
,
orect
.
tl_corner
(),
orect
.
br_corner
(),
overlay_rects
[
i
].
color
,
area
);
draw_line
(
c
,
orect
.
bl_corner
(),
orect
.
tr_corner
(),
overlay_rects
[
i
].
color
,
area
);
}
}
}
// now draw all the overlay lines
...
...
@@ -6039,6 +6053,15 @@ namespace dlib
if
(
event_handler
.
is_set
())
event_handler
();
}
if
(
is_printable
&&
!
hidden
&&
enabled
&&
rect_is_selected
&&
(
key
==
'i'
))
{
overlay_rects
[
selected_rect
].
crossed_out
=
!
overlay_rects
[
selected_rect
].
crossed_out
;
parent
.
invalidate_rectangle
(
rect
);
if
(
event_handler
.
is_set
())
event_handler
();
}
}
// ----------------------------------------------------------------------------------------
...
...
dlib/gui_widgets/widgets.h
View file @
e3818c4e
...
...
@@ -3292,24 +3292,25 @@ namespace dlib
struct
overlay_rect
{
overlay_rect
()
{
assign_pixel
(
color
,
0
);}
overlay_rect
()
:
crossed_out
(
false
)
{
assign_pixel
(
color
,
0
);}
template
<
typename
pixel_type
>
overlay_rect
(
const
rectangle
&
r
,
pixel_type
p
)
:
rect
(
r
)
{
assign_pixel
(
color
,
p
);
}
:
rect
(
r
)
,
crossed_out
(
false
)
{
assign_pixel
(
color
,
p
);
}
template
<
typename
pixel_type
>
overlay_rect
(
const
rectangle
&
r
,
pixel_type
p
,
const
std
::
string
&
l
)
:
rect
(
r
),
label
(
l
)
{
assign_pixel
(
color
,
p
);
}
:
rect
(
r
),
label
(
l
)
,
crossed_out
(
false
)
{
assign_pixel
(
color
,
p
);
}
template
<
typename
pixel_type
>
overlay_rect
(
const
rectangle
&
r
,
pixel_type
p
,
const
std
::
string
&
l
,
const
std
::
map
<
std
::
string
,
point
>&
parts_
)
:
rect
(
r
),
label
(
l
),
parts
(
parts_
)
{
assign_pixel
(
color
,
p
);
}
:
rect
(
r
),
label
(
l
),
parts
(
parts_
)
,
crossed_out
(
false
)
{
assign_pixel
(
color
,
p
);
}
rectangle
rect
;
rgb_alpha_pixel
color
;
std
::
string
label
;
std
::
map
<
std
::
string
,
point
>
parts
;
bool
crossed_out
;
};
struct
overlay_line
...
...
dlib/gui_widgets/widgets_abstract.h
View file @
e3818c4e
...
...
@@ -2394,12 +2394,16 @@ namespace dlib
Moreover, the rectangle can have sub-parts. Each part is listed
in the parts member variable. This variable maps the name of the
part to its position.
Rectangles with crossed_out == true will be drawn with an X through
them.
!*/
rectangle
rect
;
rgb_alpha_pixel
color
;
std
::
string
label
;
std
::
map
<
std
::
string
,
point
>
parts
;
bool
crossed_out
;
overlay_rect
(
);
...
...
@@ -2408,6 +2412,7 @@ namespace dlib
- #color == rgb_alpha_pixel(0,0,0,0)
- #rect == rectangle()
- #label.size() == 0
- #crossed_out == false
!*/
template
<
typename
pixel_type
>
...
...
@@ -2420,6 +2425,7 @@ namespace dlib
- #rect == r
- performs assign_pixel(color, p)
- #label.size() == 0
- #crossed_out == false
!*/
template
<
typename
pixel_type
>
...
...
@@ -2433,6 +2439,7 @@ namespace dlib
- #rect == r
- performs assign_pixel(color, p)
- #label == l
- #crossed_out == false
!*/
template
<
typename
pixel_type
>
...
...
@@ -2448,6 +2455,7 @@ namespace dlib
- performs assign_pixel(color, p)
- #label == l
- #parts == parts_
- #crossed_out == false
!*/
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment