Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12589 Discussions

Some help in application selector example

Altera_Forum
Honored Contributor II
983 Views

Hi, 

 

Can anyone explain this function to me (I mean explaining each statment in this function and how does it work)  

Note : This function is included in the app_selector_gui.c in the appication selector example which works on the Nios II embededd Cyclone III edition . 

 

int AsPrerenderFont( unsigned char* rendered_letters[], 

struct abc_font_struct font[], 

int fg_color, 

int bg_color ) 

 

int i; 

// We're going to use the video library functions to render this, and 

// since those functions expect an alt_video_display type to which to write, 

// we create a small temporary one here and fill it out just enough to draw  

// to it. 

alt_video_display* temp_buffer; 

temp_buffer = (alt_video_display*) malloc(sizeof (alt_video_display)); 

temp_buffer->color_depth = 32; 

temp_buffer->num_frame_buffers = 1;  

temp_buffer->bytes_per_pixel = ( 4 ); 

temp_buffer->buffer_being_written = 0; 

temp_buffer->buffer_ptrs[0] = (alt_video_frame*) malloc( sizeof( alt_video_frame )); 

for( i = 0; i < 94; i++ ) 

temp_buffer->width = font.bounds_width ; 

temp_buffer->height = font.bounds_height; 

temp_buffer->bytes_per_frame = (( temp_buffer->width * temp_buffer->height ) * 4 ); 

temp_buffer->buffer_ptrs[0]->buffer = (void*) malloc( temp_buffer->bytes_per_frame ); 

vid_print_char_alpha ( 0, 0, fg_color, i + 33, bg_color, font, temp_buffer ); 

rendered_letters[i] = temp_buffer->buffer_ptrs[0]->buffer; 

 

free( temp_buffer->buffer_ptrs[0] ); 

free( temp_buffer ); 

return( 0 ); 

}
0 Kudos
0 Replies
Reply