Image_colorSpace.cpp 1.1 KB

123456789101112131415161718192021222324252627
  1. #if 0 // Disabled until updated to use current API.
  2. // Copyright 2019 Google LLC.
  3. // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
  4. #include "tools/fiddle/examples.h"
  5. // HASH=4468d573f42af6f5e234be10a5453bb2
  6. REG_FIDDLE(Image_colorSpace, 256, 256, false, 3) {
  7. void draw(SkCanvas* canvas) {
  8. SkPixmap pixmap;
  9. source.peekPixels(&pixmap);
  10. canvas->scale(.25f, .25f);
  11. int y = 0;
  12. for (auto gamma : { SkColorSpace::kLinear_RenderTargetGamma,
  13. SkColorSpace::kSRGB_RenderTargetGamma } ) {
  14. int x = 0;
  15. sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeRGB(gamma, SkColorSpace::kSRGB_Gamut);
  16. for (int index = 0; index < 2; ++index) {
  17. pixmap.setColorSpace(colorSpace);
  18. sk_sp<SkImage> image = SkImage::MakeRasterCopy(pixmap);
  19. canvas->drawImage(image, x, y);
  20. colorSpace = image->colorSpace()->makeColorSpin();
  21. x += 512;
  22. }
  23. y += 512;
  24. }
  25. }
  26. } // END FIDDLE
  27. #endif // Disabled until updated to use current API.