Jump to content

Open image without widgets


ForTest

Recommended Posts

Hello everyone!

We are trying to open image files without using widgets but we are not clear how to do that

We have been looking at these
- https://wiki.ugfx.io/index.php/Images
- https://wiki.ugfx.io/index.php/ROMFS

We mapped our logo in .h format and included it inside the file "romfs_file.h"

From here then it is not clear to us how to go forward.
Can you give us any suggestions?

Thank you

 

Link to comment
Share on other sites

Assuming your image is available via the GFILE module, you can just use the gdispImageXxx() API from here:

#include "gfx.h"

int main(void)
{
	gImage myImage;

	// Initialize uGFX and the underlying system
	gfxInit();

	// Set up IO for our image
	gdispImageOpenFile(&myImage, "my_image.bmp");
	gdispImageDraw(&myImage, 0, 0, gdispGetWidth(), gdispGetHeight(), 0, 0);
	gdispImageClose(&myImage);

	while(1) {
		gfxSleepMilliseconds(1000);
	}

	return 0;
}

You can find a ready-to-run demo under /demos/modules/gdisp/images.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...