我这样写的
  r:=getrvalue(mycolor)+i;
   g:=getgvalue(mycolor)+i;
   b:=getbvalue(mycolor)+i;
   result:=rgb(r,g,b);
黄色变成了黑色 
怎样提高颜色的亮度啊,给个公式吧

解决方案 »

  1.   

    procedure BrightnessChange(const ABitmap: TBitmap; ValueChange: Integer);
    var
      I, J: integer;
      Row: PBGRA;
      Table: array[0..255]of Byte;
    begin
      ABitmap.PixelFormat := pf32bit;
      ValueChange := ValueChange * 255 div 100;
      if ValueChange > 0 then
        for i := 0 to 255 do
          Table[I]:=Byte(I + ((ValueChange * (I xor 255)) shr 8))
      else
        for i := 0 to 255 do
          Table[I]:=Byte(I - ((Abs(ValueChange) * I) shr 8));  for I := 0 to ABitmap.Height - 1 do
      begin
        Row := ABitmap.ScanLine[I];
        for J := 0 to ABitmap.Width - 1 do
        begin
          Row^.R := Table[Row^.R];
          Row^.G := Table[Row^.G];
          Row^.B := Table[Row^.B];
          Inc(Row);
        end;
      end;
    end;
      

  2.   

    r:=getrvalue(mycolor)-i;
       g:=getgvalue(mycolor)-i;
       b:=getbvalue(mycolor)-i;
       result:=rgb(r,g,b);
      

  3.   

    你不是只要算法?根据后面的代码难道看不出来这个record的意思?你换TRGBQuad也成啊~~~或者24位图用TRGBTriple