mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +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:
@@ -67,6 +67,8 @@ depends = ["wpiutil-casters"]
|
||||
|
||||
[tool.semiwrap.extension_modules."wpiutil._wpiutil".headers]
|
||||
# wpi
|
||||
Color = "wpi/util/Color.hpp"
|
||||
Color8Bit = "wpi/util/Color8Bit.hpp"
|
||||
StackTrace = "wpi/util/StackTrace.hpp"
|
||||
Synchronization = "wpi/util/Synchronization.h"
|
||||
RawFrame = "wpi/util/RawFrame.h"
|
||||
|
||||
197
wpiutil/src/main/python/semiwrap/Color.yml
Normal file
197
wpiutil/src/main/python/semiwrap/Color.yml
Normal file
@@ -0,0 +1,197 @@
|
||||
extra_includes:
|
||||
- pybind11/operators.h
|
||||
|
||||
classes:
|
||||
wpi::util::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==:
|
||||
|
||||
functions:
|
||||
ceil_int:
|
||||
ignore: true
|
||||
ceil:
|
||||
ignore: true
|
||||
|
||||
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) + ")";
|
||||
});
|
||||
46
wpiutil/src/main/python/semiwrap/Color8Bit.yml
Normal file
46
wpiutil/src/main/python/semiwrap/Color8Bit.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
extra_includes:
|
||||
- pybind11/operators.h
|
||||
|
||||
classes:
|
||||
wpi::util::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::util::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) + ")";
|
||||
});
|
||||
@@ -2,6 +2,8 @@ from . import _init__wpiutil
|
||||
|
||||
# autogenerated by 'semiwrap create-imports wpiutil wpiutil._wpiutil'
|
||||
from ._wpiutil import (
|
||||
Color,
|
||||
Color8Bit,
|
||||
Sendable,
|
||||
SendableBuilder,
|
||||
SendableRegistry,
|
||||
@@ -11,6 +13,8 @@ from ._wpiutil import (
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Color",
|
||||
"Color8Bit",
|
||||
"Sendable",
|
||||
"SendableBuilder",
|
||||
"SendableRegistry",
|
||||
|
||||
Reference in New Issue
Block a user