Display an image pixel by pixel ( wipe FX )

I have a jpeg image and I wish to disply it with an wipe effect .
For example :
I need to display pixel by pixel first line . Then at last pixel of first line to display up to down last column of pixels .
At end of colomn to revers lighting of pixel from last pixel of last line to first pixel of same line and......

I wish to create a spirale ( circle ) display effect .
LVL 9
ginsonicAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TheNeilCommented:
Get your JPG into a TBitmap variable and then use the Pixels property of the canvas (TBitmap.Canvas.Pixels). This will be slow but you can then create a second TBitmap and copy across the pixels that you need in any way that you want.

To do a horizontal wipe (Assuming you have your JPG in a TBitmap called bmpOrig):

bmpTemp := TBitmap.Create;
bmpTemp.Assign(bmpOrig);
bmpTemp.Canvas.Brush.Color := clBlack;
bmpTemp.Canvas.FillRect(RECT(0,0,bmpTemp.Width, bmpTemp.Height));

FOR n := 0 TO (bmpOrig.Width - 1)
DO
BEGIN
  FOR m := 0 TO (bmpOrig.Height - 1)
  DO
    bmpTemp.Canvas.Pixels[n, m] := bmpOrig.Canvas.Pixels[n, m];
  Image1.Canvas.Draw(0, 0, bmpTemp);
END;
bmpTemp.Free;

This will create the second bitmap, copy each column of pixels across from the original image, and throw it at the screen (into Image1) when each column is copied. I know it would be quicker to copy the entire row of pixels in a single copy but this demonstrates the use of the pixel property. Of course doing everything in memory helps.

If you need the spiral effect then just modify the mapping from the original bitmap to the temporary bitmap so that it follows the pattern that you want (or ask)

The Neil
0
ginsonicAuthor Commented:
Hy Neil ,
I try your code but don't work .
Please, can you send me a project ?
My e-mail is nick@radioterra.ro

Regards,
Nick
0
ginsonicAuthor Commented:
Put an answer.
Thanks . It work .


I have a new question : How can I have an another Image in bmpTemp ?

I wish to display an image and then to wipe a second image over first .
To have an image , not a black background .
If you can help I will increase the points with another 100 .
Best regards,
Nick
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

TheNeilCommented:
Ok, here's an answer (for the original question).

For the second question, just draw your first image onto bmpTemp rather than draw the black rectangle. The code will then wipe the new image over the top of it.

To make sure that it wipes properly (i.e. doesn't miss bits) make sure that the two images are the same size, and replace the lines

bmpTemp.Canvas.Brush.Color := clBlack;
bmpTemp.Canvas.FillRect(RECT(0,0,bmpTemp.Width, bmpTemp.Height));

with this:

bmpTemp.Canvas.Draw(0, 0, bmpNew_Image);

You just have to make sure that the second image is stored in bmpNew_Image

If the images AREN'T the same size then there are several things to do but I'll go into that only if you need it.

The Neil
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ginsonicAuthor Commented:
Thanks!
0
ginsonicAuthor Commented:
Neil ,
Have you received my 200 points ?
Please send a mail to aknowledge me .
Nick
0
TheNeilCommented:
Ginsonic,

Yeah I got the points. Thanx

The Neil
0
ginsonicAuthor Commented:
Hy Neil . Sorry , I lose your email address .
I test your code with jpeg file ( not bmps ) and don't work . I try to modify the codes but don't work . I'm not very good in D :(

Help me and I will put a new question for you  ( FOR NEIL title ) with another 100 points .
0
TheNeilCommented:
No problem Nick (neils@minorplanet.com if you need it).

The solution was for BMPs as Delphi can't manipulate JPGs itself. What we need to do is get the code to load a JPG end convert it to a BMP - easy.

PROCEDURE JPG2BMP(Filename : STRING);
VAR
  JPEG : TJPegImage;
  BMP  : TBitmap;
BEGIN
  JPEG := TJPegImage.Create;
  BMP := TBitmap.Create;

  JPEG.LoadFromFile(Filename);
  BMP.Assign(JPEG);
  JPEG.Free;

//Image can now be used from here until the bitmap is destroyed

  BMP.Free;
END;

MAKE SURE THAT YOU HAVE THE JPEG UNIT IN YOUR USES SECTION (it's called Jpeg).

The JPG is then copied into your BMP (after the Assign) and you can use it as before.

Any problems, just ask

The Neil
0
ginsonicAuthor Commented:
I make a question for you . Look for 'For The Neil'.
I will test the code in today and I hope to give the points tonight .
CYA
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.