2015-06-25 120 views
0

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

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()); 
      } 
     } 

    } 

回答

0

调色板打算提取主颜色不给你一个颜色分布。你将不得不在其他地方寻找这样的功能。

+0

我已经知道我的问题是如何提取所有从图像中样本(样本充满活力,柔和斯沃琪等...)感谢您的任何帮帮我 –

0

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

0

调色板有一个方法getSwatches(),它将返回色板列表。
(也许这种方法是不存在的,当这个问题被问)

相关问题