Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 07-12-2013
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola look.

Gracias por poner la función . Y me alegra que te sirviera el código.

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita
  #2  
Antiguo 07-12-2013
Avatar de look
look look is offline
Miembro
 
Registrado: sep 2007
Ubicación: The Shire
Posts: 656
Poder: 19
look Va camino a la fama
Cita:
Empezado por ecfisa Ver Mensaje
Hola look.

Gracias por poner la función . Y me alegra que te sirviera el código.

Saludos
Hola, he mejorado la funcion:

Código Delphi [-]
procedure TForm1.ConvertNamePng(sName:string ; Path:string ; img:TImage);
var
  bmp: TBitmap;
  aPng : array of TPNGObject;
  i,pngWidth : Integer;
begin
  SetLength(aPng,Length(sName));
  bmp := TBitmap.Create;
  for  i:=0  to Length(sName)-1 do
  begin
    aPng[i] := TPNGObject.Create;
    aPng[i].LoadFromFile(PATH+copy(sName,i+1,1)+'.png');
  end;
  bmp.Width  := (aPng[0].Width*Length(sName))-1;
  bmp.Height := aPng[0].Height;
  bmp.PixelFormat:= pf32bit;
  bmp.Canvas.Brush.Color := clWhite;
  bmp.Canvas.FillRect(Rect(0, 0, bmp.Width, bmp.Height));
  bmp.TransparentColor := clWhite;
  bmp.Transparent := True;
  pngWidth := 0;
  for  i:=0  to Length(sName)-1 do
  begin
    aPng[i].Draw(bmp.Canvas, Rect(pngWidth , 0, aPng[i].Width + pngWidth , aPng[0].Height));
    pngWidth := aPng[i].Width+pngWidth;
  end;
  bmp.SaveToFile(PATH+'abc.png');
  img.Picture.Assign(bmp);
  ConvertToPNG(bmp,'c:\res.png');
  bmp.Free;
  for i := 0  to Length(sName)-1  do aPng[i].Free;
end;

ahora le mandas una cadena de texto y esta devuelve una imagen correspondiente al texto partiendo de un directorio en donde cada imagen represente una letra.
__________________
all your base are belong to us

Última edición por look fecha: 07-12-2013 a las 17:26:07.
Responder Con Cita
  #3  
Antiguo 08-12-2013
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola look.

Otra vueltita de tuerca...
Código Delphi [-]
procedure ConcatPngHrz(const PngNames: array of TFileName; const PngPath, FullTargetName: string);
var
  bmp: TBitmap;
  png: array of TPNGObject;
  i,hgt,wdt: Integer;
begin
  hgt := 0;
  wdt := 0;
  SetLength(png, Length(PngNames));
  for i := Low(PngNames) to High(PngNames) do
  begin
    png[i] := TPNGObject.Create;
    png[i].LoadFromFile(IncludeTrailingPathDelimiter(PngPath) + PngNames[i]);
    if png[i].Height > hgt then hgt := png[i].Height;
    Inc(wdt, png[i].Width);
  end;
  bmp := TBitmap.Create;
  bmp.PixelFormat:= pf32bit;
  bmp.Width  := wdt;
  bmp.Height := hgt;
  bmp.Canvas.Brush.Color := clWhite;
  bmp.Canvas.FillRect(Rect(0, 0, wdt, hgt));
  bmp.TransparentColor := clWhite;
  bmp.Transparent := True;
  wdt := 0;
  for i := Low(PngNames) to High(PngNames) do
  begin
    png[i].Draw(bmp.Canvas, Rect(wdt, 0, wdt +  png[i].Width, png[i].Height));
    Inc(wdt, png[i].Width);
  end;
  with png[Low(PngNames)] do
  begin
    Assign(bmp);
    SaveToFile(FullTargetName);
  end;
  for i := Low(PngNames) to High(PngNames) do png[i].Free;
  bmp.Free;
end;
De este modo eliminamos la limitante a tres archivos orígen, y también podemos usar diferentes altos ya que la imágen destino se ajusta a la de mayor tamaño.

Por ejemplo, una llamada podría ser:
Código Delphi [-]
  ConcatPngHrz(['A.PNG', 'B.PNG', 'C.PNG' ,'D.PNG', 'E.PNG', 'F.PNG', { (...) }], 'C:\IMAGENES', 'C:\IMAGENES\CONCAT.PNG');
Si además te interesa mostrarla en un TImage dentro del código, convendría hacer al procedimiento ConcatPngHrz método de un form (o agregar un parámetro de tipo TForm).

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita
  #4  
Antiguo 09-12-2013
Avatar de look
look look is offline
Miembro
 
Registrado: sep 2007
Ubicación: The Shire
Posts: 656
Poder: 19
look Va camino a la fama
Cita:
Empezado por ecfisa Ver Mensaje
Hola look.

Otra vueltita de tuerca...
Código Delphi [-]
procedure ConcatPngHrz(const PngNames: array of TFileName; const PngPath, FullTargetName: string);
var
  bmp: TBitmap;
  png: array of TPNGObject;
  i,hgt,wdt: Integer;
begin
  hgt := 0;
  wdt := 0;
  SetLength(png, Length(PngNames));
  for i := Low(PngNames) to High(PngNames) do
  begin
    png[i] := TPNGObject.Create;
    png[i].LoadFromFile(IncludeTrailingPathDelimiter(PngPath) + PngNames[i]);
    if png[i].Height > hgt then hgt := png[i].Height;
    Inc(wdt, png[i].Width);
  end;
  bmp := TBitmap.Create;
  bmp.PixelFormat:= pf32bit;
  bmp.Width  := wdt;
  bmp.Height := hgt;
  bmp.Canvas.Brush.Color := clWhite;
  bmp.Canvas.FillRect(Rect(0, 0, wdt, hgt));
  bmp.TransparentColor := clWhite;
  bmp.Transparent := True;
  wdt := 0;
  for i := Low(PngNames) to High(PngNames) do
  begin
    png[i].Draw(bmp.Canvas, Rect(wdt, 0, wdt +  png[i].Width, png[i].Height));
    Inc(wdt, png[i].Width);
  end;
  with png[Low(PngNames)] do
  begin
    Assign(bmp);
    SaveToFile(FullTargetName);
  end;
  for i := Low(PngNames) to High(PngNames) do png[i].Free;
  bmp.Free;
end;
De este modo eliminamos la limitante a tres archivos orígen, y también podemos usar diferentes altos ya que la imágen destino se ajusta a la de mayor tamaño.

Por ejemplo, una llamada podría ser:
Código Delphi [-]
  ConcatPngHrz(['A.PNG', 'B.PNG', 'C.PNG' ,'D.PNG', 'E.PNG', 'F.PNG', { (...) }], 'C:\IMAGENES', 'C:\IMAGENES\CONCAT.PNG');
Si además te interesa mostrarla en un TImage dentro del código, convendría hacer al procedimiento ConcatPngHrz método de un form (o agregar un parámetro de tipo TForm).

Saludos
Hola amigo, excelente, muchas gracias, me agrada como evouciono la funcion

Saludos!
__________________
all your base are belong to us
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Unir dos imagenes con una linea 17766297 OOP 3 23-08-2010 23:11:05
unir varias filas en una sola microbiano SQL 4 26-04-2010 18:28:27
Unir imagenes jpg alain Gráficos 6 09-04-2008 22:10:29
Unir varias tablas en una sola maravert SQL 1 04-01-2007 01:42:22
necesito unir varias tablas karla SQL 2 31-12-2006 11:49:23


La franja horaria es GMT +2. Ahora son las 01:01:35.


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