Tuesday, May 28, 2013

Android Pattern Lock Viewer + Delphi Source

As i whanted to implement for samsung phones a pattern lock reader into jau,
i programmed a little funny tool to view the pattern lock instead
of showing the numbers.

but i havent enugh time to complete it now..
but maybe some other programmers whant to implement this feature into there tools and make it more easy for there users.


so what it dose?
its just a very simple peace of code, it just convert the patternlock numbers into a viewable picture.
nothing special..




download here the tool: http://jau.cc/support/index.php?dir=...ern_Viewer.zip

here is delphi source (incl. paintshop psd for background): http://jau.cc/support/index.php?dir=...wer_SOURCE.zip

or here is all: Index of ./support/Android Pattern Lock Viewer/


Code:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, jpeg, ExtCtrls, StdCtrls, acPNG;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Edit1: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Timer1: TTimer;
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure Timer1Timer(Sender: TObject);
  private
  public
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure PaintFild(input : string);
const
    HL : array [1..9] of integer =  (30,91,153,30,91,153,30,91,153);
    VL : array [1..9] of integer =  (122,122,122,183,183,183,244,244,244);
var
    i  : integer;
begin
    form1.Image1.Refresh;  
    form1.Canvas.Pen.Color := clGreen;

    form1.Canvas.Pen.Width := 18;
    form1.Canvas.Pen.Style := psSolid;

    while Pos(' ', input) > 0 do Delete(input,Pos(' ', input),1);

    form1.Canvas.MoveTo(HL[strtoint(input[1])], VL[strtoint(input[1])]);
    for i:= 1 to length(input) do
    begin
        form1.Canvas.LineTo(HL[strtoint(input[i])], VL[strtoint(input[i])]);
        form1.Canvas.MoveTo(HL[strtoint(input[i])], VL[strtoint(input[i])]);
        application.ProcessMessages;
        sleep(150);
    end;
end;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
    if not(Key in [#13,#9,#8,'0'..'9']) then Key:=#0;
    if key = #13 then PaintFild(form1.edit1.Text);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
  s: string;
  FmtStngs: TFormatSettings;
begin
    GetLocaleFormatSettings( GetThreadLocale, FmtStngs );
    FmtStngs.DateSeparator := #32;
    FmtStngs.ShortDateFormat := 'dd mmm yy';
    FmtStngs.TimeSeparator := ':';
    FmtStngs.LongTimeFormat := 'hh:nn';
    s := TimeToStr(Now, FmtStngs );
    form1.Label1.Caption:=s;
    s := DateToStr(Now, FmtStngs );
    form1.Label2.Caption:=s;
end;

end.

if someone have a good idea how to paint lines in half transparent without other components, let me know..

No comments:

Post a Comment