Mensaje    Asunto: Marca de Agua Responder citando

Hola amigos....
despues de tanto buscar en internet me tope con este codigo...
y lo quiero compartir con ustedes
espero que le sirva a alguien....esta en delphi pero.... bueno...
no debe ser dificil pasarlo a c++.....hay que probar.......

Código:
procedure TForm1.Button_APPLYClick(Sender: TObject)
Var BB:TBitmap;
Amount: Integer;
Begin
 Amount := 80;//cantidad de brillo  hay vas probando.....
 BB := TBitmap.Create;
 BB.PixelFormat := pf24bit;
 BB.Assign (Picture.Bitmap);
 Lightness (BB,Amount);
 Amount := 20;//para el contraste
 Contrast (BB,Amount);
 Picture.Bitmap.Assign (BB);
 BB.Free;
end;


procedure Lightness(var clip: tbitmap; Amount: Integer);
var
p0:pbytearray;
r,g,b,x,y: Integer;
begin
  for y:=0 to clip.Height-1 do begin
    p0:=clip.scanline[y];
    for x:=0 to clip.Width-1 do
    begin
      r:=p0[x*3];
      g:=p0[x*3+1];
      b:=p0[x*3+2];
      p0[x*3]:=IntToByte(r+((255-r)*Amount)div 255);
      p0[x*3+1]:=IntToByte(g+((255-g)*Amount)div 255);
      p0[x*3+2]:=IntToByte(b+((255-b)*Amount)div 255);
    end;
  end;
end;

esa fua para el brillo... ahora para el contraste  tenemos...

procedure Contrast(var clip: tbitmap; Amount: Integer);
var
p0:pbytearray;
rg,gg,bg,r,g,b,x,y:  Integer;
begin
  for y:=0 to clip.Height-1 do
  begin
    p0:=clip.scanline[y];
    for x:=0 to clip.Width-1 do
    begin
      r:=p0[x*3];
      g:=p0[x*3+1];
      b:=p0[x*3+2];
      rg:=(Abs(127-r)*Amount)div 255;
      gg:=(Abs(127-g)*Amount)div 255;
      bg:=(Abs(127-b)*Amount)div 255;
      if r>127 then r:=r+rg else r:=r-rg;
      if g>127 then g:=g+gg else g:=g-gg;
      if b>127 then b:=b+bg else b:=b-bg;
      p0[x*3]:=IntToByte(r);
      p0[x*3+1]:=IntToByte(g);
      p0[x*3+2]:=IntToByte(b);
    end;
  end;
end;


y por si acaso...

function IntToByte(i:Integer):Byte;
begin
  if      i>255 then Result:=255
  else if i<0   then Result:=0
  else               Result:=i;
end;


y listo.
bueno ahora a tomarno s el trabajo de pasrlo a c++
y haber si funciona....