primitives.h 882 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #pragma once
  8. #include <string>
  9. #include <vector>
  10. #include <react/graphics/Geometry.h>
  11. namespace facebook {
  12. namespace react {
  13. class ImageSource {
  14. public:
  15. enum class Type { Invalid, Remote, Local };
  16. Type type{};
  17. std::string uri{};
  18. std::string bundle{};
  19. Float scale{3};
  20. Size size{0};
  21. bool operator==(const ImageSource &rhs) const {
  22. return std::tie(this->type, this->uri) == std::tie(rhs.type, rhs.uri);
  23. }
  24. bool operator!=(const ImageSource &rhs) const {
  25. return !(*this == rhs);
  26. }
  27. };
  28. using ImageSources = std::vector<ImageSource>;
  29. enum class ImageResizeMode {
  30. Cover,
  31. Contain,
  32. Stretch,
  33. Center,
  34. Repeat,
  35. };
  36. } // namespace react
  37. } // namespace facebook