Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Thank You for your continued support and contributions!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Plugins/Viewers
| | |-+  Load image and draw it
« previous next »
  • Print
Pages: [1]

Author Topic: Load image and draw it  (Read 1236 times)

Offline d3nn1as

  • Member
  • *
  • Posts: 15
Load image and draw it
« on: August 02, 2007, 02:33:07 PM »
I want to load a couple of image files, and draw them on the screen.

Found the graphic functions:
http://www.rockbox.org/twiki/bin/view/Main/GraphicsAPI#Functions

But I still don't got a clue how to load a bitmap file?
« Last Edit: August 02, 2007, 02:43:27 PM by d3nn1as »
Logged

Offline gratt

  • Member
  • *
  • Posts: 34
Re: Load image and draw it
« Reply #1 on: August 04, 2007, 08:31:53 PM »
I just spent several hours figuring this out.
Very little documentation and it is spread all over.
here is a code snipit to read and display an image:

    /* buffer to hold bitmap data */
    static fb_data save_buffer[LCD_WIDTH*LCD_HEIGHT*sizeof(fb_data)];    
    struct bitmap bm;
    bool ret;
    /* point struct data pointer to buffer */
    bm.data = (char*)save_buffer;
    /* read the bitmap */
    ret = read_bmp_file( "/splash.bmp", &bm, LCD_WIDTH*LCD_HEIGHT*sizeof(fb_data), FORMAT_NATIVE );
    /* test if the bitmap was read */
    if((ret==false) || (bm.width > LCD_WIDTH ) || ( bm.height > LCD_HEIGHT )){
    /* display an error message */
    }else{          
    lcd_bitmap(save_buffer, 0, 0, LCD_WIDTH,LCD_HEIGHT);
    lcd_update();
    }

This works great in the sansa sim. I have not yet tried it on target.
GRaTT
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Plugins/Viewers
| | |-+  Load image and draw it
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.062 seconds with 15 queries.