【问题标题】:Use All The Color Swatches In Palette使用调色板中的所有色板
【发布时间】:2015-06-25 14:39:52
【问题描述】:

v7.palette 从图像中提取颜色。现在我的问题是我仅限于一个色板,我的问题是如何获取所有色板,允许调色板从图像中提取所有颜色并使用该颜色。请帮助 N.B:一切正常,调色板工作正常,但颜色很少

 public void updateColor(){


       final Bitmap bitmap = mImageFetcher.getArtwork(Utils.getAlbumName(),
               Utils.getCurrentAlbumId(), Utils.getArtistName());
       Palette palette = Palette.generate(bitmap);

       // Getting the different types of colors from the Image
       Palette.Swatch vibrantSwatch = palette.getVibrantSwatch();







       // Adding the colors to the TextViews.

       if(vibrantSwatch!=null) {



           // Changing the background color of the toolbar to Vibrant Light Swatch
           toolbar.setBackgroundDrawable(new ColorDrawable(vibrantSwatch.getRgb()));

           if (Build.VERSION.SDK_INT >= 21) { //  setStatusBarColor only works above API 21!
               getWindow().setStatusBarColor(vibrantSwatch.getRgb());
           }
       }

   }

【问题讨论】:

    标签: android palette android-palette


    【解决方案1】:

    Palettes 的目的是提取主要颜色,而不是给你一个颜色分布。您将不得不在其他地方寻找这样的功能。

    【讨论】:

    • 我已经知道我的问题是如何从图像中提取所有色板(充满活力的色板、静音色板等...)感谢您的帮助
    【解决方案2】:

    查看 Color Extractor (https://github.com/RacZo/ColorExtractor),这是我构建的一个小应用程序作为概念验证。它展示了如何使用新的 Palette 和 Palette Builder 类从图像中获取颜色和色板。

    【讨论】:

      【解决方案3】:

      Palette 有一个方法 getSwatches(),它会返回一个 Swatch 列表。
      (可能在问这个问题时这个方法不存在)

      【讨论】:

        猜你喜欢
        • 2014-12-29
        • 1970-01-01
        • 2021-05-09
        • 1970-01-01
        • 1970-01-01
        • 2017-10-24
        • 2011-07-24
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多