Turn Pixmap into color TV Static

Started by Baggey, March 20, 2023, 13:01:58

Previous topic - Next topic

Baggey


Trying to get this code to work with a Stream Sending random Bytes.

Dont really understand the use of capacity, thought it should return size in bytes :-*

So im trying to send random bytes so that the image will turn into TV Static.

I may of misunderstood what a Stream is As well!? :-\

oh you'll need the Commodore Pixmap find attached. myimage.png

Runable BlitzmaxNG code
SuperStrict
Graphics 800,600

'load any image
Global Image:TPixmap = LoadPixmap("myimage.png")
Global Size:Int = Image.capacity

Print "Image Capacity"=Size ' Capacity is 0 ???????

' Create Memory ram Bank:
Global Ram: TBank = CreateBank(size)
' Create Pointer to emory TBank
Global RamPtr: Byte Ptr= LockBank(Ram)

' Create stream to the RAM
Global Stream:TStream = CreateRamStream( RamPtr, Size, 0, WRITE_MODE_OVERWRITE)


While Not AppTerminate() And Not KeyHit(KEY_ESCAPE)

' Sending ranom bytes should make Image like TV static
For Local i:Int= 0 To Size-1
 
 Stream.WriteByte Image.Pixels[Rand((254)+1)&255] ' & with 255 Ensuring data is in Byte form!
 
 DrawPixmap(image,0,0)
 Flip(0)
 Delay 1000
 
Next

Wend
 
Kind Regards Baggey
Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on Acer 24" . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!