Download 4DGL
 
About 4D Systems LTD
4D Systems, Australia
Home Company Products 4DGL Developers Center Downloads Support forum Distributors News & Events Contact us

uSD_Image

Back to listing | Print document

uSD_Image(x, y);

Description:
Displays an image from the uSD card at screen location specified by x,y (top left corner). The location of the Image in the uSD card must be specified by uSD_setSector() function. Image parameters such as width, height and pixelwidth are embedded into the image data block.

Parameters:
x, y: specifies the horizonal and vertical position of the top left corner of the Image.

Example:

#platform "uOLED-32028-PMD3T"

/*

4DGL Demo Application
- Test for uSD_Image(x,y) -
- for the following PICASO Platforms -
- uOLED-32024-PMD3 -
- uOLED-32024-PMD3T -
- uOLED-32028-PMD3 -
- uOLED-32028-PMD3T -
- uLCD-320-PMD2 -


Requires Graphics Composer version 2.0.1.0

The image and video formats under 4DGL has changed slightly from the serial platform versions.
The image height, width and colour_mode(colour bits per pixel) parameters are now embedded into the
image data block and does not require the user to pass these parameters to the image/video display functions.

Getting Started:
- Make sure to download the latest Graphics Composer version 2.0.1.0
- You'll need a SD card reader/writer.
- Run the GC and create a new project.
- Enable the following settings:

"Device" -> "Load Options" -> "Com Port/Drive" = (your drive name for the card reader, eg J:)
"Device" -> "Load Options" -> "Write Command Block" = NO
"Device" -> "Load Options" -> "Image Format" = Image & Pixel Data

- Change the properties of the display resolution to

X = 240, Y = 320

- On the left "Actions" window pane right click the mouse button and add the following images:

..\4DGL_Workshop_Version_a1.0\Images\Jpg\abstract_azo5onui.jpg"
..\4DGL_Workshop_Version_a1.0\Images\Jpg\aeon041114.jpg"
..\4DGL_Workshop_Version_a1.0\Jpg\hibiscus_hkowya9a.jpg"
..\4DGL_Workshop_Version_a1.0\Images\Jpg\seasunset_5umhrb4r.jpg"
..\4DGL_Workshop_Version_a1.0\Images\Jpg\strawberry_3db7f143.jpg"
..\4DGL_Workshop_Version_a1.0\Images\Jpg\sunset_q4l1iowt.jpg"


- Save your project, e.g ImageDemo1.gcs
- Select "Device" -> "Load" to save all of the image data into the uSD card.
- Using a text editor (eg Notepad) open the ImageDemo1.txt file the GC has created.
Note down each of the sector addresses for each of the images. You will need these for the
uSD_SetSector(SectHiWord, SectLoWord) function. In this case the sector addresses have already been
inserted into the uSD_SetSector() function calls for each image for this example programas can be seen below.

*/

//-------------------------------------------------------------------------------------------------------------------------------------------
func main()

if(uSD_Init() == 0) // initialise and test the uSD card
print("PLEASE INSERT uSD CARD");
while(1);
endif

repeat
uSD_SetSector(0x0000, 0x1000); // set sector for image 1 ..\4DGL_Workshop_Version_a1.0\Images\Jpg\abstract_azo5onui.jpg"
uSD_Image(0, 0); // display image 1 at x=0, y=0
pause(2000); // pause for 2 seconds

uSD_SetSector(0x0000, 0x112D); // set sector for image 2 ..\4DGL_Workshop_Version_a1.0\Images\Jpg\aeon041114.jpg"
uSD_Image(0, 0); // display image 2 at x=0, y=0
pause(2000); // pause for 2 seconds

uSD_SetSector(0x0000, 0x125A); // set sector for image 3 ..\4DGL_Workshop_Version_a1.0\Jpg\hibiscus_hkowya9a.jpg"
uSD_Image(0, 0); // display image 3 at x=0, y=0
pause(2000); // pause for 2 seconds

uSD_SetSector(0x0000, 0x1387); // set sector for image 4 ..\4DGL_Workshop_Version_a1.0\Images\Jpg\seasunset_5umhrb4r.jpg"
uSD_Image(0, 0); // display image 4 at x=0, y=0
pause(2000); // pause for 2 seconds

uSD_SetSector(0x0000, 0x14B4); // set sector for image 5 ..\4DGL_Workshop_Version_a1.0\Images\Jpg\strawberry_3db7f143.jpg"
uSD_Image(0, 0); // display image 5 at x=0, y=0
pause(2000); // pause for 2 seconds

uSD_SetSector(0x0000, 0x15E1); // set sector for image 6 ..\4DGL_Workshop_Version_a1.0\Images\Jpg\sunset_q4l1iowt.jpg"
uSD_Image(0, 0); // display image 6 at x=0, y=0
pause(2000); // pause for 2 seconds
forever

endfunc
//-------------------------------------------------------------------------------------------------------------------------------------------

Supported Goldelox 4DGL Platforms:
μOLED-96-G1
μOLED-128-G1
μOLED-160-G1
μOLED-128-GMD1
μOLED-160-GMD1

Supported Picaso 4DGL Platforms:
μLCD-320-PMD2 
μLCD-32032-P1T 
μOLED-32024-PMD3 
μOLED-32024-PMD3T 
μOLED-32028-PMD3 
μOLED-32028-PMD3T
 
μOLED-32024-P1
μOLED-32024-P1T 
μOLED-32028-P1 
μOLED-32028-P1T 

 

Copyright © 2007 4D Systems Pty Ltd, Sydney, Australia - All Rights Reserved