Skip to content

Commit

Permalink
pw_display: Color library
Browse files Browse the repository at this point in the history
Introduce color data types for RGB565 and RGBA8888 along with
conversion functions and pre defined constants for two palettes. The
palettes are primarily used for tests for the upcoming drawing
library.

Bug: 359953386
Change-Id: Ia409669d0f566f8873d79d1575453b80175cde20
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/229606
Reviewed-by: Taylor Cramer <[email protected]>
Lint: Lint 🤖 <[email protected]>
Commit-Queue: Anthony DiGirolamo <[email protected]>
Reviewed-by: Armando Montanez <[email protected]>
  • Loading branch information
AnthonyDiGirolamo authored and CQ Bot Account committed Aug 15, 2024
1 parent 56ac0e6 commit 010825d
Show file tree
Hide file tree
Showing 10 changed files with 751 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ _doxygen_input_files = [ # keep-sorted: start
"$dir_pw_crypto/public/pw_crypto/sha256.h",
"$dir_pw_digital_io/public/pw_digital_io/digital_io.h",
"$dir_pw_digital_io/public/pw_digital_io/digital_io_mock.h",
"$dir_pw_display/public/pw_display/color.h",
"$dir_pw_function/public/pw_function/function.h",
"$dir_pw_function/public/pw_function/pointer.h",
"$dir_pw_function/public/pw_function/scope_guard.h",
Expand Down
21 changes: 21 additions & 0 deletions pw_display/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,27 @@
# License for the specific language governing permissions and limitations under
# the License.

load(
"@pigweed//pw_build:pigweed.bzl",
"pw_cc_test",
)

package(default_visibility = ["//visibility:public"])

licenses(["notice"])

cc_library(
name = "color",
hdrs = [
"public/pw_display/color.h",
"public/pw_display/colors_endesga64.h",
"public/pw_display/colors_pico8.h",
],
includes = ["public"],
)

pw_cc_test(
name = "color_test",
srcs = ["color_test.cc"],
deps = [":color"],
)
25 changes: 23 additions & 2 deletions pw_display/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,31 @@ import("$dir_pw_docgen/docs.gni")
import("$dir_pw_sync/backend.gni")
import("$dir_pw_unit_test/test.gni")

config("public_include_path") {
include_dirs = [ "public" ]
}

pw_source_set("color") {
public_configs = [ ":public_include_path" ]
public = [
"public/pw_display/color.h",
"public/pw_display/colors_endesga64.h",
"public/pw_display/colors_pico8.h",
]
}

pw_test("color_test") {
deps = [ ":color" ]
sources = [ "color_test.cc" ]
}

pw_test_group("tests") {
tests = []
tests = [ ":color_test" ]
}

pw_doc_group("docs") {
sources = [ "docs.rst" ]
sources = [
"api.rst",
"docs.rst",
]
}
19 changes: 19 additions & 0 deletions pw_display/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,22 @@
# the License.

include($ENV{PW_ROOT}/pw_build/pigweed.cmake)

pw_add_library(pw_display.color INTERFACE
HEADERS
public/pw_display/color.h
public/pw_display/colors_endesga64.h
public/pw_display/colors_pico8.h
PUBLIC_INCLUDES
public
)

pw_add_test(pw_display.color_test
SOURCES
color_test.cc
PRIVATE_DEPS
pw_display.color
GROUPS
modules
pw_display
)
Loading

0 comments on commit 010825d

Please sign in to comment.