1
This commit is contained in:
churl
2022-06-17 15:37:39 +02:00
parent d29dc064cb
commit 59f5b5eacc
5 changed files with 179 additions and 180 deletions

View File

@ -8,26 +8,22 @@
* Autor: Michael Schoettner, HHU, 26.12.2016 *
*****************************************************************************/
#include "kernel/Globals.h"
#include "user/VBEdemo.h"
#include "devices/fonts/Fonts.h"
#include "kernel/Globals.h"
// Bitmap
#include "bmp_hhu.cc"
/*****************************************************************************
* Methode: VBEdemo::linInterPol1D *
*---------------------------------------------------------------------------*
* Beschreibung: Farbwert in einer Dimension interpoliert berechnen. *
*****************************************************************************/
int VBEdemo::linInterPol1D(int x, int xr, int l, int r) {
return ((((l>>16)*(xr-x)+(r>>16)*x)/xr)<<16)
|(((((l>>8)&0xFF)*(xr-x)+((r>>8)&0xFF)*x)/xr)<<8)
|(((l&0xFF)*(xr-x)+(r&0xFF)*x)/xr);
return ((((l >> 16) * (xr - x) + (r >> 16) * x) / xr) << 16) | (((((l >> 8) & 0xFF) * (xr - x) + ((r >> 8) & 0xFF) * x) / xr) << 8) | (((l & 0xFF) * (xr - x) + (r & 0xFF) * x) / xr);
}
/*****************************************************************************
* Methode: VBEdemo::linInterPol2D *
*---------------------------------------------------------------------------*
@ -36,70 +32,65 @@ int VBEdemo::linInterPol1D(int x, int xr, int l, int r) {
int VBEdemo::linInterPol2D(int x, int y, int lt, int rt, int lb, int rb) {
return linInterPol1D(y, vesa.yres,
linInterPol1D(x, vesa.xres, lt, rt),
linInterPol1D(x, vesa.xres, lb, rb) );
linInterPol1D(x, vesa.xres, lb, rb));
}
/*****************************************************************************
* Methode: VBEdemo::drawColors *
*---------------------------------------------------------------------------*
* Beschreibung: Pixel-Demo. *
*****************************************************************************/
void VBEdemo::drawColors () {
int x_res=640, y_res=480;
for (int y=0; y<y_res; y++) {
for (int x=0; x<x_res; x++) {
void VBEdemo::drawColors() {
int x_res = 640;
int y_res = 480;
for (int y = 0; y < y_res; y++) {
for (int x = 0; x < x_res; x++) {
vesa.drawPixel(x, y, linInterPol2D(x, y, 0x0000FF, 0x00FF00, 0xFF0000, 0xFFFF00));
}
}
}
/*****************************************************************************
* Methode: VBEdemo::drawBitmap *
*---------------------------------------------------------------------------*
* Beschreibung: Bitmap aus GIMP ausgeben. *
*****************************************************************************/
void VBEdemo::drawBitmap () {
unsigned int sprite_height = hhu.height;
unsigned int sprite_width = hhu.width;
unsigned int sprite_bpp = hhu.bytes_per_pixel;
unsigned char *sprite_pixel = (unsigned char*)hhu.pixel_data;
void VBEdemo::drawBitmap() {
unsigned int sprite_height = hhu.height;
unsigned int sprite_width = hhu.width;
unsigned int sprite_bpp = hhu.bytes_per_pixel;
unsigned char* sprite_pixel = (unsigned char*)hhu.pixel_data;
/* Hier muss Code eingefuegt werden */
}
/*****************************************************************************
* Methode: VBEdemo::drawFonts *
*---------------------------------------------------------------------------*
* Beschreibung: Fonts ausgeben. *
*****************************************************************************/
void VBEdemo::drawFonts () {
void VBEdemo::drawFonts() {
/* Hier muss Code eingefuegt werden */
/* Hier muss Code eingefuegt werden */
}
/*****************************************************************************
* Methode: VBEdemo::run *
*---------------------------------------------------------------------------*
* Beschreibung: Der Anwendungsthread erzeugt drei Threads die Zaehler *
* ausgeben und terminiert sich selbst. *
*****************************************************************************/
void VBEdemo::run () {
void VBEdemo::run() {
// In den Grafikmodus schalten (32-Bit Farbtiefe)
vesa.initGraphicMode(MODE_640_480_24BITS);
vesa.setDrawingBuff(BUFFER_VISIBLE);
drawColors();
/* Hier muss Code eingefuegt werden */
// selbst terminieren
scheduler.exit ();
scheduler.exit();
}