Skip to content

Commit

Permalink
unindent 0.1 everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Jun 11, 2023
1 parent 8df0cdc commit 22ba653
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
14 changes: 4 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ time = { version = "0.3", default-features = false, features = [
] }
tinyvec = { version = "1.6", features = ["alloc", "rustc_1_55"] }
tokio = { version = "1.24", default-features = false }
unindent = "0.1"
vec1 = "1.8"
web-time = "0.2.0"
wgpu = { version = "0.16.1" }
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ winit = "0.28.1"
zip = { version = "0.6", default-features = false, features = ["deflate"] }

# For tests:
unindent = "0.1"
unindent.workspace = true

# native
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/re_types_builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ arrow2.workspace = true
convert_case = "0.6"
flatbuffers = "23.0"
indent = "0.1"
unindent = "0.2"
unindent.workspace = true
xshell = "0.2"


Expand Down
24 changes: 23 additions & 1 deletion rerun_py/rerun_sdk/rerun/color_conversion.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
"""Color conversion utilities."""
from typing import Union
from typing import List, Union

import numpy as np
import numpy.typing as npt


def rgba_to_u8_array(rgba: np.uint32) -> List[np.uint8]:
"""
Convert a uint32 into an array[4] of uint8 values.
Parameters
----------
rgba: int
The uint32 value as 0xRRGGBBAA.
Returns
-------
List[int]
The array of uint8 values converted in RGBA order.
"""
red = rgba >> 24 & 0xFF
green = rgba >> 16 & 0xFF
blue = rgba >> 8 & 0xFF
alpha = rgba & 0xFF
return [red, green, blue, alpha] # type: ignore[return-value]


def u8_array_to_rgba(arr: npt.NDArray[np.uint8]) -> npt.NDArray[np.uint32]:
"""
Convert an array with inner dimension [R,G,B,A] into packed uint32 values.
Expand Down

0 comments on commit 22ba653

Please sign in to comment.