找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1004|回复: 5

[求助]:请问acad的颜色索引和RGB的对应关系是怎样的

[复制链接]
发表于 2003-1-27 17:19:36 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
谢谢!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2003-1-28 15:12:42 | 显示全部楼层
我试验过从CAD中抓图、然后转入FireWorks中进行颜色提取,发现非常有规律,我是从主界面中的颜色选取框中截取的,直接在CAD的ModelSpace中抓取的不准,提供一个例子
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2003-1-28 20:11:10 | 显示全部楼层
发现了什么规律?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2003-1-29 09:35:52 | 显示全部楼层

Re: [求助]:请问acad的颜色索引和RGB的对应关系是怎样的

最初由 musicdancer 发布
[B]谢谢! [/B]


下载以下文件,就是你要的答案,不过你的爱心币也忒少了点吧,让我怎么好意思伸手喔。就这也要惩罚你一下,赶紧多发表言论,够30个爱心币才来免费下载吧。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2003-1-29 15:06:31 | 显示全部楼层
acdbGetRGB/acedGetRGB就应该可以取得你想要的
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2003-10-24 15:48:59 | 显示全部楼层
Answer
The following two functions will help you translate an RGB value to the nearest
equivalent AutoCAD Color Index. The function goes through all the AutoCAD
colours and searches the nearest one by comparing the differences from the given
RGB values to the RGB values corresponding to the 255 AutoCAD colors.


// This function returns the ACI color which is the "nearest" color to
// the color defined by the red, green and blue (RGB) values passed
// in argument.
int getNearestACI (const long red, const long green, const long blue) {
  long acirgb, r,g,b;
  long mindst = 2147483647L;
  long dst = 0;
  int minndx = 0;

  for ( int i = 1; i < 255; i++ ) {
      acirgb = acdbGetRGB ( i );
      r = ( acirgb & 0xffL );
      g = ( acirgb & 0xff00L ) >> 8;
      b = acirgb >> 16;

      dst = abs ( r-red) + abs ( g -green) + abs (b-blue);
      if ( dst < mindst ) {
        minndx = i;
        mindst = dst;
      }
  }
  return minndx;
}

// This function returns the ACI which has the "nearest" color to
// the color defined by rgb paramether of the function
// The rgb parameter is defined as follows:
// The low byte is the red, the next byte is the green, and
// the last byte is the blue RGB value -> 0x00BBGGRR
// The red, green, and blue bytes can have values from 0 to 255.
int getNearestACI (const unsigned long rgb) {
   long r = ( rgb & 0xffL );
   long g = ( rgb & 0xff00L ) >> 8;
   long b = rgb >> 16;;
   return getNearestACI (r, g, b);
}

Converting an AutoCAD Color Index (ACI) into its RGB color value can be done
using the ObjectARX function 'extern unsigned long acdbGetRGB(int color);'

Also same can be done by using the 'AcCmEntityColor '. For more information
and various member functions of 'AcCmEntityColor' look at Object Arx online help.
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-21 08:08 , Processed in 0.305255 second(s), 43 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表