TV no signal FX

Hy to all,
I need to create a TV no stignal effect animation .
U know : many random pixels whites, blacks and gry .
And I need speed too . Can anybody help me ?

For example , to create in a rectangle with widh:=320 , height:=240 this FX .
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:
Nick,

I take it my solution wasn't fast enough. What you could do is pregenerate an array of pixel values and then just iterate through that:

VAR
  PreGen : ARRAY [0..512] OF TColor;
....
BEGIN

rGrey_Step := 255 / iNo_Greys;
FOR n := 0 TO 512
DO
BEGIN
  iLevel := ROUND(rGrey_Step * Random(iNo_Greys);
  preGen[n] := RGB(iLevel, iLevel, iLevel);
END;

//Initilaise as before

iCount := 0;
FOR m := 0 TO 240
DO
  FOR n := 0 TO 320
  DO
  BEGIN
    bmp.Canvas.Pixels[n, m] := preGen[iCount];
    iCount := (iCount + 1) MOD 512;
  END;

//Finalise as before
END;

Any good to you?

The Neil
0
GwenaCommented:
Hi quinsonic :-)


So what you want is an effect just like a TV set on an empty channel (snow)?

Why not do it like an animated gif does and just have say 3 images of the snow and swap them in and out...maybe at random... this should be fast
and easy :-)

3 gray scale bmps (8bit) should work... you could use small ones and 'stretch' them somewhat to fit the area you need... I did a small animation this way and it was fast and flicker free.
0
ginsonicAuthor Commented:
Gwena ,
I use a big image . And I think that a code FX is more professional :)
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

ginsonicAuthor Commented:
Sorry Neil but don't work . And is far from what I wish .  
The noise of TV must be bigger than a pixel . And U use many dark color .
I see many demos in Pascal ( unfortunally I don't have anymore ) . Very quickly and cool . I think that use ASM ?!?!.

If U see C&C series games U know the FX .

Regards,
Nick
0
hbraschCommented:
hello,

try this one ... very low cpu utilisation.

At tform1.create add:

 display:=Tbitmap.create;
 display.width:=320;
 display.height:=240;
 display.pixelformat:=pf24bit;

and then ....

Procedure Tform1.Noisy;
type Trgb = record
       b,g,r : byte;
     end;

     trgbarray = array [0..1024] of trgb;
     prgbarray = ^Trgbarray;

var x,y:integer;
    dst: prgbarray;
    n    : byte;
begin

     randomize;
     for y:=0 to display.height-1 do
     begin
          dst:=display.scanline[y];
          for x:=0 to display.width-1 do
          begin
               n:=random(1024+x+y);
               dst[x].r:=n;
               dst[x].g:=n;
               dst[x].b:=n;
          end;
     end;
     canvas.draW(0,0,displaY);
end;

an improvement could be made with
stretchblt or stretchdraw to enlarge
the pixel.

okay, that´s it

Heinz

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:
Heinz,
If you can see me how can enlarge the pixel , the points are your's .
0
hbraschCommented:
hmm... lets see ...
try this one ....

instead of canvas.draw(0,0,display);

canvas.stretchdraw(rect(0,0,640,480),display);

this might help....

Heinz
0
ginsonicAuthor Commented:
Thanks hbrasch
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.