-=-
.
.....
  
 
RSS
Direkomendasikan menggunakan brower Opera/Chrome/Firefox. Resolusi minimal 1024x768 | Powered by ____ |
 
  
 
Nikmati Delphi-ID dalam berbagai versi tampilan :
Basic View (LOW Bandwidth)
Default View (Full)
Mobile Edition
Main Menu
..:: onWebTools ::..
..:: onLastPosts ::..
goto Postsplit sample data & header file(0)
 by andtho89
 on 23.May at 08:49
goto Postpemanggilan frame(5)
 by andtho89
 on 23.May at 02:13
goto Postjumlah komponen maksimal dalam sebuah project(6)
 by d4mnf1y32
 on 21.May at 12:16
goto Posttanya grayscale to biner dengan scanline(1)
 by luckynvic
 on 20.May at 20:44
goto Posttanya looping biner to matriks(1)
 by luckynvic
 on 20.May at 20:10
goto Postsql error:acces denied for user....(2)
 by nasbms
 on 19.May at 16:54
goto Posttanya AvLock(0)
 by azuriza
 on 19.May at 11:24
goto PostGet TDBEdit Value Menggunakan LookUp Grid(10)
 by henry_sys
 on 18.May at 11:27
goto Postmenghitung record dalam perulangan(4)
 by idhiel
 on 16.May at 13:53
goto Posttanya ascii(4)
 by mas_kofa
 on 16.May at 12:11
goto PostRawPrint Untuk Delphi XE2(0)
 by adewijaya
 on 15.May at 22:34
goto Postdatabase error..(4)
 by idhiel
 on 15.May at 15:57
goto Postbekasi, pt arila putra mahkota(3)
 by mas_kofa
 on 15.May at 15:37
goto Postbagaimana cara membaca file *.doc dg delphi?(0)
 by ficky
 on 15.May at 06:14

..:: onLast Articles ::..
..:: New Download ::..
Pascal-id.Org
Feeds -  Popular -  Latest
RE: The Longue
8 months, 3 weeks ago
RE: belajar pascal
8 months, 3 weeks ago
RE: The Longue
8 months, 3 weeks ago
RE: belajar pascal
8 months, 3 weeks ago
RE: Perkenalan dan Absen
8 months, 3 weeks ago
RE: Alhamdulillah Buka Puasa Bersama
8 months, 4 weeks ago
RE: تَقَبَّلَ اللهُ مِنَّا وَمِنْكَ - Selamat Hari Raya Idul Fitri
8 months, 4 weeks ago
Lintas Situs
«
free web site stats and visitor tracking

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
coolmibOffline
Location: Jakarta
Post subject: Menampilkan image  PostPosted: 04/Apr/2006 16:30
onSkilled


Joined: 14-Jan-2006
Posts: 89
Location: Jakarta
Status: Offline
Halo semua...!!
Saya lagi coba buat program kecil u/ view gambar dari file image yg tdk umum (tdk standard). berhubung blm pernah main di graphic yach tdk tau
ada kesalahan dimana. Intinya di file tsb (face.epf) terdapat 2 frame gambar strukturnya bisa dibaca di dlm code. Permasalahannya gambarnya tdk sesuai dgn yg diinginkan (seharusnya) dibagian bawah saya sertakan 2 gbr yg seharusnya ditampilkan (blm diproses) dan 2 lagi setelah diproses.
Untuk tahap skg saya cuman ingin gbr yg ditampilkan sesuai dgn yg blm diproses. Ada yg bisa bantu koreksi??

      Code:

unit ViewEPF;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    Image2: TImage;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
type tEPFHeader = record
     frameCount     : word;
     canvasWidht    : Word;
     canvasHeight   : Word;
     UnknownVar     : Word;
     TocOffset      : integer;
end;
Type tFrameHdr = record
     left : word;
     top  : word;
     right : word;
     bottom : word;
     startOff : integer;
     EndOff : integer;
end;

var
  Form1: TForm1;
  imageFrame : array of tFrameHdr;
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

var dat : TFileStream ;
    test : tEPFHeader;
    appPath:String;
    frameCount,i,j,k : word;
    Bitmap : array of tBitmap;
    value  : byte;
begin
  appPath :=ExtractFilePath(ParamStr(0));
  if not (FileExists(AppPath + 'Face.epf')) then
     //missing
  else begin

     dat := TFileStream.Create(AppPath + 'Face.epf', fmOpenRead, fmShareDenyWrite);
     dat.Read(test.frameCount,2);
     frameCount:=test.frameCount;   
     setlength(imageFrame,frameCount);
     setlength(Bitmap,frameCount);
     dat.Read(test.canvasWidht,2);
     dat.Read(test.canvasHeight,2);
     dat.Read(test.UnknownVar,2);
     dat.Read(test.TocOffset,4);
     dat.Seek(test.TocOffset,soFromCurrent);
     for i := 0 to frameCount -1 do begin
         dat.Read(imageFrame[i].left,2);
         dat.Read(imageFrame[i].top,2);
         dat.Read(imageFrame[i].right,2);
         dat.Read(imageFrame[i].bottom,2);
         dat.Read(imageFrame[i].startOff,4);
         dat.Read(imageFrame[i].endOff,4);
     end;
     for i := 0 to frameCount -1 do begin
       bitmap[i] :=TBitmap.Create;
       Bitmap[i].Height := test.canvasHeight;
       Bitmap[i].Width  := test.canvasWidht;
       bitmap[i].Transparent := true;
       dat.Seek(imageframe[i].startOff+12,soFromBeginning);
       FOR j := 0 TO Bitmap[i].width-1 DO
       BEGIN
        FOR k := 0 TO Bitmap[i].Height -1 DO begin
         dat.read(value,1);
         bitmap[i].Canvas.Pixels[j,k]:=value; {Kemungkinan kesalahan di sini}
        end;
       END;
     end;
    Image1.Picture.Graphic :=Bitmap[0];
    Image2.Picture.Graphic :=Bitmap[1];
    for i:=0 to frameCount -1 do
    Bitmap[i].Free; 
    dat.Free;
  end;
end;

end.


File EPF-nya bisa diambil disini
Hasil dari Code di atas
 
 View user's profile Send private message Yahoo Messenger  
Reply with quote Back to top
coolmibOffline
Location: Jakarta
Post subject:   PostPosted: 05/Apr/2006 15:46
onSkilled


Joined: 14-Jan-2006
Posts: 89
Location: Jakarta
Status: Offline
setelah trial error sekian lama, akhir ketemu... lsg gambar aslinya !!!!
      Code:

unit ViewEPF;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    Image2: TImage;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
type tEPFHeader = record
     frameCount     : word;
     canvasWidht    : Word;
     canvasHeight   : Word;
     UnknownVar     : Word;
     TocOffset      : integer;
end;
Type tFrameHdr = record
     left : word;
     top  : word;
     right : word;
     bottom : word;
     startOff : integer;
     EndOff : integer;
end;
type tPalleteColor = record
     red   : byte;
     green : byte;
     blue  : byte;
     alpha : byte;
end;

var
  Form1: TForm1;
  imageFrame : array of tFrameHdr;
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

var dat,dPal : TFileStream ;
    test : tEPFHeader;
    appPath:String;
    frameCount,i,j,k : word;
    Bitmap : array of tBitmap;
    value  : byte;
    tpc : array[0..255] of tPalleteColor;
begin
  appPath :=ExtractFilePath(ParamStr(0));
  if not (FileExists(AppPath + 'Face.epf')) then
     //missing
  else begin

     dat := TFileStream.Create(AppPath + 'Face.epf', fmOpenRead, fmShareDenyWrite);
     dpal:= TFileStream.Create(AppPath + 'Face.pal', fmOpenRead, fmShareDenyWrite);
     //load the pallete
     dpal.Seek(39,soBeginning); // 38 byte of header ??
     for i := 0 to 255 do begin
       dpal.Read(tpc[i].red,1);
       dpal.Read(tpc[i].green,1);
       dpal.Read(tpc[i].blue,1);
       dpal.Read(tpc[i].alpha,1);
     end;
     dat.Read(test.frameCount,2);
     frameCount:=test.frameCount;
     setlength(imageFrame,frameCount);
     setlength(Bitmap,frameCount);
     dat.Read(test.canvasWidht,2);
     dat.Read(test.canvasHeight,2);
     dat.Read(test.UnknownVar,2);
     dat.Read(test.TocOffset,4);
     dat.Seek(test.TocOffset,soFromCurrent);
     for i := 0 to frameCount -1 do begin
         dat.Read(imageFrame[i].left,2);
         dat.Read(imageFrame[i].top,2);
         dat.Read(imageFrame[i].right,2);
         dat.Read(imageFrame[i].bottom,2);
         dat.Read(imageFrame[i].startOff,4);
         dat.Read(imageFrame[i].endOff,4);
     end;
     for i := 0 to frameCount -1 do begin
       bitmap[i] :=TBitmap.Create;
       Bitmap[i].Height := test.canvasHeight;
       Bitmap[i].Width  := test.canvasWidht;
       bitmap[i].Transparent := true;
       Bitmap[i].PixelFormat := pf24bit;
       dat.Seek(imageframe[i].startOff+12,soFromBeginning);
       FOR j := 0 TO Bitmap[i].height-1 DO
       BEGIN
        FOR k := 0 TO Bitmap[i].Width -1 DO begin
         dat.read(value,1);
         bitmap[i].Canvas.Pixels[k,j]:=RGB(tpc[value].red,tpc[value].green,tpc[value].blue);
        end;
       END;
     end;
    Image1.Picture.Graphic :=Bitmap[0];
    Image2.Picture.Graphic :=Bitmap[1];
    for i:=0 to frameCount -1 do
    Bitmap[i].Free; 
    dat.Free;
    dpal.Free;
  end;
end;

end.


 
 View user's profile Send private message Yahoo Messenger  
Reply with quote Back to top
LuriDarmawan
Location: here
Post subject:   PostPosted: 05/Apr/2006 19:24
onApaAdanya


Joined: 15-Mar-2005
Posts: 1617
Location: here
kuuullllll..... Smile
ga percuman deh ngasih space gratiss..
tp kalo bisa blog-nya diisi tentang delphi dong..
xixixiix....

semangat semangaattt...

_________________
KIOSS Project, http://kioss.com

http://Delphi-Id.Org | http://Fox-Id.Org | http://PHP-Id.org | http://InfoBencana.web.id
http://opensource-indonesia.com | http://VideoSilat.com | http://SilatIndonesia.com
 
 View user's profile Send private message Visit poster's website Yahoo Messenger  
Reply with quote Back to top
coolmibOffline
Location: Jakarta
Post subject:   PostPosted: 06/Apr/2006 09:17
onSkilled


Joined: 14-Jan-2006
Posts: 89
Location: Jakarta
Status: Offline
Kalo bedah file graphic dgn delphi bisa khan??
.... Tapi ternyata byk variantnya... Hrs pelajari lagi Sad
 
 View user's profile Send private message Yahoo Messenger  
Reply with quote Back to top
DelphiExpert
Location:
Post subject:   PostPosted: 06/Apr/2006 09:31
onMage


Joined: 06-Feb-2006
Posts: 2401

Bedah ginjal aje bisa palagi bedah graphic xixixixi...

Kuul... kuul man... you're kuuuul kukukuk Very Happy

Ternyata pake format EPF ya, hikhik... udah di benchmark pake metode Canvas.Pixel lambat ngga'?
Ngga' kerasa si kalo datanya imut, kalo gedhe huhuhu... lemoot...

Semangat... semangaaaaaattt hehehe

_________________
Dude, if you don't understand the basics and just want to get someone else write the code for you, it means you really shouldn't study computer science. Find a different field.
http://delphiexpert.wordpress.com
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
coolmibOffline
Location: Jakarta
Post subject:   PostPosted: 06/Apr/2006 09:39
onSkilled


Joined: 14-Jan-2006
Posts: 89
Location: Jakarta
Status: Offline
Iya...dah kerasa nih lambatnya...padahal baru file ukuran 1MB, blom yg belasan MB... ada solusi lain ??
 
 View user's profile Send private message Yahoo Messenger  
Reply with quote Back to top
DelphiExpert
Location:
Post subject:   PostPosted: 06/Apr/2006 12:12
onMage


Joined: 06-Feb-2006
Posts: 2401

Solusi terbaik mungkin cari dulu library EPF, baca stream per block-frame (ngga' usah satu2 per RGB color info), lalu load pake lib EPF dari stream.

Itu baru cepet Very Happy
Semangat... semangaaatt... kukuk

_________________
Dude, if you don't understand the basics and just want to get someone else write the code for you, it means you really shouldn't study computer science. Find a different field.
http://delphiexpert.wordpress.com
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
coolmibOffline
Location: Jakarta
Post subject:   PostPosted: 06/Apr/2006 14:27
onSkilled


Joined: 14-Jan-2006
Posts: 89
Location: Jakarta
Status: Offline
EPF yg satu ini beda... kalo ada librarynya mungkin harus minta dulu ke nexon atau nexus :p

Ngomong-ngomong si Zeal kok gak kelihatan yach?? apa dah kapok main dgn graphic Laughing Laughing Laughing
 
 View user's profile Send private message Yahoo Messenger  
Reply with quote Back to top
ZeALOffline
Location:
Post subject:   PostPosted: 07/Apr/2006 09:32
onProfessional


Joined: 07-Apr-2005
Posts: 763

Status: Offline
ade ape nih name aye disebut-sebut...??

oww.. masale grapik-grapikan... solusi mudah dari aye ya udah aye bilang, per-piksel, dan uda pasti lambreta begondong... (kayak kode ente itu loh).
Kalo dimasupin alias dinongolin alias ditampilin gambarnye sekaligus, tumplek-plek, wah.. aye kagak tau tuh caranye... aye juga pengen tau malahan..

kerjaan aye lagi mepet banget nih waktunye.. dah 1 bulan blon aye beresin web kerjaan aye.. jadi umpame aye kagak nongol, maklumin aje yee....

okey, beibeh..

_________________
do i know you?

[ My Blog : http://www.monyetpinter.com ] [ My RPG Project : http://einarc.wordpress.com ] [ FJBex : http://www.fjbex.com ]
 
 View user's profile Send private message  
Reply with quote Back to top
coolmibOffline
Location: Jakarta
Post subject:   PostPosted: 08/Apr/2006 11:41
onSkilled


Joined: 14-Jan-2006
Posts: 89
Location: Jakarta
Status: Offline
Kalo seandainya kita tau nilai dari masing-masing variable RGB (Red, Green, Blue) plus nilai alpha.
Gimana cara u/ mengimplementasikan nilai alpha ke dlm pixel seperti code dibawah ini :

bitmap.Canvas.Pixels[k,j]:=RGB(apal[value].red,apal[value].green,apal[value].blue)
 
 View user's profile Send private message Yahoo Messenger  
Reply with quote Back to top
DelphiExpert
Location:
Post subject:   PostPosted: 08/Apr/2006 15:33
onMage


Joined: 06-Feb-2006
Posts: 2401

Coba pake metode ini:
1. Gambar ke bitmap canvas sesuai dengan nilai RGB asli
2. Setelah selesai baru di apply kan Alpha Channel operation-nya

_________________
Dude, if you don't understand the basics and just want to get someone else write the code for you, it means you really shouldn't study computer science. Find a different field.
http://delphiexpert.wordpress.com
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
pebbieOffline
Location: di dapur
Post subject:   PostPosted: 16/Sep/2006 10:19
onUber-Skilled


Joined: 16-Sep-2006
Posts: 459
Location: di dapur
Status: Offline
jangan pake pixels.. luambate bukan main..
pake scanline aja.. akses RGB/RGBA langsung..
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 12 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic





Powered by PNphpBB2 © 2003-2009 The Zafenio Team
Credits


| Register | Lost Password ? |