• Navigation überspringen
  • Zur Navigation
  • Zum Seitenende
Organisationsmenü öffnen Organisationsmenü schließen
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
  • FAUZur zentralen FAU Website
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Suche öffnen
  • English
  • Campo
  • StudOn
  • FAUdir
  • Stellenangebote
  • Lageplan
  • Hilfe im Notfall
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
Menu Menu schließen
  • Lehrstuhl
    • Team
    • Aktuelles
    • Kontakt und Anfahrt
    • Leitbild
    • 50-jähriges Jubiläum
    Portal Lehrstuhl
  • Forschung
    • Forschungsbereiche
      • Betriebssysteme
      • Confidential Computing
      • Eingebettete Systemsoftware
      • Verteilte Systeme
    • Projekte
      • AIMBOS
      • BALu
      • BFT2Chain
      • DOSS
      • Mirador
      • NEON
      • PAVE
      • ResPECT
      • Watwa
    • Projektkampagnen
      • maRE
    • Seminar
      • Systemsoftware
    Portal Forschung
  • Publikationen
  • Lehre
    • Sommersemester 2025
      • Applied Software Architecture
      • Ausgewählte Kapitel der Systemsoftware
      • Betriebssystemtechnik
      • Projekt angewandte Systemsoftwaretechnik
      • System-Level Programming
      • Systemnahe Programmierung in C
      • Systemprogrammierung 1
      • Verteilte Systeme
    • Wintersemester 2024/25
      • Betriebssysteme
      • Middleware – Cloud Computing
      • Systemprogrammierung 2
      • Verlässliche Echtzeitsysteme
      • Virtuelle Maschinen
      • Web-basierte Systeme
    Portal Lehre
  • Examensarbeiten
  1. Startseite
  2. Extern

Extern

Bereichsnavigation: Lehre
  • Betriebssysteme
    • Vorlesung
      • Folien
    • Übung
      • Seminar
      • Aufgaben
      • Aufgabe 0: C++ Streams
        • Aufgabe 1: Ein-/Ausgabe
          • Aufgabe 2: Unterbrechungen
            • Aufgabe 3: Pro-/Epilog
              • Aufgabe 4: Kontextwechsel
                • Aufgabe 5: Zeitscheiben
                  • Aufgabe 6: Synchronisation
                    • Aufgabe 7: Anwendung
                      • Assembler Crashkurs
                        • C++ Crashkurs
                          • Entwicklungsumgebung
                            • FAQ
                              • Ruhmeshalle
                              • Evaluation

                              Aufgabe 7: Anwendung

                              Public Member Functions | List of all members
                              Graphics Class Reference
                              Graphics

                              Driver managing the video mode and synchronizing its buffer with the graphics printer. More...

                              #include <device/graphics.h>

                              + Inheritance diagram for Graphics:
                              [legend]

                              Public Member Functions

                               Graphics (unsigned size, void *frontbuffer, void *backbuffer)
                               Constructor. More...
                               
                              bool init (bool force=false)
                               Initialize GraphicsPrinter according to the current video mode. More...
                               
                              bool switchBuffers ()
                               Switch front and back buffer (only if front buffer was already copied to video memory) More...
                               
                              void scanoutFrontbuffer ()
                               Copy current front buffer to the video memory.
                               
                              void clear ()
                               Clear all pixel of the current back buffer (set full screen to black)
                               
                              bool valid (const Point &p)
                               Check if a Point can be displayed at the current resolution. More...
                               
                              unsigned height ()
                               Number of vertical pixels in current resolution. More...
                               
                              unsigned width ()
                               Number of horizontal pixels in current resolution. More...
                               
                              void pixel (const Point &p, const Color &color)
                               Draw a pixel on the current back buffer. More...
                               
                              void pixel (const Point &p, const ColorAlpha &color)
                               Draw a pixel on the current back buffer. More...
                               
                              void line (const Point &start, const Point &end, const Color &color)
                               Draw a line on the current back buffer. More...
                               
                              void line (const Point &start, const Point &end, const ColorAlpha &color)
                               Draw a line on the current back buffer. More...
                               
                              void rectangle (const Point &start, const Point &end, const Color &color, bool filled=true)
                               Draw a rectangle on the current back buffer. More...
                               
                              void rectangle (const Point &start, const Point &end, const ColorAlpha &color, bool filled=true)
                               Draw a rectangle on the current back buffer. More...
                               
                              void font (const Font &new_font)
                               Change the current font for text output in video mode. More...
                               
                              void text (const Point &p, const char *string, unsigned len, const Color &color, const Font *font=nullptr)
                               Print text (without automatic word wrap) on the current back buffer. More...
                               
                              void text (const Point &p, const char *string, unsigned len, const ColorAlpha &color, const Font *font=nullptr)
                               Print text (without automatic word wrap) on the current back buffer. More...
                               
                              void image (const Point &p, PNG &image, unsigned width=0, unsigned height=0, unsigned offset_x=0, unsigned offset_y=0)
                               Draw a PNG image [detail] on the current back buffer. More...
                               
                              void image (const Point &p, const GIMP &image, unsigned width=0, unsigned height=0, unsigned offset_x=0, unsigned offset_y=0)
                               Draw a GIMP image [detail] on the current back buffer. More...
                               
                              void image (const Point &p, const Color *image, unsigned width, unsigned height, unsigned offset_x=0, unsigned offset_y=0)
                               Draw a sprite on the current back buffer. More...
                               
                              void image (const Point &p, const ColorAlpha *image, unsigned width, unsigned height, unsigned offset_x=0, unsigned offset_y=0)
                               Draw a sprite with alpha blending (transparency) on the current back buffer. More...
                               

                              Detailed Description

                              Driver managing the video mode and synchronizing its buffer with the graphics printer.

                              This device detects the current video mode set by the Multiboot compliant boot loader and initializes a suitable GraphicsPrinter.

                              With the methods Graphics::switchBuffers() (to exchange front- and backbuffer) and Graphics::scanoutFrontbuffer() (copying the contents of the frontbuffer into the video memory) it provides some kind of manually triple buffering.

                              A typical usage is to fully prepare the back buffer before switching it with the front buffer

                              graphics.init();
                              while(true) {
                              // Draw on back buffer
                              // using the primitives provided by the driver
                              graphics.switchBuffers();
                              }
                              Graphics::init
                              bool init(bool force=false)
                              Initialize GraphicsPrinter according to the current video mode.
                              Definition: graphics.cc:85
                              GuardedGraphics::switchBuffers
                              bool switchBuffers()
                              Switch front and back buffer (only if front buffer was already copied to video memory)
                              Definition: guarded_graphics.h:27

                              The method Graphics::scanoutFrontbuffer() has to be executed either inside the loop (right after Graphics::switchBuffers() in the example above) or at a predefined interval by employing the Watch.

                              Note
                              The driver requires Multiboot to initialize a video mode, which can be configured using the flags in boot/multiboot/config.inc.

                              Constructor & Destructor Documentation

                              Graphics::Graphics ( unsigned  size,
                              void *  frontbuffer,
                              void *  backbuffer 
                              )

                              Constructor.

                              Parameters
                              sizeSize of each buffer
                              frontbufferPointer to a reserved memory area with a sufficient size to transmit a full screen picture to the video memory at the current video mode / resolution.
                              backbufferPointer to a reserved memory area with the same size as the front buffer to prepare the picture.

                              Member Function Documentation

                              bool Graphics::init ( bool  force = false)

                              Initialize GraphicsPrinter according to the current video mode.

                              Parameters
                              forceDo not check video attributes for the linear frame buffer (required on our test systems due to some strange VBE behaviour)
                              Returns
                              'true' if a suitable GraphicsPrinter was found for the video mode
                              bool Graphics::switchBuffers ( )

                              Switch front and back buffer (only if front buffer was already copied to video memory)

                              Returns
                              true if buffers have been switched, false if previous front buffer wasn't yet fully copied to video memory.
                              bool Graphics::valid ( const Point &  p)
                              inline

                              Check if a Point can be displayed at the current resolution.

                              Parameters
                              pCoordinates to check
                              Returns
                              'true' if can be displayed
                              unsigned Graphics::height ( )
                              inline

                              Number of vertical pixels in current resolution.

                              Returns
                              Height of the screen in current video mode
                              unsigned Graphics::width ( )
                              inline

                              Number of horizontal pixels in current resolution.

                              Returns
                              Width of the screen in current video mode
                              void Graphics::pixel ( const Point &  p,
                              const Color &  color 
                              )
                              inline

                              Draw a pixel on the current back buffer.

                              Parameters
                              pCoordinates of the pixel
                              colorColor of the pixel
                              void Graphics::pixel ( const Point &  p,
                              const ColorAlpha &  color 
                              )
                              inline

                              Draw a pixel on the current back buffer.

                              Parameters
                              pCoordinates of the pixel
                              colorColor of the pixel
                              void Graphics::line ( const Point &  start,
                              const Point &  end,
                              const Color &  color 
                              )
                              inline

                              Draw a line on the current back buffer.

                              Parameters
                              startCoordinates of the begin of the line
                              endCoordinates of the end of the line
                              colorColor of the line
                              void Graphics::line ( const Point &  start,
                              const Point &  end,
                              const ColorAlpha &  color 
                              )
                              inline

                              Draw a line on the current back buffer.

                              Parameters
                              startCoordinates of the begin of the line
                              endCoordinates of the end of the line
                              colorColor of the line
                              void Graphics::rectangle ( const Point &  start,
                              const Point &  end,
                              const Color &  color,
                              bool  filled = true 
                              )
                              inline

                              Draw a rectangle on the current back buffer.

                              Parameters
                              startCoordinate of the rectangles upper left corner
                              endCoordinate of the rectangles lower right corner
                              colorColor of the rectangle
                              filledIf set, the rectangle will be filled with the same color. (otherwise only borders will be drawn)
                              void Graphics::rectangle ( const Point &  start,
                              const Point &  end,
                              const ColorAlpha &  color,
                              bool  filled = true 
                              )
                              inline

                              Draw a rectangle on the current back buffer.

                              Parameters
                              startCoordinate of the rectangles upper left corner
                              endCoordinate of the rectangles lower right corner
                              colorColor of the rectangle
                              filledIf set, the rectangle will be filled with the same color. (otherwise only borders will be drawn)
                              void Graphics::font ( const Font &  new_font)
                              inline

                              Change the current font for text output in video mode.

                              Parameters
                              new_fontFont to be used on subsequent calls to text (without explicit font parameter)
                              void Graphics::text ( const Point &  p,
                              const char *  string,
                              unsigned  len,
                              const Color &  color,
                              const Font *  font = nullptr 
                              )
                              inline

                              Print text (without automatic word wrap) on the current back buffer.

                              Parameters
                              pUpper left start position of the text
                              stringPointer to char array containing the text to be displayed
                              lenNumber of characters to be displayed
                              colorColor for the text characters
                              fontExplicit font – or nullptr to use default font (set by font method)
                              void Graphics::text ( const Point &  p,
                              const char *  string,
                              unsigned  len,
                              const ColorAlpha &  color,
                              const Font *  font = nullptr 
                              )
                              inline

                              Print text (without automatic word wrap) on the current back buffer.

                              Parameters
                              pUpper left start position of the text
                              stringPointer to char array containing the text to be displayed
                              lenNumber of characters to be displayed
                              colorColor for the text characters
                              fontExplicit font – or nullptr to use default font (set by font method)
                              void Graphics::image ( const Point &  p,
                              PNG &  image,
                              unsigned  width = 0,
                              unsigned  height = 0,
                              unsigned  offset_x = 0,
                              unsigned  offset_y = 0 
                              )
                              inline

                              Draw a PNG image [detail] on the current back buffer.

                              The image can has to be in a supported PNG format. Alpha blending (transparency) is supported.

                              Parameters
                              pCoordinate of the images upper left corner
                              imageSource image to display
                              widthWidth of the image detail (full image width of the source image if zero/default value)
                              heightHeight of the image detail (full image height of the source if zero/default value)
                              offset_xRight offset of the source image
                              offset_yTop offset of the source image
                              void Graphics::image ( const Point &  p,
                              const GIMP &  image,
                              unsigned  width = 0,
                              unsigned  height = 0,
                              unsigned  offset_x = 0,
                              unsigned  offset_y = 0 
                              )
                              inline

                              Draw a GIMP image [detail] on the current back buffer.

                              The image has to be exported as C-source (without Glib types!) in GIMP, alpha blending (transparency) is supported.

                              Parameters
                              pCoordinate of the images upper left corner
                              imageSource image to display
                              widthWidth of the image detail (full image width of the source image if zero/default value)
                              heightHeight of the image detail (full image height of the source if zero/default value)
                              offset_xRight offset of the source image
                              offset_yTop offset of the source image
                              void Graphics::image ( const Point &  p,
                              const Color *  image,
                              unsigned  width,
                              unsigned  height,
                              unsigned  offset_x = 0,
                              unsigned  offset_y = 0 
                              )
                              inline

                              Draw a sprite on the current back buffer.

                              Each element in the source array will be displayed as a single pixel.

                              Parameters
                              pCoordinate of the sprites upper left corner
                              imageSource sprite to display
                              widthWidth of the sprite detail
                              heightHeight of the sprite detail
                              offset_xRight offset of the source sprite
                              offset_yTop offset of the source sprite
                              void Graphics::image ( const Point &  p,
                              const ColorAlpha *  image,
                              unsigned  width,
                              unsigned  height,
                              unsigned  offset_x = 0,
                              unsigned  offset_y = 0 
                              )
                              inline

                              Draw a sprite with alpha blending (transparency) on the current back buffer.

                              Each element in the source array will be displayed as a single pixel.

                              Parameters
                              pCoordinate of the sprites upper left corner
                              imageSource sprite to display
                              widthWidth of the sprite detail
                              heightHeight of the sprite detail
                              offset_xRight offset of the source sprite
                              offset_yTop offset of the source sprite

                              The documentation for this class was generated from the following files:
                              • device/graphics.h
                              • device/graphics.cc
                              Friedrich-Alexander-Universität
                              Erlangen-Nürnberg

                              Schlossplatz 4
                              91054 Erlangen
                              • Impressum
                              • Datenschutz
                              • Barrierefreiheit
                              • Facebook
                              • RSS Feed
                              • Xing
                              Nach oben