Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
chaotikum-logo-20px
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
malte
chaotikum-logo-20px
Commits
6462ee48
Commit
6462ee48
authored
Aug 29, 2020
by
Malte Schmitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add color
parent
c80e79df
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
86 deletions
+27
-86
20px-color.bmp
20px-color.bmp
+0
-0
foo.c
foo.c
+11
-73
foo.py
foo.py
+16
-13
logo.pxm
logo.pxm
+0
-0
No files found.
20px-color.bmp
View replaced file @
c80e79df
View file @
6462ee48
4.9 KB
|
W:
|
H:
4.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
foo.c
View file @
6462ee48
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
████████████████████
████████████████████████
██████████
██████
████
██████████████████
██
████████████
██████████████
████████
██████████████████████
████████████████
████████████████████████████
██████████
██████
████████████
████
████
████
██████████
████
██████████
██████████
████
████
██████████
████
██████████
████
██████
██████████
████
██████
██████
██████
████████████████████████
████████████████████
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██████████████
██
██
██████████
██████
██
██
██
██
██
██
██
██████████
██████████
██
██
██
██
██████████
████████████
██
██
██████████
██
██████████████
██
██
██
██
██
██████████
██
██
██████████
██████████
██
██
██████████
██
██
██████████
uint32_t
[
62
]
=
{
0x2aa0
,
0x2aa0
,
0x2aa0
,
0x7fe0
,
0xfff0
,
0x1f398
,
0xff93f
,
0x1fc78
,
0xffeff
,
0x1fff8
,
0xfb83f
,
0x1b018
,
0xfb7df
,
0x1b7d8
,
0xfb39f
,
0x1bbb8
,
0xfff0
,
0x7fe0
,
0x5540
,
0x5540
,
0x5540
,
0x0
,
0xfe0
,
0x80
,
0x80
,
0xf80
,
0x0
,
0xe80
,
0xa80
,
0xa80
,
0xf80
,
0x0
,
0xf80
,
0x880
,
0x880
,
0xf80
,
0x0
,
0xfc0
,
0x880
,
0x0
,
0xfa0
,
0x0
,
0xfe0
,
0x200
,
0x500
,
0x880
,
0x0
,
0xf80
,
0x800
,
0x800
,
0xf80
,
0x0
,
0xf80
,
0x80
,
0x80
,
0xf80
,
0x80
,
0x80
,
0xf80
,
0x0
,
0x0
,
0x0
};
uint64_t
[
62
]
pixels
=
{
0x18618618000
,
0x18618618000
,
0x18618618000
,
0x1fffffff8000
,
0xfffffffff000
,
0x7fffdbffb7e00
,
0x6dfffffb7dbfedb
,
0x7fffff6dffe00
,
0x6dffffffefffedb
,
0x7fffffffffe00
,
0x6dffbff6db7fedb
,
0x7fbfb6db6fe00
,
0x6dffbfbfffefedb
,
0x7fbfbfffefe00
,
0x6dffbfb7ff6fedb
,
0x7fbff7ff7fe00
,
0xfffffffff000
,
0x1fffffff8000
,
0xc30c30c0000
,
0xc30c30c0000
,
0xc30c30c0000
,
0x0
,
0xfffff8000
,
0xe00000
,
0xe00000
,
0xfffe00000
,
0x0
,
0xff8e00000
,
0xe38e00000
,
0xe38e00000
,
0xfffe00000
,
0x0
,
0xfffe00000
,
0xe00e00000
,
0xe00e00000
,
0xfffe00000
,
0x0
,
0xffffc0000
,
0xe00e00000
,
0x0
,
0xfffe38000
,
0x0
,
0xfffff8000
,
0x38000000
,
0x1c7000000
,
0xe00e00000
,
0x0
,
0xfffe00000
,
0xe00000000
,
0xe00000000
,
0xfffe00000
,
0x0
,
0xfffe00000
,
0xe00000
,
0xe00000
,
0xfffe00000
,
0xe00000
,
0xe00000
,
0xfffe00000
,
0x0
,
0x0
,
0x0
};
for
(
int
x
=
0
;
x
<
62
;
x
++
)
{
uint
32
_t
line
=
pixels
[
x
];
uint
64
_t
line
=
pixels
[
x
];
for
(
int
y
=
0
;
y
<
20
;
y
++
)
{
uint32_t
color
=
0
;
if
(
line
&
(
1
<<
y
))
{
color
=
0xFFFFFF
;
uint64_t
color
=
0
;
if
(
line
&
(
1ll
<<
y
*
3
))
{
color
|=
0xFF0000
;
}
if
(
line
&
(
1ll
<<
y
*
3
+
1
))
{
color
|=
0x00FF00
;
}
if
(
line
&
(
1ll
<<
y
*
3
+
2
))
{
color
|=
0x0000FF
;
}
strip
.
setPixelColor
(
y
,
color
);
}
...
...
foo.py
View file @
6462ee48
...
...
@@ -3,29 +3,32 @@ from PIL import Image
def
p
(
a
):
result
=
0
for
i
,
rgb
in
enumerate
(
a
):
r
,
g
,
b
=
rgb
black
=
r
==
0
and
g
==
0
and
b
==
0
if
not
black
:
result
|=
1
<<
i
r
,
g
,
b
=
[
round
(
v
/
255.0
)
for
v
in
rgb
]
result
|=
r
<<
i
*
3
result
|=
g
<<
i
*
3
+
1
result
|=
b
<<
i
*
3
+
2
return
result
img
=
Image
.
open
(
"20px-
mono
.bmp"
).
convert
(
'RGB'
)
img
=
Image
.
open
(
"20px-
color
.bmp"
).
convert
(
'RGB'
)
width
,
height
=
img
.
size
pixels
=
[
p
([
img
.
getpixel
((
x
,
y
))
for
y
in
range
(
height
)])
for
x
in
range
(
width
)]
print
(
"
\n
"
.
join
([
format
(
p
,
'020b'
).
replace
(
'0'
,
' '
).
replace
(
'1'
,
'██'
)
for
p
in
pixels
]))
print
(
"
\n\n\n\n\n
"
)
array
=
"{"
+
","
.
join
([
hex
(
p
)
for
p
in
pixels
])
+
"}"
code
=
"""uint
32
_t[{width}] pixels = {array};
code
=
"""uint
64
_t[{width}] pixels = {array};
for (int x = 0; x < {width}; x++) {{
uint
32
_t line = pixels[x];
uint
64
_t line = pixels[x];
for (int y = 0; y < {height}; y++) {{
uint32_t color = 0;
if (line & (1l << y)) {{
color = 0xFFFFFF;
uint64_t color = 0;
if (line & (1ll << y * 3)) {{
color |= 0xFF0000;
}}
if (line & (1ll << y * 3 + 1)) {{
color |= 0x00FF00;
}}
if (line & (1ll << y * 3 + 2)) {{
color |= 0x0000FF;
}}
strip.setPixelColor(y, color);
}}
...
...
logo.pxm
View file @
6462ee48
No preview for this file type
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