shadow_util.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_GFX_SHADOW_UTIL_H_
  5. #define UI_GFX_SHADOW_UTIL_H_
  6. #include "build/chromeos_buildflags.h"
  7. #include "ui/gfx/gfx_export.h"
  8. #include "ui/gfx/image/image_skia.h"
  9. #include "ui/gfx/shadow_value.h"
  10. namespace gfx {
  11. // The shadow style for different UI components.
  12. enum class ShadowStyle {
  13. // The MD style is mainly used for view's shadow.
  14. kMaterialDesign,
  15. #if BUILDFLAG(IS_CHROMEOS_ASH)
  16. // The system style is mainly used for Chrome OS UI components.
  17. kChromeOSSystemUI,
  18. #endif
  19. };
  20. // A struct that describes a vector of shadows and their depiction as an image
  21. // suitable for ninebox tiling.
  22. struct GFX_EXPORT ShadowDetails {
  23. ShadowDetails();
  24. ShadowDetails(const ShadowDetails& other);
  25. ~ShadowDetails();
  26. // Returns a cached ShadowDetails for the given elevation, corner radius, and
  27. // shadow style. Creates the ShadowDetails first if necessary.
  28. static const ShadowDetails& Get(
  29. int elevation,
  30. int radius,
  31. ShadowStyle style = ShadowStyle::kMaterialDesign);
  32. // Description of the shadows.
  33. gfx::ShadowValues values;
  34. // Cached ninebox image based on |values|.
  35. gfx::ImageSkia ninebox_image;
  36. };
  37. } // namespace gfx
  38. #endif // UI_GFX_SHADOW_UTIL_H_