Understanding Graphics API’s

An Introduction To APIs And How They Work

In computer programming, an application programming interface (API) is a set of routines, protocols, and tools for building software applications. An application programming interface (API) is a particular set of rules (‘code’) and specifications that software programs can follow to communicate with each other. It serves as an interface between different software programs and facilitates their interaction, similar to the way the user interface facilitates interaction between humans(user) and computers.

An API is a software-to-software interface and not a user interface, take for example the process of buying items online, you order your item, enter your card details the site uses an API to send your credit card information to a remote application that verifies whether your information is correct. Once payment is confirmed, the remote application sends a response back to the movie Web site saying it’s OK to authorise the purchase. The user has no role to play other than initiating the process.

Let us take another look at how API’s work, this time using actual programming code.

import java.util.Scanner;
public class Test {
public static void main(String[] args) {
System.out.println("Enter your name:");
Scanner scan = new Scanner(System.in);
String name = scan.nextLine();
System.out.println("Your name is" + name + ".");
scan.close();
}
}

Over here is a sample of code written in Java, the methods nextLine() and close() are part of the API for the Scanner class. The nextLine method advances the scanner past the current line and returns the input that was skipped while the close() method closes the scanner.

An API makes it easier to develop a program by providing all the building blocks. A programmer then puts the blocks together.

High-level API

High-level APIs are designed to remove complexity and accelerate design time. A high-level API is a subset or wrapper of a low-level API, and typically delivers the basic requirements of what most developers need today in terms of functionality. The amount of code is greatly reduced for each function, in effect simplifying the development process and enabling the developer to plainly direct the API on what to do.

Low-level APIs

Although there is increasing demand for high-level APIs, there is still a substantial requirement for a low-level option. Developers with experience and expertise demand the granularity and design control only a low-level API can deliver. A low level API offers access closer to the hardware. It allows driving the hardware directly without going through a software translation layer and its associated overhead. A low-level API lets programmers access more intricate hardware features but requires more coding. In contrast, a high-level API may be capable of performing extensive processing with one function call from the application
Typically proprietary, low-level APIs constitute a highly evolved software engine that provides real-time management of resources.

Now that we know what an API is and how it works, let us move into what is a graphics API.

Suvoparno Banerjee

Suvoparno Banerjee

Student , Gamer , Blogger , Audiophile .