Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
4a95f8bd
Commit
4a95f8bd
authored
Dec 27, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made pixel_traits use constexpr everywhere to avoid compiler errors in newer compilers.
parent
de13fdeb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
70 deletions
+70
-70
gui_core_kernel_1.h
dlib/gui_core/gui_core_kernel_1.h
+7
-7
gui_core_kernel_2.h
dlib/gui_core/gui_core_kernel_2.h
+7
-7
pixel.h
dlib/pixel.h
+56
-56
No files found.
dlib/gui_core/gui_core_kernel_1.h
View file @
4a95f8bd
...
@@ -124,16 +124,16 @@ namespace dlib
...
@@ -124,16 +124,16 @@ namespace dlib
template
<>
template
<>
struct
pixel_traits
<
canvas
::
pixel
>
struct
pixel_traits
<
canvas
::
pixel
>
{
{
const
static
bool
rgb
=
true
;
const
expr
static
bool
rgb
=
true
;
const
static
bool
rgb_alpha
=
false
;
const
expr
static
bool
rgb_alpha
=
false
;
const
static
bool
grayscale
=
false
;
const
expr
static
bool
grayscale
=
false
;
const
static
bool
hsi
=
false
;
const
expr
static
bool
hsi
=
false
;
const
static
long
num
=
3
;
const
expr
static
long
num
=
3
;
typedef
unsigned
char
basic_pixel_type
;
typedef
unsigned
char
basic_pixel_type
;
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
max
()
{
return
255
;}
static
basic_pixel_type
max
()
{
return
255
;}
const
static
bool
is_unsigned
=
true
;
const
expr
static
bool
is_unsigned
=
true
;
const
static
bool
has_alpha
=
false
;
const
expr
static
bool
has_alpha
=
false
;
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
dlib/gui_core/gui_core_kernel_2.h
View file @
4a95f8bd
...
@@ -140,16 +140,16 @@ namespace dlib
...
@@ -140,16 +140,16 @@ namespace dlib
template
<>
template
<>
struct
pixel_traits
<
canvas
::
pixel
>
struct
pixel_traits
<
canvas
::
pixel
>
{
{
const
static
bool
rgb
=
true
;
const
expr
static
bool
rgb
=
true
;
const
static
bool
rgb_alpha
=
false
;
const
expr
static
bool
rgb_alpha
=
false
;
const
static
bool
grayscale
=
false
;
const
expr
static
bool
grayscale
=
false
;
const
static
bool
hsi
=
false
;
const
expr
static
bool
hsi
=
false
;
const
static
long
num
=
3
;
const
expr
static
long
num
=
3
;
typedef
unsigned
char
basic_pixel_type
;
typedef
unsigned
char
basic_pixel_type
;
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
max
()
{
return
255
;}
static
basic_pixel_type
max
()
{
return
255
;}
const
static
bool
is_unsigned
=
true
;
const
expr
static
bool
is_unsigned
=
true
;
const
static
bool
has_alpha
=
false
;
const
expr
static
bool
has_alpha
=
false
;
};
};
// -----------------
// -----------------
...
...
dlib/pixel.h
View file @
4a95f8bd
...
@@ -406,17 +406,17 @@ namespace dlib
...
@@ -406,17 +406,17 @@ namespace dlib
template
<>
template
<>
struct
pixel_traits
<
rgb_pixel
>
struct
pixel_traits
<
rgb_pixel
>
{
{
const
static
bool
rgb
=
true
;
const
expr
static
bool
rgb
=
true
;
const
static
bool
rgb_alpha
=
false
;
const
expr
static
bool
rgb_alpha
=
false
;
const
static
bool
grayscale
=
false
;
const
expr
static
bool
grayscale
=
false
;
const
static
bool
hsi
=
false
;
const
expr
static
bool
hsi
=
false
;
const
static
bool
lab
=
false
;
const
expr
static
bool
lab
=
false
;
enum
{
num
=
3
}
;
constexpr
static
long
num
=
3
;
typedef
unsigned
char
basic_pixel_type
;
typedef
unsigned
char
basic_pixel_type
;
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
max
()
{
return
255
;}
static
basic_pixel_type
max
()
{
return
255
;}
const
static
bool
is_unsigned
=
true
;
const
expr
static
bool
is_unsigned
=
true
;
const
static
bool
has_alpha
=
false
;
const
expr
static
bool
has_alpha
=
false
;
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -424,17 +424,17 @@ namespace dlib
...
@@ -424,17 +424,17 @@ namespace dlib
template
<>
template
<>
struct
pixel_traits
<
bgr_pixel
>
struct
pixel_traits
<
bgr_pixel
>
{
{
const
static
bool
rgb
=
true
;
const
expr
static
bool
rgb
=
true
;
const
static
bool
rgb_alpha
=
false
;
const
expr
static
bool
rgb_alpha
=
false
;
const
static
bool
grayscale
=
false
;
const
expr
static
bool
grayscale
=
false
;
const
static
bool
hsi
=
false
;
const
expr
static
bool
hsi
=
false
;
const
static
bool
lab
=
false
;
const
expr
static
bool
lab
=
false
;
enum
{
num
=
3
}
;
constexpr
static
long
num
=
3
;
typedef
unsigned
char
basic_pixel_type
;
typedef
unsigned
char
basic_pixel_type
;
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
max
()
{
return
255
;}
static
basic_pixel_type
max
()
{
return
255
;}
const
static
bool
is_unsigned
=
true
;
const
expr
static
bool
is_unsigned
=
true
;
const
static
bool
has_alpha
=
false
;
const
expr
static
bool
has_alpha
=
false
;
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -442,17 +442,17 @@ namespace dlib
...
@@ -442,17 +442,17 @@ namespace dlib
template
<>
template
<>
struct
pixel_traits
<
rgb_alpha_pixel
>
struct
pixel_traits
<
rgb_alpha_pixel
>
{
{
const
static
bool
rgb
=
false
;
const
expr
static
bool
rgb
=
false
;
const
static
bool
rgb_alpha
=
true
;
const
expr
static
bool
rgb_alpha
=
true
;
const
static
bool
grayscale
=
false
;
const
expr
static
bool
grayscale
=
false
;
const
static
bool
hsi
=
false
;
const
expr
static
bool
hsi
=
false
;
const
static
bool
lab
=
false
;
const
expr
static
bool
lab
=
false
;
enum
{
num
=
4
}
;
constexpr
static
long
num
=
4
;
typedef
unsigned
char
basic_pixel_type
;
typedef
unsigned
char
basic_pixel_type
;
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
max
()
{
return
255
;}
static
basic_pixel_type
max
()
{
return
255
;}
const
static
bool
is_unsigned
=
true
;
const
expr
static
bool
is_unsigned
=
true
;
const
static
bool
has_alpha
=
true
;
const
expr
static
bool
has_alpha
=
true
;
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -461,17 +461,17 @@ namespace dlib
...
@@ -461,17 +461,17 @@ namespace dlib
template
<>
template
<>
struct
pixel_traits
<
hsi_pixel
>
struct
pixel_traits
<
hsi_pixel
>
{
{
const
static
bool
rgb
=
false
;
const
expr
static
bool
rgb
=
false
;
const
static
bool
rgb_alpha
=
false
;
const
expr
static
bool
rgb_alpha
=
false
;
const
static
bool
grayscale
=
false
;
const
expr
static
bool
grayscale
=
false
;
const
static
bool
hsi
=
true
;
const
expr
static
bool
hsi
=
true
;
const
static
bool
lab
=
false
;
const
expr
static
bool
lab
=
false
;
enum
{
num
=
3
}
;
constexpr
static
long
num
=
3
;
typedef
unsigned
char
basic_pixel_type
;
typedef
unsigned
char
basic_pixel_type
;
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
max
()
{
return
255
;}
static
basic_pixel_type
max
()
{
return
255
;}
const
static
bool
is_unsigned
=
true
;
const
expr
static
bool
is_unsigned
=
true
;
const
static
bool
has_alpha
=
false
;
const
expr
static
bool
has_alpha
=
false
;
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -480,17 +480,17 @@ namespace dlib
...
@@ -480,17 +480,17 @@ namespace dlib
template
<>
template
<>
struct
pixel_traits
<
lab_pixel
>
struct
pixel_traits
<
lab_pixel
>
{
{
const
static
bool
rgb
=
false
;
const
expr
static
bool
rgb
=
false
;
const
static
bool
rgb_alpha
=
false
;
const
expr
static
bool
rgb_alpha
=
false
;
const
static
bool
grayscale
=
false
;
const
expr
static
bool
grayscale
=
false
;
const
static
bool
hsi
=
false
;
const
expr
static
bool
hsi
=
false
;
const
static
bool
lab
=
true
;
const
expr
static
bool
lab
=
true
;
const
static
long
num
=
3
;
const
expr
static
long
num
=
3
;
typedef
unsigned
char
basic_pixel_type
;
typedef
unsigned
char
basic_pixel_type
;
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
min
()
{
return
0
;}
static
basic_pixel_type
max
()
{
return
255
;}
static
basic_pixel_type
max
()
{
return
255
;}
const
static
bool
is_unsigned
=
true
;
const
expr
static
bool
is_unsigned
=
true
;
const
static
bool
has_alpha
=
false
;
const
expr
static
bool
has_alpha
=
false
;
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -498,17 +498,17 @@ namespace dlib
...
@@ -498,17 +498,17 @@ namespace dlib
template
<
typename
T
>
template
<
typename
T
>
struct
grayscale_pixel_traits
struct
grayscale_pixel_traits
{
{
const
static
bool
rgb
=
false
;
const
expr
static
bool
rgb
=
false
;
const
static
bool
rgb_alpha
=
false
;
const
expr
static
bool
rgb_alpha
=
false
;
const
static
bool
grayscale
=
true
;
const
expr
static
bool
grayscale
=
true
;
const
static
bool
hsi
=
false
;
const
expr
static
bool
hsi
=
false
;
const
static
bool
lab
=
false
;
const
expr
static
bool
lab
=
false
;
enum
{
num
=
1
}
;
constexpr
static
long
num
=
1
;
const
static
bool
has_alpha
=
false
;
const
expr
static
bool
has_alpha
=
false
;
typedef
T
basic_pixel_type
;
typedef
T
basic_pixel_type
;
static
basic_pixel_type
min
()
{
return
std
::
numeric_limits
<
T
>::
min
();}
static
basic_pixel_type
min
()
{
return
std
::
numeric_limits
<
T
>::
min
();}
static
basic_pixel_type
max
()
{
return
std
::
numeric_limits
<
T
>::
max
();}
static
basic_pixel_type
max
()
{
return
std
::
numeric_limits
<
T
>::
max
();}
const
static
bool
is_unsigned
=
is_unsigned_type
<
T
>::
value
;
const
expr
static
bool
is_unsigned
=
is_unsigned_type
<
T
>::
value
;
};
};
template
<>
struct
pixel_traits
<
unsigned
char
>
:
public
grayscale_pixel_traits
<
unsigned
char
>
{};
template
<>
struct
pixel_traits
<
unsigned
char
>
:
public
grayscale_pixel_traits
<
unsigned
char
>
{};
...
@@ -530,17 +530,17 @@ namespace dlib
...
@@ -530,17 +530,17 @@ namespace dlib
template
<
typename
T
>
template
<
typename
T
>
struct
float_grayscale_pixel_traits
struct
float_grayscale_pixel_traits
{
{
const
static
bool
rgb
=
false
;
const
expr
static
bool
rgb
=
false
;
const
static
bool
rgb_alpha
=
false
;
const
expr
static
bool
rgb_alpha
=
false
;
const
static
bool
grayscale
=
true
;
const
expr
static
bool
grayscale
=
true
;
const
static
bool
hsi
=
false
;
const
expr
static
bool
hsi
=
false
;
const
static
bool
lab
=
false
;
const
expr
static
bool
lab
=
false
;
enum
{
num
=
1
}
;
constexpr
static
long
num
=
1
;
const
static
bool
has_alpha
=
false
;
const
expr
static
bool
has_alpha
=
false
;
typedef
T
basic_pixel_type
;
typedef
T
basic_pixel_type
;
static
basic_pixel_type
min
()
{
return
-
std
::
numeric_limits
<
T
>::
max
();}
static
basic_pixel_type
min
()
{
return
-
std
::
numeric_limits
<
T
>::
max
();}
static
basic_pixel_type
max
()
{
return
std
::
numeric_limits
<
T
>::
max
();}
static
basic_pixel_type
max
()
{
return
std
::
numeric_limits
<
T
>::
max
();}
const
static
bool
is_unsigned
=
false
;
const
expr
static
bool
is_unsigned
=
false
;
};
};
template
<>
struct
pixel_traits
<
float
>
:
public
float_grayscale_pixel_traits
<
float
>
{};
template
<>
struct
pixel_traits
<
float
>
:
public
float_grayscale_pixel_traits
<
float
>
{};
...
...
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