Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
blaar
blibs
blc_core
Commits
c6f42868
Commit
c6f42868
authored
Nov 23, 2016
by
Arnaud Blanchard
Browse files
Use 3 digits instead of 3 to display colored surfaces
parent
1b8e6a0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/blc_array.cpp
View file @
c6f42868
...
...
@@ -462,14 +462,14 @@ static void fprint_3Dmatrix(FILE *file, blc_mem *mem, int offset, int step0, int
size_t
console_size
;
if
(
ansi_terminal
){
console_size
=
length0
*
width
*
height
*
8
+
height
;
//
8
bytes per pixel for colors + return char for each line.
console_size
=
length0
*
width
*
height
*
9
+
height
;
//
9
bytes per pixel for colors + return char for each line.
if
(
!
ansi_texts
)
{
ansi_texts
=
MANY_ALLOCATIONS
(
256
*
2
,
char
);
ansi_texts
=
MANY_ALLOCATIONS
(
256
*
3
,
char
);
uchar_bar_colors
=
MANY_ALLOCATIONS
(
256
,
char
);
FOR
(
i
,
256
)
{
sprintf
(
tmp_string
,
"%.
2
d "
,
i
%
100
);
memcpy
(
ansi_texts
+
i
*
2
,
tmp_string
,
2
);
sprintf
(
tmp_string
,
"%.
3
d "
,
i
);
memcpy
(
ansi_texts
+
i
*
3
,
tmp_string
,
3
);
uchar_bar_colors
[
i
]
=
blc_bar_colors
[
i
*
BLC_BAR_COLORS_NB
/
256
];
}
}
...
...
@@ -501,8 +501,10 @@ static void fprint_3Dmatrix(FILE *file, blc_mem *mem, int offset, int step0, int
}
console_buffer
.
chars
[
console_size
++
]
=
'm'
;
}
console_buffer
.
chars
[
console_size
++
]
=
ansi_texts
[
value
*
2
];
console_buffer
.
chars
[
console_size
++
]
=
ansi_texts
[
value
*
2
+
1
];
console_buffer
.
chars
[
console_size
++
]
=
ansi_texts
[
value
*
3
];
console_buffer
.
chars
[
console_size
++
]
=
ansi_texts
[
value
*
3
+
1
];
console_buffer
.
chars
[
console_size
++
]
=
ansi_texts
[
value
*
3
+
2
];
// console_buffer.data[console_size++]=' ';
previous_color_id
=
color_id
;
}
...
...
t_array/main.cpp
View file @
c6f42868
...
...
@@ -80,7 +80,7 @@ int main(int argc, char **argv){
//Display the array as a array of decimals)
pixel_array
.
fprint_surface_uchars
(
stderr
);
fprintf
(
stderr
,
"
\n
We display the array of intensities as compact colored values
(two last digits)
\n\n
"
);
fprintf
(
stderr
,
"
\n
We display the array of intensities as compact colored values
\n\n
"
);
//Display the array as a compact surface of color (ansi_terminal). Ideal for images
pixel_array
.
fprint_surface_uchars
(
stderr
,
1
);
...
...
Write
Preview
Supports
Markdown
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