Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Como crear imagenes (pixeles) (https://www.clubdelphi.com/foros/showthread.php?t=77840)

Gattaca 29-02-2012 06:26:34

Como crear imagenes (pixeles)
 
Hola!

Tu última visita fue 14-12-2009 a las 18:05:31

Un tiempo que no programo en Delphi !! XD !!

Veran, tengo una duda, estuve trabajando en .NET y C++ durante un tiempo, y honestamente les digo, que las imagenes en C++ (QImage usando Qt), y en .NET (Bitmap) tienen una funcion llamada "setPixel(int x, int y, byte color)"
Que me permitia poner 1 puntico negro en una imagén, y en Delphi XE2 no encuentro la manera de manejar dicha función!

¿Como puedo colorear la imagen desde cero?

ecfisa 29-02-2012 08:14:14

Hola gattaca y feliz regreso :)

Cita:

Que me permitia poner 1 puntico negro en una imagén, y en Delphi XE2 no encuentro la manera de manejar dicha función!
Espero que este ejemplo sirva para orientarte un poco:
Código Delphi [-]
...
uses  jpeg;

procedure TForm1.Button1Click(Sender: TObject);
var
  P: TPicture;
  i: Integer;
begin
  P:= TPicture.Create;
  try
    P.LoadFromFile('C:\Users\Usuario\Pictures\Blank.jpg');
    Image1.Picture.Bitmap.Height:= P.Height;
    Image1.Picture.Bitmap.Width:= P.Width;
    Image1.Canvas.Draw(0,0,P.Graphic);
    Image1.Canvas.Pixels[2,2]:= clBlack;  // pixel negro
    for i:= 5 to 50 do
      if i < 25 then
        Image1.Canvas.Pixels[i, 10]:= clRed  // pixels rojos
      else
        Image1.Canvas.Pixels[i, 10]:= clLime;  // pixels verdes
  finally
    P.Free;
  end;
end;
Esta echo en Delphi 7 pero supongo que debería funcionar en XE2... :rolleyes:

Saludos.

Gattaca 29-02-2012 08:50:33

Muchas gracias ecfisa, me ah sido de gran ayuda!
Coye como extrañe el Delphi! :p


La franja horaria es GMT +2. Ahora son las 11:48:16.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi