Graphics in Pi console

I want to be able to open a console where I am able to change the window size using the mouse as normal. Then I want to be able to run a program in this console and this program will make the console in graphics mode and will be written in C. I need to be able to draw in the console window in bit map mode. I have seen some low level graphics programming here: http://raspberrycompote.blogspot.com/2012/12/low-level-graphics-on-raspberry-pi-part_9509.html , but I understand that this takes over the whole screen. I need to be able to do this sort of thing inside a console window - how do I do it?

Hi Clem,
I will start by recommending you start looking into how to code with a GUI(Graphical User Interface). I am a little unclear on what you mean by console, are you hoping to use the graphical interface over a text-based console like SSH?

by console I mean the text based command window, I think the proper name is terminal, where one can run programs by typing the program name. This is a text based window which can be moved and resized over the Pi screen using the mouse running linux.

I want to be able to open such a window / console / terminal normally in text mode. Then I want to be able to type a program name which I have written in C and compiled. This program will reconfigure the screen in the window / terminal area and write to the window area in graphics mode like the link which I included, only to apply only within the window not to the whole screen. I intend receiving data from a port and displaying it graphically. I want to be able to write graphics to this screen area in a similar manner to what is done with the link I provided. There is no commodification required with the program from the mouse or keyboard once the program has started running. I will need a means of stopping the program from running and returning to the text mode and a normal terminal. I will be able to do this by communication via the port as already mentioned.

This aught to be simple to do - I do not want to get into a lot of operating system interface GUI etc complexity etc which I do not have time to lean and do not need anyway.

I am wanting to program graphics in C just like the link I provided only to apply to the window only and not the whole screen.

Please advise

Hi Clem,

Here are some tools that you can use:
http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/menus.html
http://www.gnu.org/software/ncurses/

I have just gone through the link on GUI which was suggested - this is all about user interface and with text. Also it is with python which I believe will not run as fast as compiled C code. Also no prospect of programming in the window in fast graphics mode.

I simply want to open a new terminal, and in that terminal run a program which I have written in C. This program will change the window to graphics mode open a port to receive data via Ethernet packets and display the received data graphically according to algorithms which I will write.

The window needs to be able to be resized and translated by the mouse or by the Ethernet data. The program needs to be able to be terminated by Ethernet data or by mouse clicking on close window.

I do not need any secure communication like SSH.

Hi,

I do not believe I need a menu system.

I would be happy if I could open a terminal and run a program which I have written from the terminal command line. This program needs to be able to open a new window ( in graphics mode) somewhere on the screen ( linux system) and be able to open an Ethernet port to receive data which will be streemed to it. The program will receive this data and through an algorithm which I will write in C write inside the window in graphics made, that is I need to be able to set a pixel in the window display area to a colour or write a line from pixel coordinate (x1, y2 to x2,y2) like the link I provided. The window needs to be able to be translated across the screen using the mouse and dragged to change its size / shape using the mouse. The only interaction the program needs to have with the terminal is to stop the program using control C. I do not want to have to try to understand millions and millions of functions and commands which I will not be using.

I was hoping surly someone on the forum has done something in ‘C’ which will operate a window in graphics mode and can point me in the right direction to the specific area of need.

Regards

Hi Clem,

I’m not sure how you would accomplish this. It seems to be rather complicated to me. I haven’t been able to find anything referencing this sort of operation online either. Good luck with your technological journey!

Lets make this simpler:

I need to be able to write a program in C which I can run from a standard terminal.
Upon execution of this program, it will open a graphics window on the screen such that what is within the window will be in graphics mode and what is outside of it is not. The mouse does not have any functionality with the program. The mouse is permitted to wonder over the window but cannot interact with anything in the window and will be blocked from interacting with anything which was behind the window. Alternatively the mouse can move over the window and interact with anything behind the window - which ever is easier. The mouse cannot resize the window or click in the window area to have any effect of the program - if that makes the problem easier.

The window is translatable and able to change its length and height on the basis of keyboard commands to the terminal or alternatively from data sent to the program via Ethernet communication.

the program needs to be able to receive streaming data via the Ethernet interface, convert that data to graphics by drawing directly to the window area. There does not need to be a close or shrink button on the window, it will not be controlled by the mouse. Everything within the graphics area will be determined by the program, everything outside the window will be as normal. There might need to be a layer so that the window can be behind or in front of another window.

So, a program needs to be able to define a region of the screen in pixels. This needs to be movable during the running of the program. The program while running needs to receive port data and update the graphics continually.

When the program is terminated it needs to close the window and return the screen to what it was.

I suspect that this is not really so complicated and likely to be able to be done with the right library or use of inbuilt functions. I do not think this is difficult, but how to find out how to do this I have no idea.

I would think that this is the sort of thing that hackers would have some idea.

Hi Clem,

As soon as you start talking in windows you need to be using a GUI, there is not as far as i know a simpler way to interface with a program graphically.
I found a forum thread on the Raspberry Pi forums that links to a couple different tools for making GUIs.
https://www.raspberrypi.org/forums/viewtopic.php?t=204631

The terminal is normally only text based, but some terminals actually support pixel mode graphics. E.G. Dec vt320, which I think is supported on raspian. There probably more but the Dec vtnnn terminals are well documented, so you should have no problems with finding documentation.

So set your TERM=“vt320”

Now find a programmers guide for the vt320 and see what you get it to do.

I would be interested to see what you can do.

1 Like