0% found this document useful (0 votes)
66 views5 pages

Graphics Programming Languages Overview

Uploaded by

Daniel Izevbuwa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views5 pages

Graphics Programming Languages Overview

Uploaded by

Daniel Izevbuwa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
  • Introduction to Programming Languages for Graphics
  • Graphics Programming Examples
  • Graphics Programming Techniques
  • Visual Programming Tools

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.

Necessary software/hardware for Graphics Programming


1. Graphics Device Interface (GDI)
The traditional programming interface (API) for output in Windows. When an application needs
to display or print, it makes a call to a GDI function and sends it the parameters for the object that
must be created. GDI in turn "draws" the object by sending commands to the screen and printer
drivers, which actually render the images.
2. Graphics Engine
Hardware that performs graphics processing tasks independently of the computer's CPU. Today's
graphics engine is known as a graphics processing unit (GPU)
3. Graphics Processing Unit (GPU)
A programmable processor specialized for rendering all images on the computer's screen. A
GPU provides the fastest graphics processing, and for gamers, the GPU is a stand-alone card
plugged into the PCI Express (PCIe) bus. GPU circuitry can also be part of the motherboard
chipset or on the CPU chip itself
4. DirectX
A set of Windows interfaces from Microsoft for programming graphics and sound. Windows
developers program to the DirectX APIs, and the manufacturers of sound and graphics cards write
DirectX drivers to be included with their hardware. DirectX provides a high-level interface for
accessing low-level functions "directly." It accesses the hardware abstraction layer in Windows

Highlight of some Graphics Programming Languages


1. QuickDraw
The graphics language in the Mac prior to Mac OS Version 10. It translates elementary
commands in an application to graphics and text elements for the printer and screen. QuickDraw
GX added special effects, better font handling and printer management
2. Display PostScript
The graphics language used in the NeXT machine. It migrated to the Mac as of OS X in the form
of Display PDF. Display PostScript is the screen counterpart of the PostScript printer language.
It translates elementary commands in an application to graphics and text elements on screen.
3. Display PDF
The graphics language used in the Mac starting with Mac OS X, superseding QuickDraw.
Display PDF is the screen counterpart of the PDF printer language. It translates elementary
commands in an application to graphics and text elements on screen. Display PDF is a superset
of Display PostScript with more advanced features including improved color management and
better internal compression.
4. C++

Use the following steps for the graphical program in C++.

Step1: Download the Graphics header files and other stuff needed.

Step 2: Extract the contents of the zip/rar file.

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 5: Copy the [Link], ConsoleApp_cpp_graph.txt files, and paste them


inside the template folder of the dev c++ installer location.

Step 6: Open a new project in Dev C++.

Step 7: click the “Project” and then go to “Project Options.”

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()

int gd = DETECT, gm;

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

 You need to access Scratch from the website or application.

Main components of Scratch

 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.

Figure 1: Scratch Interface: Example of Visual Programming Language

Other languages like C, Python and Java may require additional header files, packages or libraries
to run graphics easily.

Common questions

Powered by AI

In LabVIEW, the front panel serves as the graphical user interface where various control elements like buttons, graphs, and displays are placed. These elements represent inputs, outputs, or control components that users interconnect to interact with the program. In contrast, the block diagram is where the graphical code is executed. It contains the visual programming logic using functions and wires connecting different components to define the data flow and application functionality. The block diagram effectively maps how data moves and transforms between various elements displayed on the front panel .

Visual programming languages, such as Scratch and LabVIEW, provide a graphical way of coding by allowing users to assemble programs with graphical elements like nodes and icons, compared to text-based languages such as C, Java, and Python, which require coding in text form. Unlike traditional languages that require knowledge of syntax and code structures, visual programming relies on spatial grammar where a user arranges graphical elements according to predefined grammars to achieve programming tasks. This approach not only simplifies the programming process for beginners but also focuses on the spatial arrangement and connection of visual elements which is more intuitive for creating GUI-based applications .

A Graphics Processing Unit (GPU) enhances graphical application performance significantly as it is a dedicated hardware component designed for rendering images. Unlike software rendering that relies solely on the computer's CPU, a GPU is optimized to perform complex mathematical calculations related to graphics efficiently. This leads to faster image processing, smoother visual output, and overall reduced load on the CPU, allowing for more extensive graphical operations and better performance in graphics-intensive applications such as gaming .

DirectX enhances the programming experience by providing Windows developers with a high-level interface to access low-level hardware functions 'directly'. This enables efficient manipulation of graphics and sound by allowing access to the hardware abstraction layer in Windows. Developers can program DirectX APIs for their graphics and sound needs, which facilitates faster and more responsive applications. The inclusion of DirectX drivers by manufacturers streamlines the integration with different hardware components, ensuring compatibility and enhancing performance in graphical applications .

To set up a graphical program in C++ using Dev C++, the essential steps include downloading necessary graphics header files and decompressing them. Next, copy 'graphics.h' and 'winbgim.h' to the 'include' folders and 'libbgi.a' to the 'lib' folder under the MinGW64 directory. Then, add and configure project options within Dev C++ by specifying linker parameters. These steps ensure a graphics library is properly linked in the Dev C++ environment, making it ready for writing and compiling graphics programs using standard C++ syntax and graphics-specific functions like 'initgraph()' to initialize the graphics system .

The Graphics Device Interface (GDI) is a traditional API in Windows responsible for rendering graphics and text on screens and printers. When an application needs to display an object, it makes a call to a GDI function with object parameters, prompting GDI to issue commands to the screen and printer drivers, which then render the images. GDI acts as an intermediary enabling consistent rendering output across different graphics hardware .

The benefits of using QuickDraw include its straightforward nature for translating basic graphical and text commands for the screen and printer, making it accessible for simple graphical tasks. However, its limitations in handling advanced graphics, special effects, and complex font management render it less suitable for modern graphical application needs. Display PDF, as its successor, offers enhancements including advanced features like improved color management and compression, making it more proficient for high-quality graphics output and complex applications. These improvements come at the cost of higher complexity, requiring more computational resources compared to QuickDraw .

The main components of Scratch's graphical interface include the stage, sprite list, presentation mode, cursor tools, new sprite buttons, block palettes, and script area. The stage is the visual area where sprites perform actions, serving as the main screen for the output. The sprite list shows available sprites, and the presentation mode allows viewing the project in full screen. Cursor tools enable modifications like duplication and resizing of sprites. The new sprite buttons facilitate creation or import of sprites. Block palettes contain blocks that users can assemble like a puzzle to create scripts, connecting them to define the sequence of actions. These components collectively provide an interactive and intuitive environment for creating programs, stories, and games efficiently .

OpenGL ensures cross-platform support by providing a standard API that operates on various operating systems, including Windows, Unix, and Mac via X Window. It abstracts lower-level hardware details, allowing developers to write code once and run it on different platforms without modification. OpenGL driver availability on these systems ensures compatibility and consistent graphics rendering behavior, fostering broad adoption in applications requiring interoperable graphical computations .

Display PDF improved upon its predecessor, Display PostScript, by offering advanced features such as better color management and improved internal compression. While Display PostScript translated commands to graphics and text elements on screen, Display PDF built upon that functionality by becoming a superset with enhanced capabilities in Mac OS X. This allowed for more precise and efficient rendering of graphical elements, resulting in better visual quality and efficiency .

PROGRAMMING LANGUAGES FOR GRAPHICS 
A high-level language and programming interface used to create graphics images is known a
3. Graphics Processing Unit (GPU) 
A programmable processor specialized for rendering all images on the computer's screen. A
Step 4: Copy the libbgi.a file into lib folder and in D:Dev-CppMinGW64x86_64-w64-
mingw32lib folder. 
Step 5: Copy the Co
5. LabVIEW 
In the graphics applications, there is a graphing window call the front panel. Another window is 
the block diagr
 
Block palettes are an area where you can add multiple blocks to program your project and 
give actions to the sprite. Diff

You might also like