Ir al contenido


Foto

Dibujar texto?


  • Por favor identifícate para responder
7 respuestas en este tema

#1 c0lo

c0lo

    Advanced Member

  • Miembro Platino
  • PipPipPip
  • 241 mensajes
  • LocationLima-Peru

Escrito 27 junio 2009 - 01:37

Hola a todos y un gran saludo de mi parte.

Bueno en esta ocasion desearia saber si podrian ayudarme a dibujar un texto, de la forma como esta en esta imagen:
Imagen Enviada

E buscado informacion sobre como dibujar algo asi, pero no e encontrado mucha ayuda, la unica que encontre fue esta:

http://www.clubdelph...780&postcount=6
la cual hace el dibujo al contrario o del otro sentido que yo deseo.
Imagen Enviada

Haber si me dan una manito y Gracias
  • 0

#2 felipe

felipe

    Advanced Member

  • Administrador
  • 3.283 mensajes
  • LocationColombia

Escrito 27 junio 2009 - 08:13

Pues bien tienes dos opciones, dibujarla con solo canvas o simplemente utilizar un Label.

Saludos!
  • 0

#3 c0lo

c0lo

    Advanced Member

  • Miembro Platino
  • PipPipPip
  • 241 mensajes
  • LocationLima-Peru

Escrito 27 junio 2009 - 01:07

Podrias explicarma ambas o la que mejor creas tu?

Gracias
  • 0

#4 eduarcol

eduarcol

    Advanced Member

  • Administrador
  • 4.483 mensajes
  • LocationVenezuela

Escrito 27 junio 2009 - 02:38

pero exactamente que necesitas?? las letras con el borde blanco???
  • 0

#5 c0lo

c0lo

    Advanced Member

  • Miembro Platino
  • PipPipPip
  • 241 mensajes
  • LocationLima-Peru

Escrito 27 junio 2009 - 04:05

Si ese estilo exactamente que el borde sea blanco y el centro negro o de mi gusto. :lipsrsealed:
  • 0

#6 c0lo

c0lo

    Advanced Member

  • Miembro Platino
  • PipPipPip
  • 241 mensajes
  • LocationLima-Peru

Escrito 11 julio 2009 - 02:15

Hola a todos, e intentado aplicar este codigo que encontre, el cual me muestra el contorno del texto.

Imagen Enviada




delphi
  1. var HFnt: HFONT; Fontname, Txt: PChar; sze: Size;
  2. begin
  3.   Fontname := 'Arial';
  4.   txt := '[cHackAll]';
  5.   HFnt := CreateFont(90, 60, 0, 0, FW_BOLD, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
  6.     PROOF_QUALITY, DEFAULT_PITCH + FF_DONTCARE, Fontname);
  7.  
  8.   SelectObject(Canvas.Handle, hfnt);
  9.   SetBkMode(Canvas.Handle, TRANSPARENT);
  10.   GetTextExtentPoint32(Canvas.Handle, txt, length(txt), sze);
  11.   BeginPath(Canvas.Handle);
  12.  
  13.   TextOut(Canvas.Handle, 0, 0, Txt, length(Txt));
  14.  
  15.   EndPath(Canvas.Handle);
  16.  
  17.   StrokePath(Canvas.Handle);
  18.   SetBkMode(Canvas.Handle, OPAQUE);
  19.  
  20.  
  21.   DeleteObject(SelectObject(Canvas.Handle, GetStockObject(WHITE_BRUSH)));
  22.   SelectObject(Canvas.Handle, GetStockObject(SYSTEM_FONT));
  23.   DeleteObject(HFnt);
  24.  
  25. end;



lo que quiero ahora, es dibujar el texto y que pueda definir el fondo del texto y el borde, como este ejemplo:

Imagen Enviada


Definir el fondo de mi texto y luego hacer un borde de distinto color...

Gracias
  • 0

#7 cHackAll

cHackAll

    Advanced Member

  • Administrador
  • 599 mensajes

Escrito 13 julio 2009 - 01:51


delphi
  1. var
  2. Bitmap: TBitmap;
  3. lpScanLine, lpBuffer: PChar;
  4.  
  5. procedure TForm1.FormCreate(Sender: TObject);
  6. begin
  7. Bitmap := TBitmap.Create;
  8. Bitmap.Width := ClientWidth;
  9. Bitmap.Height := ClientHeight;
  10. Bitmap.PixelFormat := pf32bit;
  11. Bitmap.Canvas.Font.Size := 16;
  12. Bitmap.Canvas.Font.Name := 'Tahoma';
  13. Bitmap.Canvas.Brush.Color := clBlack;
  14. lpScanLine := Bitmap.ScanLine[Bitmap.Height - 1];
  15. lpBuffer := Ptr(LocalAlloc(0, Bitmap.Width * Bitmap.Height * 4));
  16. end;
  17.  
  18. procedure TForm1.FormPaint(Sender: TObject);
  19. var Size, Index, y, x, Value, Pos: Integer;
  20. begin
  21. with Bitmap.Canvas do
  22.   begin
  23.   FillRect(ClientRect);
  24.   Font.Color := clWhite;
  25.   TextOut(6, 6, 'cHackAll');
  26.  
  27.   Size := Bitmap.Width * 4;
  28.   Move(lpScanLine^, lpBuffer^, Size * Bitmap.Height);
  29.   for Index := 0 to Size * Bitmap.Height do
  30.     begin
  31.     Value := 0;
  32.     for y := -2 to 2 do
  33.       for x := -2 to 2 do
  34.       begin
  35.         Pos := Index + (y * Size) + (x * 4);
  36.         if (Pos >= 0) and (Pos < (Bitmap.Height * Size)) then
  37.         Inc(Value, Byte(lpBuffer[Pos]));
  38.       end;
  39.     lpScanLine[Index] := Chr(Value div 25);
  40.     end;
  41.  
  42.   Font.Color := clBlack;
  43.   SetBkMode(Handle, TRANSPARENT);
  44.   TextOut(6, 6, 'cHackAll');
  45.   end;
  46.  
  47. Canvas.Draw(0, 0, Bitmap);
  48. end;


  • 0

#8 c0lo

c0lo

    Advanced Member

  • Miembro Platino
  • PipPipPip
  • 241 mensajes
  • LocationLima-Peru

Escrito 14 julio 2009 - 09:06

Gracias, por la ayuda, ya con esto podria modificarlo a mi gusto, y poder desarrollarlo de distintas maneras.

Gracias cHackAll
  • 0




IP.Board spam blocked by CleanTalk.