mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpiutil] Move Color and Color8Bit from wpilib to wpiutil (#8437)
Removes one of the org.wpilib.util package conflicts for modularization. Only a few minor tweaks were required to remove the wpimath dependency.
This commit is contained in:
@@ -210,8 +210,6 @@ Watchdog = "wpi/system/Watchdog.hpp"
|
||||
|
||||
# wpi/util
|
||||
Alert = "wpi/util/Alert.hpp"
|
||||
Color = "wpi/util/Color.hpp"
|
||||
Color8Bit = "wpi/util/Color8Bit.hpp"
|
||||
Preferences = "wpi/util/Preferences.hpp"
|
||||
SensorUtil = "wpi/util/SensorUtil.hpp"
|
||||
|
||||
|
||||
@@ -39,6 +39,6 @@ classes:
|
||||
SetHSV:
|
||||
SetLED:
|
||||
overloads:
|
||||
const Color&:
|
||||
const Color8Bit&:
|
||||
const wpi::util::Color&:
|
||||
const wpi::util::Color8Bit&:
|
||||
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
extra_includes:
|
||||
- pybind11/operators.h
|
||||
|
||||
classes:
|
||||
wpi::Color:
|
||||
force_type_casters:
|
||||
- wpi::util::ct_string
|
||||
attributes:
|
||||
kDenim:
|
||||
kFirstBlue:
|
||||
kFirstRed:
|
||||
kAliceBlue:
|
||||
kAntiqueWhite:
|
||||
kAqua:
|
||||
kAquamarine:
|
||||
kAzure:
|
||||
kBeige:
|
||||
kBisque:
|
||||
kBlack:
|
||||
kBlanchedAlmond:
|
||||
kBlue:
|
||||
kBlueViolet:
|
||||
kBrown:
|
||||
kBurlywood:
|
||||
kCadetBlue:
|
||||
kChartreuse:
|
||||
kChocolate:
|
||||
kCoral:
|
||||
kCornflowerBlue:
|
||||
kCornsilk:
|
||||
kCrimson:
|
||||
kCyan:
|
||||
kDarkBlue:
|
||||
kDarkCyan:
|
||||
kDarkGoldenrod:
|
||||
kDarkGray:
|
||||
kDarkGreen:
|
||||
kDarkKhaki:
|
||||
kDarkMagenta:
|
||||
kDarkOliveGreen:
|
||||
kDarkOrange:
|
||||
kDarkOrchid:
|
||||
kDarkRed:
|
||||
kDarkSalmon:
|
||||
kDarkSeaGreen:
|
||||
kDarkSlateBlue:
|
||||
kDarkSlateGray:
|
||||
kDarkTurquoise:
|
||||
kDarkViolet:
|
||||
kDeepPink:
|
||||
kDeepSkyBlue:
|
||||
kDimGray:
|
||||
kDodgerBlue:
|
||||
kFirebrick:
|
||||
kFloralWhite:
|
||||
kForestGreen:
|
||||
kFuchsia:
|
||||
kGainsboro:
|
||||
kGhostWhite:
|
||||
kGold:
|
||||
kGoldenrod:
|
||||
kGray:
|
||||
kGreen:
|
||||
kGreenYellow:
|
||||
kHoneydew:
|
||||
kHotPink:
|
||||
kIndianRed:
|
||||
kIndigo:
|
||||
kIvory:
|
||||
kKhaki:
|
||||
kLavender:
|
||||
kLavenderBlush:
|
||||
kLawnGreen:
|
||||
kLemonChiffon:
|
||||
kLightBlue:
|
||||
kLightCoral:
|
||||
kLightCyan:
|
||||
kLightGoldenrodYellow:
|
||||
kLightGray:
|
||||
kLightGreen:
|
||||
kLightPink:
|
||||
kLightSalmon:
|
||||
kLightSeaGreen:
|
||||
kLightSkyBlue:
|
||||
kLightSlateGray:
|
||||
kLightSteelBlue:
|
||||
kLightYellow:
|
||||
kLime:
|
||||
kLimeGreen:
|
||||
kLinen:
|
||||
kMagenta:
|
||||
kMaroon:
|
||||
kMediumAquamarine:
|
||||
kMediumBlue:
|
||||
kMediumOrchid:
|
||||
kMediumPurple:
|
||||
kMediumSeaGreen:
|
||||
kMediumSlateBlue:
|
||||
kMediumSpringGreen:
|
||||
kMediumTurquoise:
|
||||
kMediumVioletRed:
|
||||
kMidnightBlue:
|
||||
kMintcream:
|
||||
kMistyRose:
|
||||
kMoccasin:
|
||||
kNavajoWhite:
|
||||
kNavy:
|
||||
kOldLace:
|
||||
kOlive:
|
||||
kOliveDrab:
|
||||
kOrange:
|
||||
kOrangeRed:
|
||||
kOrchid:
|
||||
kPaleGoldenrod:
|
||||
kPaleGreen:
|
||||
kPaleTurquoise:
|
||||
kPaleVioletRed:
|
||||
kPapayaWhip:
|
||||
kPeachPuff:
|
||||
kPeru:
|
||||
kPink:
|
||||
kPlum:
|
||||
kPowderBlue:
|
||||
kPurple:
|
||||
kRed:
|
||||
kRosyBrown:
|
||||
kRoyalBlue:
|
||||
kSaddleBrown:
|
||||
kSalmon:
|
||||
kSandyBrown:
|
||||
kSeaGreen:
|
||||
kSeashell:
|
||||
kSienna:
|
||||
kSilver:
|
||||
kSkyBlue:
|
||||
kSlateBlue:
|
||||
kSlateGray:
|
||||
kSnow:
|
||||
kSpringGreen:
|
||||
kSteelBlue:
|
||||
kTan:
|
||||
kTeal:
|
||||
kThistle:
|
||||
kTomato:
|
||||
kTurquoise:
|
||||
kViolet:
|
||||
kWheat:
|
||||
kWhite:
|
||||
kWhiteSmoke:
|
||||
kYellow:
|
||||
kYellowGreen:
|
||||
red:
|
||||
access: readonly
|
||||
green:
|
||||
access: readonly
|
||||
blue:
|
||||
access: readonly
|
||||
methods:
|
||||
Color:
|
||||
overloads:
|
||||
'':
|
||||
double, double, double:
|
||||
param_override:
|
||||
r:
|
||||
name: red
|
||||
g:
|
||||
name: green
|
||||
b:
|
||||
name: blue
|
||||
int, int, int:
|
||||
FromString:
|
||||
FromHSV:
|
||||
HexString:
|
||||
operator==:
|
||||
|
||||
inline_code: |
|
||||
cls_Color
|
||||
.def("__hash__", [](Color *self) -> size_t {
|
||||
size_t h = (size_t)(
|
||||
std::hash<double>{}(self->red)
|
||||
^ (std::hash<double>{}(self->green) << 1)
|
||||
^ (std::hash<double>{}(self->blue) << 2)
|
||||
);
|
||||
return h != static_cast<size_t>(-1) ? h : -2;
|
||||
})
|
||||
.def("__repr__", [](Color *self) {
|
||||
return "Color("
|
||||
"red=" + std::to_string(self->red) + ", "
|
||||
"green=" + std::to_string(self->green) + ", "
|
||||
"blue=" + std::to_string(self->blue) + ")";
|
||||
});
|
||||
@@ -1,46 +0,0 @@
|
||||
extra_includes:
|
||||
- pybind11/operators.h
|
||||
|
||||
classes:
|
||||
wpi::Color8Bit:
|
||||
force_type_casters:
|
||||
- wpi::util::ct_string
|
||||
attributes:
|
||||
red:
|
||||
access: readonly
|
||||
green:
|
||||
access: readonly
|
||||
blue:
|
||||
access: readonly
|
||||
methods:
|
||||
Color8Bit:
|
||||
overloads:
|
||||
'':
|
||||
int, int, int:
|
||||
param_override:
|
||||
r:
|
||||
name: red
|
||||
g:
|
||||
name: green
|
||||
b:
|
||||
name: blue
|
||||
const Color&:
|
||||
std::string_view:
|
||||
FromHexString:
|
||||
HexString:
|
||||
operator==:
|
||||
|
||||
inline_code: |
|
||||
cls_Color8Bit
|
||||
.def("toColor", [](const Color8Bit &self) -> wpi::Color {
|
||||
return self;
|
||||
})
|
||||
.def("__hash__", [](Color8Bit *self) -> size_t {
|
||||
return (self->red) | (self->green << 8) | (self->blue << 16);
|
||||
})
|
||||
.def("__repr__", [](Color8Bit *self) {
|
||||
return "Color8Bit("
|
||||
"red=" + std::to_string(self->red) + ", "
|
||||
"green=" + std::to_string(self->green) + ", "
|
||||
"blue=" + std::to_string(self->blue) + ")";
|
||||
});
|
||||
@@ -8,8 +8,8 @@ classes:
|
||||
ApplyTo:
|
||||
overloads:
|
||||
std::span<wpi::AddressableLED::LEDData> [const]:
|
||||
LEDReader, std::function<void (int, wpi::Color)> [const]:
|
||||
std::span<wpi::AddressableLED::LEDData>, std::function<void (int, wpi::Color)> [const]:
|
||||
LEDReader, std::function<void (int, wpi::util::Color)> [const]:
|
||||
std::span<wpi::AddressableLED::LEDData>, std::function<void (int, wpi::util::Color)> [const]:
|
||||
Reversed:
|
||||
OffsetBy:
|
||||
ScrollAtRelativeSpeed:
|
||||
@@ -28,13 +28,13 @@ classes:
|
||||
ProgressMaskLayer:
|
||||
Steps:
|
||||
overloads:
|
||||
std::span<const std::pair<double, Color>>:
|
||||
std::initializer_list<std::pair<double, Color>>:
|
||||
std::span<const std::pair<double, wpi::util::Color>>:
|
||||
std::initializer_list<std::pair<double, wpi::util::Color>>:
|
||||
ignore: true
|
||||
Gradient:
|
||||
overloads:
|
||||
GradientType, std::span<const Color>:
|
||||
GradientType, std::initializer_list<Color>:
|
||||
GradientType, std::span<const wpi::util::Color>:
|
||||
GradientType, std::initializer_list<wpi::util::Color>:
|
||||
ignore: true
|
||||
Rainbow:
|
||||
MapIndex:
|
||||
|
||||
@@ -21,11 +21,11 @@ inline_code: |-
|
||||
cls_MechanismObject2d
|
||||
.def("appendLigament", [](MechanismObject2d *self,
|
||||
std::string_view name, double length, wpi::units::degree_t angle,
|
||||
double lineWidth, const wpi::Color8Bit& color) {
|
||||
double lineWidth, const wpi::util::Color8Bit& color) {
|
||||
return self->Append<MechanismLigament2d>(name, length, angle, lineWidth, color);
|
||||
},
|
||||
py::arg("name"), py::arg("length"), py::arg("angle"),
|
||||
py::arg("lineWidth") = 6, py::arg("color") = wpi::Color8Bit{235, 137, 52},
|
||||
py::arg("lineWidth") = 6, py::arg("color") = wpi::util::Color8Bit{235, 137, 52},
|
||||
"Append a ligament node",
|
||||
py::return_value_policy::reference_internal)
|
||||
;
|
||||
|
||||
@@ -20,11 +20,11 @@ inline_code: |-
|
||||
.def("getName", [](MechanismRoot2d *self) { return self->GetName(); }, release_gil())
|
||||
.def("appendLigament", [](MechanismRoot2d *self,
|
||||
std::string_view name, double length, wpi::units::degree_t angle,
|
||||
double lineWidth, const wpi::Color8Bit& color) {
|
||||
double lineWidth, const wpi::util::Color8Bit& color) {
|
||||
return self->Append<MechanismLigament2d>(name, length, angle, lineWidth, color);
|
||||
},
|
||||
py::arg("name"), py::arg("length"), py::arg("angle"),
|
||||
py::arg("lineWidth") = 6, py::arg("color") = wpi::Color8Bit{235, 137, 52},
|
||||
py::arg("lineWidth") = 6, py::arg("color") = wpi::util::Color8Bit{235, 137, 52},
|
||||
release_gil(), "Append a ligament node",
|
||||
py::return_value_policy::reference_internal)
|
||||
;
|
||||
|
||||
@@ -14,8 +14,6 @@ from ._wpilib import (
|
||||
AnalogPotentiometer,
|
||||
CAN,
|
||||
CANStatus,
|
||||
Color,
|
||||
Color8Bit,
|
||||
Compressor,
|
||||
CompressorConfigType,
|
||||
DSControlWord,
|
||||
@@ -106,8 +104,6 @@ __all__ = [
|
||||
"AnalogPotentiometer",
|
||||
"CAN",
|
||||
"CANStatus",
|
||||
"Color",
|
||||
"Color8Bit",
|
||||
"Compressor",
|
||||
"CompressorConfigType",
|
||||
"DSControlWord",
|
||||
|
||||
Reference in New Issue
Block a user