Changing display size

Just starting out? Need help? Post your questions and find answers here.
matalog
Enthusiast
Enthusiast
Posts: 165
Joined: Tue Sep 05, 2017 10:07 am

Changing display size

Post by matalog »

I want to write a simple program that will allow the user to input any file (imagine it as a binary), and then use its data to plot a pixel from left to right, plot a pixel if the bit is set and no pixel if the bit is not set, take a new line when width has been met, and continue until the end of the file has been met.

I would like this to be resizable, so that the width can be changed, and the height of the resultant image will be adjusted according to width, so a slider or input box for width would suit.

So if the binary I put in was 8 bytes long (1,255,255,127,3,0,2,255), and the width was set to 8, then the resultant image would come out as: (with 0 as no pixel plotted, and 1 for pixel plotted)

0,0,0,0,0,0,0,1
1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1
0,1,1,1,1,1,1,1
0,0,0,0,0,0,1,1
0,0,0,0,0,0,0,0
0,0,0,0,0,0,1,0
1,1,1,1,1,1,1,1

I would like this to be previewable 'live', so that the required width can be judged based on viewing at least the amount that the monitor height allows - that is, changing the slider will change the width and screen is updated to show new preview. A scrollbar on the side to change the part of the file that you are looking at would be perfect.

Can anyone throw something together that allows a slider to change a preview 'live' so that I can give this a go.

I have done some things in PB before, but not changing the whole output size as a slider is moved.
User avatar
Fig
Enthusiast
Enthusiast
Posts: 351
Joined: Thu Apr 30, 2009 5:23 pm
Location: Côtes d'Azur, France

Re: Changing display size

Post by Fig »

It's possible, but don't you want to give it a try yourself, first ?
At least, give us your actual code...
There are 2 methods to program bugless.
But only the third works fine.

Win10, Pb x64 5.71 LTS
Post Reply