Programming Languages For Graphics
Programming Languages For Graphics
A high-level language and programming interface used to create graphics images is known as
graphics lanaguage. Graphics applications make programming calls to the application
programming interfaces (APIs) of the language, and the graphics drivers (Note: a computer to
run this language must have a graphics card like Nvidia) render the images on the screen or
printer. The major graphics languages are GDI, DirectX, QuickDraw, Display PDF and OpenGL.
Windows uses GDI and DirectX, while the Mac uses QuickDraw and Display PDF. OpenGL
drivers are available for Windows and Unix and the Mac via X Window.
A visual programming language (VPL) allows the programmers to perform the coding
graphically. We can classify a VPL on a higher level than text-based high-level environments like
C, Java, Python, etc.
The visual programming languages provide a collection of graphical elements such as spatial texts,
nodes, and icons that users assemble to program.
Hence, an interconnected set of objects refers to a method accomplishing a specific result with or
without inputs. A system may execute a graphical program with an interpreter or a compiler.
Like syntax in a text-based language, the users have to follow some particular spatial grammar
while writing visual programs.
The graphical program may have a graphical user interface. For example, in creating a graphical
program, the user can create a front panel or a user interface panel.
The front panel may include various graphical user interface elements or front panel items, such
as user interface controls and indicators, which represent or display the relevant input and output
that will be used by the graphical program, and this may include other icons that represent. Devices
are being controlled.
Step1: Download the Graphics header files and other stuff needed.
Step 3: Navigate to the file manager location where DevC++ is installed. Go to the MinGW64
folder. Copy the graphics. h and winbgim.h in the include folder and D:\Dev-
Cpp\MinGW64\x86_64-w64-mingw32\include folder.
Step 4: Copy the libbgi.a file into lib folder and in D:\Dev-Cpp\MinGW64\x86_64-w64-
mingw32\lib folder.
Step 8: In the “parameter” tab write the following text in “Linker” field.
-lbgi
-lgdi32
-lcomdlg32
-luuid
-loleaut32
-lole32
Click OK.
Step 9: Now you can write and compile any graphics program in C++. You can check the following
code
#include<graphics.h>
#include <conio.h>
int main()
initgraph(&gd,&gm, “C:\\tc\\bgi”);
circle(300,300,50);
closegraph();
getch();
The intigraph() a graphic driver to initialize the graphic system from disk.
5. LabVIEW
In the graphics applications, there is a graphing window call the front panel. Another window is
the block diagram, which serves the functional graphical code that a programmer writes. By right-
clicking on the front panel, you will see a control palette.
You can drop any object such as buttons, text block, graphs, displays, etc., from the front panel’s
palette. You can select any of these objects and resize or recolour from the status bar menus.
On creating an object, a corresponding item is created on the block diagram associated with it.
On clicking on the block diagram object, you will see different functions like numerical, structures
and Boolean, string, and mathematical functions you can use to program by that object. Block
diagram allows programmers to create an object such as variables in the area.
When clicking on an item in the front panel, we get a control palette, and on a block diagram
object, we see a function palette. You can drag an object in the front panel to position its
corresponding item in the block diagram.
On hovering over a block diagram item, you will see a cursor enabling you to make a wire and
attach it to another object on the same side of the LabVIEW.
These wires are the flow of data from one item or function to another one. On the top left corner,
click the button ‘run’ to execute your graphical program.
6. Scratch
What to do first
Scratch is a small graphical character that performs actions. A programmer can use a sprite
in his/her project from several in-built sprites in Scratch.
The stage is the working area where the sprite(s) perform actions as per the instructions. It
is a two-dimensional x-y coordinate by which you can see the position of the sprite. You
can run your projects, play games, and watch stories that you programmed in the area.
Sprite list shows all the thumbnails of available sprites in Scratch.
Presentation mode is a button located at the top left corner. By clicking the button, you can
see the project running on the computer screen in full screen.
Cursor tools have different options for a sprite, such as duplicate, resize, etc.
New sprite buttons allow you to create a new sprite of your own, import, or use an existing
one.
Block palettes are an area where you can add multiple blocks to program your project and
give actions to the sprite. Different blocks are connected like a puzzle, and the sequence
determines the execution flow.
This script area is a place where you create a script of a particular task. You can drag a
block from the blocks palette and drop in the script are stepwise to define the instruction.
You can edit the parameters in scripts to program with your own needs. For instance, in
the move steps block, you can change the numbers of steps.
That’s all about the scratch introduction and its components. You can use them for creating an
interactive program or story.
Other languages like C, Python and Java may require additional header files, packages or libraries
to run graphics easily.