Fact-checked by Grok 2 weeks ago

Borland Graphics Interface

The Borland Graphics Interface (BGI) is a graphics library developed by in 1987 for operating systems, bundled with compilers such as , , and to enable developers to create portable applications across diverse video hardware. It provided a standardized for drawing primitives like lines, circles, and text, supporting common modes such as CGA, EGA, and VGA through loadable drivers that abstracted hardware differences. BGI's key features included support for 16-color palettes, filled shapes, and vector-based stroked fonts, making it accessible for educational and hobbyist programming and Pascal during the late and early . Third-party extensions expanded compatibility to SVGA cards, printers like , and plotters, while its simple function calls—such as initgraph(), line(), and circle()—fostered widespread adoption in DOS-era games, utilities, and tutorials. Though officially supported by Borland until around 1992, BGI's legacy persists through open-source ports like WinBGIm (developed from 1998 onward for Windows) and SDL_bgi (for modern systems), which maintain its API for compatibility with legacy code and introductory computer graphics education.

Overview

Introduction

The Borland Graphics Interface (BGI) is a device-independent graphics library developed by Borland International for DOS-based programming on IBM PCs and compatible systems. Introduced in 1987 with Turbo C version 1.5, it enables developers to implement 2D graphics in C, C++, and Pascal programs without requiring direct access to underlying hardware details. BGI abstracts graphics operations, allowing applications to produce drawings, text, and images portably across diverse display adapters. The library's key purpose is to streamline the creation of cross-hardware compatible graphics applications. By providing a unified , BGI reduces the complexity of supporting multiple graphics modes and drivers, fostering wider adoption in DOS-era development. Its scope is confined to raster-based operations, including shapes, fills, and bitmapped text output, with no built-in support for graphics, audio, or interactive event handling. At its core, BGI relies on modular components: the graphics.h header file and graphics.lib library for C/C++ integration, alongside the unit for Pascal programs. Hardware compatibility is achieved through dynamically loadable files (e.g., .bgi extensions like egavga.bgi), which are selected and initialized via functions such as initgraph to detect and configure the system's graphics mode. This structure ensures straightforward setup while maintaining focus on essential 2D raster capabilities.

Design Principles and Goals

The Borland Graphics Interface (BGI) was fundamentally designed as a device-independent library to enable developers to write portable that could run consistently across the diverse and fragmented PC of the , such as CGA, EGA, and VGA adapters, without requiring hardware-specific modifications. This core goal addressed the era's challenge of incompatible standards, which forced programmers to rewrite applications for each display type, thereby promoting a unified that abstracted underlying differences and ensured reliable output on various systems. A key emphasis in BGI's design was simplicity, particularly for beginners and educators, by providing a high-level focused on intuitive drawing primitives like lines, circles, and text output, rather than demanding low-level pixel manipulation or direct hardware register access. This approach reduced the for graphics programming in environments, allowing novice users to create visual applications with minimal while fostering conceptual understanding over intricate technical details. The library's streamlined functions prioritized , making it suitable for introductory programming courses and . However, these design choices involved deliberate trade-offs, favoring ease of use and broad compatibility over high performance or cutting-edge capabilities; for instance, BGI relied on software rendering without and supported only palette-based colors (up to 16 in base modes) rather than depth, limiting its suitability for demanding applications. This reflected the priorities of the time, where the need for a straightforward, cross-hardware solution outweighed the inclusion of advanced features that might compromise portability on lower-end systems.

History and Development

Origins and Initial Release

The (BGI) was developed by International in to provide a device-independent for DOS-based programming on PC compatibles, addressing the growing need for visual applications in an era when graphical user interfaces and data visualization were emerging in the personal computing landscape. This development aligned with 's emphasis on creating fast, integrated development environments that simplified complex tasks for programmers, building directly on the Graph unit introduced in 4.0 earlier that year, which had already established a foundation for portable routines. By adapting these Pascal-based routines for , Borland aimed to extend similar ease-of-use to C developers, complementing the language's rising prominence in systems and application programming. BGI made its first public release as part of Turbo C version 1.5 in late 1987, bundled with the compiler to enable immediate access to over 70 graphics functions for drawing, filling, and text output. The library supported initial drivers for common PC graphics hardware, including the Color Graphics Adapter (CGA) for basic color modes, the Enhanced Graphics Adapter (EGA) for higher resolutions, and the Hercules monochrome adapter for text-based systems, allowing programs to automatically detect and adapt to installed hardware via functions like initgraph(). These drivers were distributed as loadable .BGI files, promoting portability without requiring recompilation for different video cards. BGI rapidly gained traction among educational institutions and hobbyist programmers in the late 1980s, becoming a for introductory programming due to Borland's Turbo series dominance in the affordable compiler market, which democratized access to professional tools. Its integration with facilitated simple yet powerful visualizations in tutorials, games, and prototypes, filling a gap left by more cumbersome hardware-specific APIs prevalent at the time.

Evolution and Integration with Borland Compilers

Following its initial release in 1987 with , the Borland Graphics Interface (BGI) underwent enhancements starting with in 1989, which expanded support for additional graphics drivers to accommodate emerging hardware like EGA and early VGA adapters. These updates included improved driver loading mechanisms, such as dynamic registration via functions like registerbgidriver, allowing developers to integrate custom hardware support more seamlessly within Borland's C++ environment. By the late , BGI also added printer and drivers, such as those for Epson-compatible devices, enabling direct output of graphics to non-screen peripherals for applications requiring hard-copy rendering. BGI's integration deepened with Borland's compiler suite, bundled as graphics.lib in and subsequent IDEs for easy linking in DOS-based C/C++ programs. In , it manifested as the Graph unit (GRAPH.TPU), providing over 50 routines for device-independent , initialized via InitGraph and supporting drivers for adapters like CGA, EGA, VGA, , and 8514. This embedding extended to Borland's productivity tools, where BGI powered UI elements like charts and diagrams in and for enhanced visual data presentation. Key evolutions in the included the bgiobj.exe utility, introduced around 1993, which converted .BGI driver and .CHR font files to .OBJ objects for static linking, reducing runtime dependencies and executable size. BGI reached its peak integration in Borland C++ 4.52 (released in 1995), featuring comprehensive driver and font support, including full ASCII character sets and scalable stroked fonts for professional applications. This version, along with the 1997 update to Borland C++ 5.02, represented the height of BGI's utility within 's ecosystem, with for graphics in Windows-hosted environments. However, the mid-1990s shift toward Windows APIs diminished BGI's relevance for new -centric development, as prioritized native Windows tools like , leading to the phasing out of official BGI support by 1997.

Technical Architecture

Core Functions and API

The Borland Graphics Interface (BGI) provides a C-language application programming interface (API) defined in the graphics.h header file, enabling developers to perform 2D graphics operations in DOS-based environments. This API abstracts hardware-specific details through a set of functions that handle initialization, drawing, text rendering, filling, and error management, primarily using integer-based parameters for coordinates and colors. Central to the API is the initialization function void initgraph(int *graphdriver, int *graphmode, char *pathtodriver), which sets up the graphics system by loading a driver, selecting a mode, and specifying the path to driver files; the DETECT constant (value -1) allows automatic hardware detection for the graphdriver parameter. Drawing primitives include void line(int x1, int y1, int x2, int y2) for rendering straight lines between two points, void circle(int x, int y, int radius) for outlining circles centered at specified coordinates, and void rectangle(int left, int top, int right, int bottom) for drawing rectangular outlines, all using the current drawing color. Color selection is managed via void setcolor(int color), where the color parameter is an integer from the adapter's palette, typically ranging from 0 () to 15 () in standard modes. Text output is facilitated by void outtextxy(int x, int y, char *textstring), which displays a at the given position using the current font and color. Fill operations encompass void floodfill(int x, int y, int border), which fills an enclosed region starting from a seed point up to a specified border color using the current fill settings, and void setfillstyle(int pattern, int color), which configures the fill pattern (e.g., 1 for solid fill, or 2–11 for hatched patterns) and associated color for subsequent filled shapes. Error handling in the API relies on int graphresult(void), which returns an from the most recent (0 indicating success), often paired with grapherrormsg(int errorcode) to retrieve a descriptive string. The API enforces limitations such as exclusive use of coordinates, precluding sub-pixel precision, and a fixed color palette constrained by the (e.g., up to 16 colors in VGA modes).
FunctionPrototypeKey ParametersPurpose
initgraphvoid initgraph(int *graphdriver, int *graphmode, char *pathtodriver)graphdriver (e.g., DETECT), graphmode, pathtodriverInitializes system and mode.
linevoid line(int x1, int y1, int x2, int y2)x1, y1, x2, y2 (integers)Draws line between points.
circlevoid circle(int x, int y, int radius)x, y, radius (integers)Draws outline.
rectanglevoid rectangle(int left, int top, int right, int bottom)left, top, right, bottom (integers)Draws outline.
setcolorvoid setcolor(int color)color (0–15)Sets drawing color.
outtextxyvoid outtextxy(int x, int y, char *textstring)x, y (integers), textstringOutputs text at position.
floodfillvoid floodfill(int x, int y, int border)x, y (integers), border (color)Fills enclosed area.
setfillstylevoid setfillstyle(int pattern, int color)pattern (1–12), color (0–15)Sets fill pattern and color.
graphresultint graphresult(void)NoneRetrieves last .

Drivers and Hardware Compatibility

The Borland Graphics Interface (BGI) employed a modular driver system to abstract hardware differences, allowing programs to output graphics without direct hardware-specific coding. Drivers were distributed as binary .bgi files, loaded dynamically at runtime via the initgraph function, which handled initialization and selection based on available hardware. For instance, the egavga.bgi file supported both Enhanced Graphics Adapter (EGA) and Video Graphics Array (VGA) displays. Predefined constants in the graphics.h header, such as CGA, EGA, VGA, and HERC_MONO, corresponded to these drivers, enabling developers to specify hardware types explicitly or rely on automatic selection. Official BGI drivers provided compatibility with a range of period-appropriate , focusing primarily on IBM PC-compatible displays, printers, and plotters. Display support included adapters like the (CGA) at 320x200 with 4 colors, (EGA) at 640x350 with 16 colors, and (VGA) at 640x480 with 16 colors, alongside monochrome options such as and 8514. Printer drivers accommodated devices like EPSON-compatible dot-matrix models and line printers, while plotter support extended to standards for vector-based output. bundled these drivers with compilers like and , ensuring broad compatibility within the ecosystem of the late and early . Compatibility was enhanced through features like auto-detection, where the DETECT constant in initgraph invoked the detectgraph function to identify installed and select the optimal and automatically. Developers could specify the to .bgi files via the pathtodriver parameter in initgraph, defaulting to the current directory if unspecified, which facilitated distribution across varied system configurations. For standalone executables without external dependencies, drivers could be embedded by converting .bgi files to object files using the bgiobj.exe utility and registering them with registerbgidriver, allowing self-contained programs. Despite its flexibility, the BGI driver system had inherent limitations tied to the DOS environment. It lacked support for USB or other modern peripherals, restricting compatibility to ports, interfaces, and expansion cards prevalent in 1980s-1990s hardware. Memory constraints were particularly acute, with a maximum 64KB for operations in DOS, beyond which functions like imagesize would fail, necessitating careful in applications. Up to 10 user drivers could be installed, but exceeding this or encountering memory shortages triggered errors reportable via graphresult.

Supported Graphics Modes

The Borland Graphics Interface (BGI) allows developers to select graphics modes through the graphmode in the initgraph , where predefined constants specify resolutions and color depths compatible with contemporary such as CGA, EGA, VGA, and monochrome adapters. These modes are hardware-dependent, with the library loading an appropriate driver to configure the display accordingly, ensuring portability across systems without direct mode manipulation. Note that mode constant values are specific to each driver. For CGA hardware, BGI supports low-resolution modes at 320×200 pixels with 4 colors (selected from palettes like //lightgray for CGAC3) via constants such as CGAC0 (value 0), CGAC1 (1), CGAC2 (2), and CGAC3 (3), alongside a high-resolution option at 640×200 pixels with 2 colors using CGAHI (4). EGA extends this to higher resolutions and palettes, offering 640×200 with 16 colors (EGALO, 0) or 640×350 with 16 colors (EGAHI, 1), drawing from a 64-color palette for richer visuals. VGA modes build on EGA compatibility while adding finer detail, including 640×200 with 16 colors (VGALO, 0), 640×350 with 16 colors (VGAMED, 1), and 640×480 with 16 colors (VGAHI, 2). graphics are handled via HERCMONOHI (0), providing 720×348 pixels in 2 colors for text-like high-resolution output. The following table summarizes representative modes across these hardware types:
HardwareMode ConstantValueResolutionColors
CGACGAC00320×2004
CGACGAHI4640×2002
EGAEGALO0640×20016
EGAEGAHI1640×35016
VGAVGALO0640×20016
VGAVGAHI2640×48016
HERCMONOHI0720×3482
BGI integrates with text modes by allowing restoration via restorecrtmode after graphics operations, enabling mixed text-graphics applications, while runtime queries like getmaxx() and getmaxy() return the current mode's horizontal and vertical pixel extents for dynamic adaptation. However, BGI modes impose constraints including fixed pixel aspect ratios (typically 1:1.2 for non-square pixels on CGA/EGA), no support for or , and a base limitation to 16 colors, though extended modes via specific drivers can reach 256 colors on compatible like VGA in non-standard configurations.

Programming Usage

Initialization and Basic Drawing

To initialize the Borland Graphics Interface (BGI), programs must first include the <graphics.h> header file, which provides access to all BGI functions. The core setup occurs via the initgraph function, which takes three parameters: an pointer for the graphics driver (e.g., DETECT for automatic detection or a specific value like VGA for 9), an pointer for the mode (e.g., VGAHI for 2, supporting 640x480 with colors), and a string specifying the path to BGI driver files (e.g., "c:\\tc\\bgi"). Upon calling initgraph(&gd, &gm, path), the function loads the appropriate driver file (e.g., EGAVGA.BGI for VGA ), sets the specified mode, and initializes defaults such as color palette and ; it may override the requested mode if constraints apply. After initialization, developers should invoke graphresult() to retrieve an error code (0 indicates success; non-zero values signal issues like -3 for file not found), ensuring robust setup before proceeding to drawing operations. Cleanup is handled by closegraph(), which deallocates memory, restores text mode, and releases system resources. Basic drawing in BGI follows a straightforward sequence starting with color configuration. The setbkcolor(color) function establishes the screen background (e.g., setbkcolor([BLACK](/page/Black)) for color 0), clearing the viewport to that hue, while setcolor(color) defines the foreground for subsequent (e.g., setcolor([WHITE](/page/White)) for color 15, with valid ranges from 0 to getmaxcolor(), typically 15 in 16-color modes). Lines are rendered using line(x1, y1, x2, y2), connecting endpoints in coordinates with the current color and default solid style. Rectangles form via rectangle(left, top, right, bottom), outlining the shape between opposite corners without filling. Text output integrates through settextstyle(font, direction, size) to configure appearance (e.g., settextstyle(DEFAULT_FONT, HORIZ_DIR, 1) for horizontal default font at size 1), followed by outtextxy(x, y, "text") to place the at the specified position. These operations apply within the active and respect the current color settings. The BGI coordinate system employs a Cartesian layout with the origin at (0,0) in the upper-left corner of the screen or , where the x-axis extends positively rightward and the y-axis downward, differing from standard mathematical conventions by inverting the y-direction for alignment with raster displays. Maximum extents vary by mode and hardware (e.g., 639 for x and 479 for y in VGA 640x480), retrievable via getmaxx() and getmaxy() to bound drawings appropriately. Viewport management restricts output to a rectangular region using setviewport(left, top, right, bottom, clip), where coordinates are absolute to the screen, and clip (non-zero) enables truncation for ; the viewport's local resets to (0,0) at its top-left upon setting. This setup allows modular drawing areas, with all coordinates interpreted relative to the current viewport unless specified otherwise. Common pitfalls in BGI usage often stem from initialization failures, such as incorrect paths to driver files (e.g., omitting the directory containing EGAVGA.BGI), triggering error code -3 (grFileNotFound) and preventing graphics mode entry, which may result in a blank or unresponsive screen. Mode mismatches, like specifying an unsupported resolution for the hardware (error -10, grInvalidMode), can similarly cause initialization to fail silently or produce a black screen without error reporting if graphresult is unchecked. DOS memory limitations pose another challenge, as the 640KB conventional memory cap may exhaust during driver loading or large viewport allocations (error -5, grNoLoadMem, or -7 for operations like flood fills), particularly on systems with resident TSR programs; allocating a custom buffer via setgraphbufsize beforehand can mitigate this by reserving space explicitly. Always verifying graphresult post-initialization and ensuring driver compatibility with the detected hardware (via DETECT) helps avoid these issues.

Advanced Features and Error Handling

BGI provides several advanced drawing functions for creating complex shapes beyond basic lines and rectangles. The arc function draws an outline arc centered at coordinates (x, y) from a starting angle to an ending angle, both specified in degrees, with a given radius, using the current line style and color. For filled variants, the sector function renders a pie-slice sector, filling it according to the current fill style and supporting elliptical shapes via separate x and y radii parameters. Additionally, drawpoly connects a series of points defined in an array to form a polyline, while fillpoly closes and fills the resulting polygon, enabling irregular shapes like custom polygons without manual boundary calculations. Customization of visual styles extends to patterns, lines, and colors for more nuanced rendering. The setfillpattern function allows user-defined 8x8 bitmap patterns by passing an 8-byte array representing the upper-left corner of the pattern, combined with a fill color, overriding predefined fill styles for textured fills in shapes like sectors or polygons. Line appearance is controlled via setlinestyle, which sets solid, dotted, centered-dash, or user-defined patterns, along with thickness options from 1 to 3 pixels, applied to functions like arc and drawpoly. Palette manipulation through setpalette remaps one of the 16 standard colors to a new value, with extensions like setrgbpalette for direct RGB specification, enabling dynamic color adjustments in VGA modes. Input handling in base BGI remains rudimentary, focusing on keyboard events without native mouse support. Keyboard input integrates via standard functions like getch from conio.h, which retrieves a character without echoing or requiring Enter, and kbhit to check for pending input, allowing non-blocking event loops in graphics mode. Mouse capabilities require third-party extensions, as the core library does not include them. Error handling in BGI relies on a simple diagnostic system to identify issues in graphics operations. The graphresult function returns an integer code for the most recent , resetting it to grOk (0) afterward, with non-zero values indicating problems like invalid drivers or memory shortages. Common codes include grInvalidDeviceNum (-15) for an invalid driver number, grNoInitGraph (-1) for uninitialized graphics, and grFileNotFound (-3) for missing driver files, among others defined in the graph_errors . For textual feedback, grapherrormsg converts an error code to a descriptive string, such as "Invalid device number" for grInvalidDeviceNum, facilitating without hardcoded messages. Developers typically check graphresult after critical calls like initgraph to ensure robust program flow.

Extensions and Variants

Official Enhancements

introduced the bgiobj.exe utility as a key enhancement to streamline the distribution of BGI-based applications by embedding and fonts directly into files. This tool converts .bgi files or .chr font files into relocatable .obj object modules that can be linked into the during , eliminating the need to ship separate files and ensuring the application remains self-contained. Usage involves invoking the command-line tool with bgiobj <inputfile.bgi> (or .chr), producing an output .obj file by default named after the input; the resulting module is then registered in the source code using functions like registerbgidriver() or registerbgifont() before calling initgraph(). Detailed command-line options and integration steps are outlined in the UTIL.DOC file distributed with compilers. Palette management received add-ons for VGA modes, providing limited RGB customization beyond the default 16-color set through direct access. While BGI functions like setpalette() and setrgbpalette() handled standard adjustments, developers could employ the outportb() function for fine-grained tweaks to the VGA's (DAC) registers, setting individual RGB values (0-63) for up to 256 colors. For instance, to define a custom color, code such as outportb(0x3C8, index); outportb(0x3C9, red_val); outportb(0x3C9, green_val); outportb(0x3C9, blue_val); directly programmed the palette , enabling richer in 320x200x256 or similar modes. Comprehensive documentation and sample code formed another official enhancement, with Borland's Programmer's Guide and Library Reference manuals dedicating chapters to BGI , function prototypes, and best practices. These resources covered initialization, driver selection, and advanced techniques like filled polygons and text styling, often with complete example programs. Compiler distributions included ready-to-compile demos in the EXAMPLES\BGI subdirectory, illustrating practical applications from basic line drawing to complex animations, aiding developers in rapid prototyping.

Third-Party Drivers and Tools

In the mid-1990s, third-party developers extended the Borland Graphics Interface (BGI) to support (SVGA) hardware, addressing its native limitations in higher resolutions and color depths for DOS-based applications. A prominent example is the SVGA BGI drivers developed by Jordan Hargrave under Jordan Hargraphix Software, first released around as version 5.5. These drivers provided compatibility with VESA standards as well as specific chipsets including ATI, , Tseng ET3000/ET4000, S3, and , enabling resolutions such as 800×600 in 256 colors and 1024×768 in 16 colors, among others up to 1280×1024. These drivers incorporated bug fixes for issues in true-color modes and memory banking on extended hardware, allowing BGI applications to handle 24-bit color depths and larger frame buffers without crashing on supported SVGA cards. Another set of BGI drivers, developed independently from 1991 to 1994 and later released as open-source, supported VESA 1.2-compatible SVGA cards in 256-color modes with for S3 chipsets, further enhancing performance for non-standard resolutions. Despite these advances, third-party BGI extensions faced notable limitations, including incomplete support for VBE 2.0 features introduced in 1996, which restricted and mode switching on newer cards. Compatibility bugs persisted with high-speed SVGA hardware, often causing flickering or initialization failures on untested configurations. With no ongoing maintenance since the mid-1990s, these drivers rely on archival repositories; Hargrave's work was re-licensed under the terms on in 2020 to encourage preservation.

Legacy and Modern Relevance

Decline in the Post-DOS Era

The decline of the Borland Graphics Interface (BGI) in the post-DOS era was primarily driven by the rapid adoption of Windows as the dominant operating system, which introduced graphics APIs like the (GDI) in (1990) and starting in 1995, rendering BGI's DOS-centric design increasingly incompatible and inadequate for modern applications. BGI, bundled with compilers for , relied on direct hardware access through mode-specific drivers, but Windows' protected-mode architecture and multitasking environment made such low-level operations unreliable or impossible without emulation, leading to its practical obsolescence by the late . Borland itself accelerated BGI's fade-out through a strategic pivot toward Windows-native development tools, releasing in 1995 as an evolution of focused on (VCL) for Windows GUI applications, followed by in 1997, which deprecated the legacy Borland C++ environment that included BGI support. The final official version supporting BGI was Borland C++ 5.02 in 1997, after which Borland ceased maintenance for -based tools amid the broader industry shift away from , whose standalone support ended with version 6.22 in 1994 and became fully obsolete by around 2000 with the rise of Windows 2000. This transition left BGI without updates, as Borland prioritized cross-platform and Windows-specific frameworks over maintaining graphics libraries. Despite its official sunset, BGI lingered in niche legacy contexts, particularly in education where simplified graphics programming was valued for introductory courses; for instance, universities like the adapted BGI-like libraries for Windows until the mid-2000s to teach concepts without requiring emulators, though by the mid-2010s, even these had largely shifted to modern alternatives. In embedded systems running derivatives or , BGI saw limited continued use for basic visualization in resource-constrained environments into the early 2000s, but its lack of ongoing support confined it to maintenance-only scenarios. BGI's technical limitations further hastened its irrelevance in a multitasking, high-resolution era: designed for single-tasking , it could not integrate with Windows' , leading to crashes or freezes in multi-application setups, while its support capped at VGA-era modes like 640x480 in 16 colors precluded higher resolutions or essential for post-1990s graphics demands. Additionally, the inherent vulnerabilities of the environment, such as no or user , exposed BGI applications to risks that were untenable in networked Windows systems by the late 1990s. Culturally, BGI endures as a symbol of 1980s and 1990s personal computing, evoking nostalgia among retro computing enthusiasts who recreate DOS environments to run classic BGI demos and games, preserving its legacy through emulators and hobbyist projects that highlight its role in democratizing graphics programming for early PC developers.

Contemporary Implementations and Alternatives

In the years following the decline of DOS-based systems, several open-source projects have emerged to port or emulate the Borland Graphics Interface (BGI) for contemporary operating systems and hardware, preserving its simple API for 2D graphics while adding modern capabilities. SDL_bgi, developed by Guido Gonzato, is a cross-platform implementation built on SDL2 (and compatible with SDL3), supporting Windows, Linux, macOS, and even WebAssembly for browser-based execution. It maintains functional compatibility with the original Turbo C 2.01 and Borland C++ 1.0 BGI, including support for common drawing primitives, while extending it with RGB color modes, mouse input, and hardware-accelerated rendering. Similarly, WinBGIm, maintained by Michael Main at the University of Colorado, provides a Windows-specific emulation using the Windows GDI for compatibility with MinGW and Visual Studio compilers, offering extensions like mouse support and C++ stream integration for output. GRX, a multiplatform 2D graphics library originally by Csaba Biegl, includes a BGI subsystem that is largely compatible with the original, tailored for embedded systems and supporting platforms like DOS, Linux, and various microcontrollers through its modular driver architecture. OpenBGI, hosted on SourceForge, serves as a compiler-agnostic Windows port that emulates core BGI functions with added mouse handling, aimed at reviving legacy DOS graphics code without requiring DOS emulation. The Graph unit offers another backward-compatible BGI emulation, primarily for , BSD, and other systems, integrating seamlessly with the Free Pascal Compiler's . It supports original BGI drivers and fonts via functions like RegisterBGIDriver and RegisterBGIFont, while leveraging platform-native backends for output; related extensions in the ecosystem, such as those in the , enable advanced features including alpha blending for semi-transparent drawing operations. As full BGI emulations have proliferated, modern alternatives have largely supplanted them for new development, particularly in 2D graphics and game programming. Libraries like and provide cross-platform APIs for handling graphics, input, and audio, evolving from DOS-era needs into robust frameworks with , shader support, and networking—positioning them as spiritual successors for simple 2D applications without the legacy constraints of BGI. For educational purposes, browser-based emulators recreate the environment with BGI support, such as the Internet Archive's online 2.01 demo, allowing nostalgic or introductory coding sessions without local installation. Today, BGI implementations find niche applications in retro computing via , which emulates VGA hardware to run original BGI code faithfully; in curricula for teaching basic concepts using familiar examples; and in limited embedded or scenarios where GRX's lightweight BGI mode suits resource-constrained devices for simple visualizations.

References

  1. [1]
    Borland Graphics Interface - ModdingWiki - shikadi.net
    Apr 26, 2021 · Borland Graphics Interface is a graphics API initially created by Borland in 1987 to allow developers to use the same graphics code across several different ...
  2. [2]
    how do we include bgi library in windows with visual studio?
    Apr 12, 2018 · BGI stands for Borland Graphics Interface. It shipped with Borland tools between 1987 and 1992. That was a <expletive deleted> of a long ...<|control11|><|separator|>
  3. [3]
    Freeware BGI Drivers - von Bassewitz
    Jun 11, 2021 · BGI stands for "Borland Graphics Interface". It is (was) the common graphic interface for the DOS based Borland compilers. Borlands own ...
  4. [4]
    Borland Graphics Interface (BGI) Documentation
    Aug 9, 2004 · Borland Graphics Interface (BGI) for Windows ... . Also, any of the functions that use colors can use RGB colors in addition to the 16-color BGI ...
  5. [5]
    Everything About BGI - GeekSpace - GitHub Pages
    Jul 31, 2024 · This is a short history of BGI (Borland Graphics Interface) which was once an extremely popular and easy way to implement presentation graphics in C programs.
  6. [6]
    [PDF] TURBO C® - Addendum - Bitsavers.org
    The new BGI (Borland Graphics Interface) graphics library supplies versatile drawing/painting and graphics text- output functions. These graphics functions ...
  7. [7]
    [PDF] Turbo Pascal® - Reference Guide - Bitsavers.org
    This is a reference guide for Turbo Pascal, covering tokens, constants, blocks, types, and variables.
  8. [8]
    None
    Below is a merged summary of the Borland Graphics Interface (BGI) from the Borland C++ Version 4.0 User’s Guide, consolidating all information from the provided segments. To retain as much detail as possible, I’ve organized the content into a dense, tabular CSV format for clarity and comprehensiveness, followed by a narrative summary that integrates key points and addresses gaps or inconsistencies.
  9. [9]
    Version information for older Borland/Inprise C Compilers
    Turbo Vision for C++. Turbo C. Borland Turbo C 1.0. Turbo C 1.0, dated 6/3/87 1am, diskette part number BOR 249 with red twisty. Manuals ...
  10. [10]
    [PDF] USER'S GUIDE - Bitsavers.org
    Turbo C++ is a powerful compiler for beginner and experienced. C++ and C programmers. ... New BGI fonts and BGI support for the full ASCII character set.
  11. [11]
    [PDF] Borland® C++ - Bitsavers.org
    Chapter 4: Borland graphics interface is a reference to the functions. declared in the graphics.h header file. The functions discussed in this.Missing: reliable | Show results with:reliable
  12. [12]
    Borland Paradox - DOS Days
    Borland Paradox was a high-speed DOS RDBMS, purchased by Borland, known for its 'Query By Example' and a successful DOS-based database.
  13. [13]
    [PDF] Borland® C++ - Bitsavers.org
    Borland C++ is a powerful,. professional programming tool for creating and maintaining. DOS, Win16, and Win32 applications. Borland C++ supports both the C ...
  14. [14]
    [PDF] Borland® C++
    This is a Borland C++ Programmer's Guide, covering programming with Borland C++ and language structure.<|control11|><|separator|>
  15. [15]
    None
    Below is a merged summary of the BGI Drivers and Related Information from the *Turbo C Reference Guide Ver 2.0 (1988)*, consolidating all details from the provided segments into a comprehensive response. To maximize density and clarity, key information is organized into tables where appropriate, while narrative text covers additional details. All unique information is retained, avoiding redundancy where possible.
  16. [16]
    None
    Summary of each segment:
  17. [17]
    BGI Documentation for initgraph
    Three Colors​​ After a call to initgraph, *graphdriver is set to the current graphics driver, and *graphmode is set to the current graphics mode.
  18. [18]
    [PDF] BORLAND
    (BGI) graphics not installed (use initgraph). -2. grN otDetected. Gra ... initgraph initializes the graphics system by loading a graphics driver from ...
  19. [19]
    BGI Documentation for arc
    If your system runs on a CGA or monochrome adapter, pass the value 1 to those functions that alter the fill or drawing color (setcolor, setfillstyle, and ...Missing: Borland Interface advanced polyline setfillpattern<|control11|><|separator|>
  20. [20]
    BGI Documentation for setlinestyle
    setlinestyle sets the style for all lines drawn by line, lineto, rectangle, drawpoly, and so on. The linesettingstype structure is defined in graphics.h as ...Missing: Borland Interface advanced functions polyline setfillpattern setpalette
  21. [21]
    BGI Documentation for getch
    The function reads one character from the keyboard and returns its ASCII value (without waiting for a return key).Missing: Borland Interface input mode
  22. [22]
    BGI Documentation for kbhit
    The kbhit function is available in the winbgim implementation of BGI graphics. ... The function returns true (non-zero) if there is a character in the input ...Missing: Borland Interface mode
  23. [23]
    WINBGIM: Borland BGI Graphics & Mouse for Windows
    Aug 9, 2004 · WINBGIM is a library for Windows applications that allows using BGI graphics routines and simple mouse support.Missing: Interface | Show results with:Interface
  24. [24]
    BGI Documentation for graphresult
    graphresult returns the error code for the last graphics operation that reported an error and resets the error level to grOk. The following table lists the ...Missing: Borland Interface enum
  25. [25]
    BGI Documentation for grapherrormsg
    grapherrormsg returns a pointer to the error message string associated with errorcode, the value returned by graphresult. Refer to the entry for errno in the ...Missing: Borland Interface mouse support
  26. [26]
  27. [27]
    Is it possible to embed binary data into DOS EXEs made in Turbo C?
    Apr 16, 2019 · BGIOBJ can convert a binary file to an .obj file which then can be linked into the .exe file. Its primary purpose is to include BGI drivers ...
  28. [28]
  29. [29]
    jharg93/SvgaBGI: SuperVGA BGI Drivers for Turbo C/Turbo ... - GitHub
    Only Borland Pascal 7.0 and Turbo Pascal 7.0 currently support BGI v3.0; Borland Pascal 7.0 needs BGIv3.0 to work in protected mode. The BGIv3.0 drivers are in ...Missing: hpgl. | Show results with:hpgl.<|control11|><|separator|>
  30. [30]
    SuperVGA BGI Drivers - The FreeDOS Project / News - SourceForge
    Dec 27, 2020 · Jordan Hargrave, who wrote SVGA BGI drivers for Turbo C/Turbo Pascal/Borland C++ until the mid-1990s, has released his SuperVGA BGI Drivers under the MIT ...
  31. [31]
    SuperVGA BGI Drivers for Turbo C/Turbo Pascal/Borland C++
    May 10, 2021 · This is the demo program for the SvgaBGI project, a collection of drivers which extend Borland C/C++/Pascal's BGI interface to work on SVGA cards.Missing: EPSON IBM HPGL
  32. [32]
    DOS ain't dead - Jordan Hargraphix SvgaBGI goes MIT license
    Dec 19, 2020 · In April 2020 I got in touch with Jordan Hargrave, who wrote SVGA BGI drivers for Turbo C/Turbo Pascal/Borland C++ until the mid-1990s: ...
  33. [33]
    Delphi Timewarp – 1995 And Delphi's Mythical Origins
    Feb 4, 2022 · 1995 is a very important year in the history of Delphi. · Delphi came as a departure from its predecessor, Borland's Turbo Pascal for Windows.
  34. [34]
    Celebrating 25 Years of C++Builder! - Embarcadero Blogs
    Feb 25, 2022 · C++Builder is 25! On 26th February 1997, Borland released the first version of C++Builder. Coming on the heels of Turbo C and Turbo C++ (with ...
  35. [35]
    Microsoft DOS History - Computer Hope
    Dec 9, 2023 · 1986. MS-DOS 3.2 was released in April 1986, featuring support for 3 1/2 inch, 720 KB floppy disk drives.
  36. [36]
    [PDF] High Resolution Computer Graphics Using Pascal
    The Borland Graphics Interface (BGI) supported modes such as 320x200 in. 256 colors or 640x480 in 16 colors. Achieving higher resolutions required custom ...
  37. [37]
    They don't make 'em like that any more: Borland Turbo Pascal 7
    Aug 24, 2024 · TP 7 also had fully-graphical tools for designing the user interface elements, like menus and icons. Laying out a menu using a definition ...