ginsonic
asked on
For The Neil
Are U online ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yeah I'm online and should be for about the next 4 hours.
You'll have to load the image in regardless of what format it is so what I'd do is this:
IF Pos('JPG', UpperCase(ExtractFileExt(s Filename)) <> 0
THEN
LoadJPG(sFilename)
ELSE
LoadBMP(sFilename);
Then just make sure that the LoadJPG and LoadBMP routines (which you'll have to write) load the image into the same TBitmap variable.
i.e. LoadJPG loads a JPG (using the code I gave you earlier) into a variable called bmpOrig_IMG and LoadBMP loads a BMP into the same variable
As per usual, anymore help needed just ask
The Neil
You'll have to load the image in regardless of what format it is so what I'd do is this:
IF Pos('JPG', UpperCase(ExtractFileExt(s
THEN
LoadJPG(sFilename)
ELSE
LoadBMP(sFilename);
Then just make sure that the LoadJPG and LoadBMP routines (which you'll have to write) load the image into the same TBitmap variable.
i.e. LoadJPG loads a JPG (using the code I gave you earlier) into a variable called bmpOrig_IMG and LoadBMP loads a BMP into the same variable
As per usual, anymore help needed just ask
The Neil
ASKER
I make a component for this code ( see down of page ).
If I use bmps work perfect .
If use jpeg files I can see the image for PicFrom , but when I command Slide all images are gone
..
:(
........
TGNSlide = class(TGraphicControl)
private
{ Private declarations }
FPicFrom:TPicture;
FPicTo:TPicture;
picT:TPicture;
procedure PictureFrom(Pic:TPicture);
procedure PictureTo(Pic:TPicture);
public
{ Public declarations }
procedure Slide;
published
{ Published declarations }
property PicFrom : TPicture read FPicFrom write PictureFrom;
property PicTo : TPicture read FPicTo write PictureTo;
.........
procedure TGNSlide.Slide;
VAR
bmpTemp : TPicture;
n : INTEGER;
m : INTEGER;
begin
bmpTemp := TPicture.Create;
bmpTemp.Assign(FPicTo);
bmpTemp.Bitmap.Canvas.Draw (0, 0, FPicFrom.Bitmap);
FOR n := 0 TO (PicTo.Width - 1)
DO
BEGIN
FOR m := 0 TO (PicTo.Height - 1)
DO
bmpTemp.Bitmap.Canvas.Pixe ls[n, m] := PicTo.Bitmap.Canvas.Pixels [n, m];
Canvas.Draw(0, 0, bmpTemp.Bitmap);
Application.ProcessMessage s;
END;
bmpTemp.Free;
end;
If I use bmps work perfect .
If use jpeg files I can see the image for PicFrom , but when I command Slide all images are gone
..
:(
........
TGNSlide = class(TGraphicControl)
private
{ Private declarations }
FPicFrom:TPicture;
FPicTo:TPicture;
picT:TPicture;
procedure PictureFrom(Pic:TPicture);
procedure PictureTo(Pic:TPicture);
public
{ Public declarations }
procedure Slide;
published
{ Published declarations }
property PicFrom : TPicture read FPicFrom write PictureFrom;
property PicTo : TPicture read FPicTo write PictureTo;
.........
procedure TGNSlide.Slide;
VAR
bmpTemp : TPicture;
n : INTEGER;
m : INTEGER;
begin
bmpTemp := TPicture.Create;
bmpTemp.Assign(FPicTo);
bmpTemp.Bitmap.Canvas.Draw
FOR n := 0 TO (PicTo.Width - 1)
DO
BEGIN
FOR m := 0 TO (PicTo.Height - 1)
DO
bmpTemp.Bitmap.Canvas.Pixe
Canvas.Draw(0, 0, bmpTemp.Bitmap);
Application.ProcessMessage
END;
bmpTemp.Free;
end;
Hmmm. I'm not a big component expert so I'm not 100% certain as to why it doesn't want to work but I do have an idea. In your Slide routine, replace the TPicture with TBitmap. It could be something to do with the way the JPEG image is stored in the TPicture.
The Neil
The Neil
ASKER
It's work . Thanks .
i have a minir problem .
How can I refresh the PicFrom ?
How can I force the program to repaint the bitmap ?
Only if you can help me .
Thx again for help.
And hope to help me in future .
i have a minir problem .
How can I refresh the PicFrom ?
How can I force the program to repaint the bitmap ?
Only if you can help me .
Thx again for help.
And hope to help me in future .
ASKER
It's work . Thanks .
I have a minor problem .
How can I refresh the PicFrom ?
How can I force the program to repaint the bitmap ?
Only if you can help me .
Thx again for help.
And hope to help me in future .
I have a minor problem .
How can I refresh the PicFrom ?
How can I force the program to repaint the bitmap ?
Only if you can help me .
Thx again for help.
And hope to help me in future .
ASKER
Thanks again Neil .
Anytime Nick
The Neil
The Neil
ASKER
I fix my problem .
Just Refresh :)
See U,
Nick
Just Refresh :)
See U,
Nick
ASKER
How can I know if the picture is jpeg or bmp to know how I will do the slide ?
P.S. I'm on-line . U are ?
If U are on-line too , maybe we will comunicate faster .