我如何获得位图图像的颜色并将其显示在托盘上 [英] How i can get the colors of a bitmap image and show them on a pallet

查看:84
本文介绍了我如何获得位图图像的颜色并将其显示在托盘上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何获取位图图像的颜色并将其显示在这样的托盘上:





http://www.codeproject.com/KB/Articles /686374/Working/2-120.jpg [ ^ ]

How i can get the colors of a bitmap image and show them on a pallet like this :


http://www.codeproject.com/KB/Articles/686374/Working/2-120.jpg[^]

推荐答案

遍历位图,列出每个像素的颜色,不要忘记忽略重复项。然后将列表排序为您喜欢的顺序,例如红色,绿色,蓝色等然后浏览列表并在窗口中为每种颜色绘制一个形状。请参阅 GetPixel 方法 [ ^ ]以获取更多信息。
Iterate through the bitmap making a list of every pixel's colour, not forgetting to ignore duplicates. Then sort the list into whatever order you prefer, e.g. reds, greens, blues etc. Then go through the list and draw a shape in the window for each colour. See the GetPixel method[^] for further information.


今年11月13日,我发布了一个非常完整的代码示例,用于分析所有位图中的颜色:您可以轻松地将该代码调整到您的目标:[ ^ ]。
On November 13, this year, I posted a very complete code example for analyzing all the colors in a bitmap: you could easily adapt that code to your goal: [^].


这篇关于我如何获得位图图像的颜色并将其显示在托盘上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆