hehe
逻辑调色板就是定义一个缩引,某个整数和某个颜色联系,如gif图片常用这种格式。

解决方案 »

  1.   

    比如,你把对应的1映射为颜色板(255,137,367)
    在图片得文件头坑定可以看到这个映射
    打开这个图片,程序就会为你Create一个调色板。
    比如,我下面这个程序读取一个有索引的图片得第一个点的颜色(呵呵,some bugs).
    function GetBitMapFirstColor(ABitMap:TBitMap):TColor;
    var
     P : PByteArray;
     Pal:TPALETTEENTRY;
    Begin
    P:=ABitMap.Scanline[0];
    result:=clWhite;
    if ABitMap.Palette<>0 then //如果位图使用了调色板
         Begin
            P:=ABitMap.Scanline[0];//我没有定义2色图
            if ABitMap.PixelFormat=pf4bit then P[0]:=P[0] and $0F;
            GetPaletteEntries(ABitMap.Palette,P[0],1,Pal);
            //有索引呢,呵呵,读取物理颜色(真实颜色)
            result:=RGB(Pal.peRed,pal.peGreen,Pal.peBlue);
            exit;
         End
    else
          case ABitMap.PixelFormat of
          pf4Bit:Result:=P[0] and $0F;
          pf8Bit:Result:=P[0];//256色
          pf16Bit:Result:=PInt16(@P[0])^;//真彩色代表对应为真实颜色
          pf24Bit:Result:=RGB(P[2],p[1],p[0]);
          pf32Bit:Result:=PInt32(@P[0])^;
          end;
    end;
      

  2.   

    感谢 InsideDelphi(ID),我还是搞不清楚,请高手说说