void testdrawbitmap(uint8_t *buff, const uint8_t *bitmap, uint8_t w, uint8_t h) { uint8_t icons[NUMFLAKES][3]; srandom(buff[666]); // initialize for (uint8_t f=0; f< NUMFLAKES; f++) { icons[f][XPOS] = random() % 128; icons[f][YPOS] = 0; icons[f][DELTAY] = random() % 5 + 1; } while (1) { // draw each icon for (uint8_t f=0; f< NUMFLAKES; f++) { drawbitmap(buffer, icons[f][XPOS], icons[f][YPOS], logo_glcd_bmp, w, h, 1); } write_buffer(buffer); _delay_ms(200); // then erase it + move it for (uint8_t f=0; f< NUMFLAKES; f++) { drawbitmap(buffer, icons[f][XPOS], icons[f][YPOS], logo_glcd_bmp, w, h, 0); // move it icons[f][YPOS] += icons[f][DELTAY]; // if its gone, reinit if (icons[f][YPOS] > 64) { icons[f][XPOS] = random() % 128; icons[f][YPOS] = 0; icons[f][DELTAY] = random() % 5 + 1; } } } }
void render() { /* let list be the list of elements to be displayed at the given position, with x and y being the co-ordinates now we shall dislay the given text as per the given input */ glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); glColor3f(1, 0, 0); drawbitmap(" CG project", 735, 150); drawbitmap(" data visualisation", 725, 250); drawbitmap(" by Ravi.C and Prajwal .DP", 1200, 700); drawbitmap(" press right mouse button for menu ", 650, 350); glutSwapBuffers(); glFlush(); }
static void w32_drawbitmap(int x, int y, int w, int h, unsigned char *bmp, int pitch, int start, GrxColor fg, GrxColor bg) { RECT Rect; GRX_ENTER(); drawbitmap(x, y, w, h, bmp, pitch, start, fg, bg); Rect.left = x; Rect.top = y; Rect.right = x + w; Rect.bottom = y + h; InvalidateRect(hGRXWnd, &Rect, FALSE); GRX_LEAVE(); }
static void debug_putchar_graphics (void *arg, short ch) { PSD psd = (PSD) arg; MWCOORD width; /* width of text area */ MWCOORD height; /* height of text area */ MWCOORD base; /* baseline of text */ const MWIMAGEBITS *bitmap; /* bitmap for characters */ MWPIXELVAL saved_foreground; MWPIXELVAL saved_background; MWBOOL saved_usebg; int saved_mode; extern MWPIXELVAL gr_foreground; extern MWBOOL gr_usebg; /* Use default system FIXED font. */ gen_gettextbits ((PMWFONT) &gen_fonts[1], ch, &bitmap, &width, &height, &base); /* Put character, move cursor. */ switch (ch) { case '\n': debug_x = 0; debug_y += height; break; case '\r': debug_x = 0; break; case '\t': /* Tab stops at every 4 char heights. */ debug_x = ((debug_x / height) + 4) / 4 * 4 * height; break; case '\b': if (debug_x >= width) debug_x -= width; break; default: /* Draw in COPY mode with black background. */ saved_foreground = gr_foreground; saved_background = gr_background; saved_usebg = gr_usebg; saved_mode = gr_mode; gr_foreground = ~0L; gr_background = 0; gr_usebg = TRUE; gr_mode = MWMODE_COPY; drawbitmap (psd, debug_x, debug_y, width, height, bitmap); gr_foreground = saved_foreground; gr_background = saved_background; gr_usebg = saved_usebg; gr_mode = saved_mode; GdFixCursor (psd); debug_x += width; break; } if (debug_x + width > psd->xvirtres) { /* Roll over right margin. */ debug_x = 0; debug_y += height; } if (debug_y + height > psd->yvirtres) { /* Roll over the screen. */ debug_y = 0; } }