Solved

Picture/Image Wipe - VB to Delphi??

Posted on 1998-07-20
7
368 Views
Last Modified: 2010-08-05
Hello...I'm a VB Programmer in the process (early stages) of learning Delphi. Right now I am converting some old programs from VB to Delphi to get a better handle on Delphi's syntax. Please examine the following Visual basic Sub:

Sub Fade(Pic As PictureBox, Style As Integer, Blocks As Integer)

Dim width_section_size As Integer
Dim height_section_size As Integer
Dim i As Integer, j As Integer

'Corrects Blocks if needed
If Blocks < 5 Then Blocks = 5
If Blocks > 100 Then Blocks = 100

'Sets the size of each width section
width_section_size = Pic.ScaleWidth / Blocks

'Sets the size of each height section
height_section_size = Pic.ScaleHeight / Blocks

For i = 0 To Blocks
  For j = 0 To Blocks
    Pic.Line ((i * width_section_size), (j * height_section_size))-((i + 1) * width_section_size, (j + 1) * height_section_size), , BF
    DoEvents
  Next
  DoEvents
Next
   
End Sub

I have been using this in some of my programs to do a simple wipe from left to right with a pictureBox. I am now trying to do the same thing in Delphi using Image1, but quite frankly I'm having a tough time. Could someone give me a hand in converting this code? I would appreciate any help or assistance.

Thanks in advance.

-S
0
Comment
Question by:summerset
  • 5
7 Comments
 
LVL 3

Expert Comment

by:Matvey
ID: 1358265
Well, here is is:

procedure Fade(Pic: TImage; Style: Integer; Blocks: Integer);
var
  width_section_size: Integer;
  height_section_size: Integer;
  i, j: Integer;
begin
  //Corrects Blocks if needed
  If Blocks < 5 Then Blocks := 5;
  If Blocks > 100 Then Blocks := 100;

  //Sets the size of each width section
  width_section_size := Pic.{Scale}Width div Blocks;

  //Sets the size of each height section
  height_section_size := Pic.{Scale}Height div Blocks;

  for i := 0 to Blocks do begin
    for j := 0 To Blocks do begin
      Pic.Canvas.MoveTo(i*width_section_size, j*height_section_size);
      Pic.Canvas.LineTo((i+1)*width_section_size, (j+1)*height_section_size);
      Application.ProcessMessages;
    end;
    Application.ProcessMessages;
  end;
end;

I didn't post this as an answere becuase I'm not sure what for is this code and what it's supse to be doing. When I execute it it dithers the image very very sloooowllly. I don't have VB here now, so I can't test your code either.
Can you exaplin better what for to write such code ti wipe an image?
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1358266
The Style parameter isn't used... (???)
0
 
LVL 4

Expert Comment

by:jeurk
ID: 1358267
If you'ra new no one may have told you that you can find a lot of components for
delphi.
Fading components exist and work very well.
Go to www.torry.ru and look around in the vcl/graphics-multimedia section
You may find some of them there.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Expert Comment

by:Matvey
ID: 1358268
Fading component? Is that what you're trying to make? If so, just two days ago I made such component - gradient (fading if you want). If you want to see it then you can download it at: http://www.delphipages.com/edit/count.cfm?comID=447&Link=uploads%2FGraphics%2FVIGrdnt%2Ezip


                                SURFACE FILL GRADIENT
                                CONTROL
                                •Fast drawing
                                •Non-Flickering
                                Written with just a few lines of code

0
 

Author Comment

by:summerset
ID: 1358269
Thanks, you're right it is very slow. To answer some of your questions...it's part of a function that does various types of transitions. Wipe left to right, top to bottom, etc. The style parameter would specify which type of wipe if they were all in a case select statement. The part I posted was just left to right. If you'd like the VB .bas file, let me know where to send it.

Thanks for the pointer to the gradient fill -- that is very cool!! But, what I am trying to do is just do a screen wipe from left to right. I have Image1 on a form and I want to wipe to black.

I realize there are a couple of freeware components availabele that do screen transitions like fade, etc., but honestly...as neat as HARMFADE.PAS is...it really doesn't display the images well. The price is right though. :-)

Matvey, you did answer my question, so if you post it again as an answer, I'll give you the points. The example you showed me has helped me understand more about writing my own procedures in Delphi.

Also, if you have any other examples concerning Wipe, Random Pixel Fade, etc. please let me know.

Thanks again!!

Sincerely,

-S
0
 
LVL 3

Accepted Solution

by:
Matvey earned 150 total points
ID: 1358270
Hi, I've found some intersting stuff:

http://bes.trendline.co.il/torry/vcl/graphics/harmfade.zip
"HarmFade is an animation effect. It will transition from one bitmap to another, using "Dissolve" or "Blend"."

http://bes.trendline.co.il/torry/vcl/graphics/wiatile.zip
"Tiles bitmaps images - either simple tiling, transparent tiling or faded tiling"

Hope this is interesting.
--Matvey
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1358271
http://bes.trendline.co.il/torry/vcl/graphics/fximg11.zip
"These two components derived from TGraphicComponent encapsulate the TImage and TLabel characteristics along with special effects during painting. Absolutely necessary for Multimedia developers and those who want to improve their applications' splash screens."

http://bes.trendline.co.il/torry/vcl/graphics/tfx.zip
"An image-component with various FX effects."

http://bes.trendline.co.il/torry/vcl/graphics/ffpbox.zip
"A simple replacement of TPaintBox which provide flickerless redrawing. Very useful when you need to draw complex image with animation effects."

http://bes.trendline.co.il/torry/vcl/graphics/pixelshw.zip
"TPixelShow is a visual component that will show your pictures appearing from pixels."(!!!)

What do you think?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi OLE Error 8 95
Convert Jpg /PNG To GIF 5 120
Virtuailstring tree compare node issue 14 105
Delphi: Connect to running MS Outlook 4 48
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now