Jump to content

Recommended Posts

Posted

Hello.

I am trying to use Image Box but I get "unknown type name 'GHandle'" when trying to build.

I assume that i have not enabled something in my ugfxconf file.

What could it be?

I have rom file system working with my image converted to a h file also .

Thank you.

Posted

Well I have been playing around and I am now trying to get an image to display the normal way..

I am using the romfs and I have my romfs_files.h sorted with a bmp image converted via file2c (bf.h)

My code runs fine but no image displays (I toggle an LED in the while and the code does not jam up)


#include "gfx.h"
static gdispImage myImage;
int main(void) {
halInit();
chSysInit();
coord_t swidth, sheight;
gfxInit();
gdispSetOrientation(GDISP_ROTATE_90);
swidth = gdispGetWidth();
sheight = gdispGetHeight();
gdispImageOpenGFile(&myImage, "bf.h");
gdispImageDraw(&myImage, 20, 20, swidth, sheight, 10, 10);
gdispImageClose(&myImage);
while(TRUE) {
gfxSleepMilliseconds(500);
}
}


#ifndef _GFXCONF_H
#define _GFXCONF_H

/* The operating system to use. One of these must be defined - preferably in your Makefile */
#define GFX_USE_OS_CHIBIOS TRUE
//#define GFX_USE_OS_WIN32 FALSE
//#define GFX_USE_OS_LINUX FALSE
//#define GFX_USE_OS_OSX FALSE

/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
#define GFX_USE_GFILE TRUE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
#define GDISP_NEED_CLIP TRUE
#define GDISP_NEED_TEXT TRUE
#define GDISP_NEED_ANTIALIAS FALSE
#define GDISP_NEED_CONTROL TRUE
#define GDISP_NEED_STARTUP_LOGO FALSE
#define GDISP_NEED_CIRCLE FALSE
#define GDISP_NEED_MULTITHREAD FALSE
#define GDISP_NEED_IMAGE TRUE
#define GDISP_NEED_IMAGE_BMP TRUE
#define GDISP_NEED_IMAGE_BMP_1 FALSE
#define GDISP_NEED_IMAGE_BMP_4 FALSE
#define GDISP_NEED_IMAGE_BMP_4_RLE FALSE
#define GDISP_NEED_IMAGE_BMP_8 FALSE
#define GDISP_NEED_IMAGE_BMP_8_RLE FALSE
#define GDISP_NEED_IMAGE_BMP_16 FALSE
#define GDISP_NEED_IMAGE_BMP_24 FALSE
#define GDISP_NEED_IMAGE_BMP_32 FALSE
#define GDISP_NEED_IMAGE_PNG FALSE
#define GDISP_NEED_IMAGE_NATIVE FALSE

/* GDISP - fonts to include */
#define GDISP_INCLUDE_USER_FONTS FALSE
#define GDISP_INCLUDE_FONT_UI1 FALSE
#define GDISP_INCLUDE_FONT_UI2 FALSE
#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS24 TRUE
#define GDISP_INCLUDE_FONT_DEJAVUSANS32 TRUE
#define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 FALSE
#define GDISP_INCLUDE_FONT_FIXED_10x20 FALSE
#define GDISP_INCLUDE_FONT_FIXED_7x14 FALSE
#define GDISP_INCLUDE_FONT_FIXED_5x8 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE
/*gfile */
#define GFILE_NEED_ROMFS TRUE
#define GFILE_NEED_NATIVEFS FALSE
#define GFILE_NEED_CHBIOSFS FALSE
/*GWIN*/
#define GWIN_NEED_IMAGE FALSE
#define GWIN_NEED_CONTAINER FALSE
#define GWIN_NEED_WIDGET FALSE
#endif /* _GFXCONF_H */

Posted

Start with the image demo and get that working first. Once that is working replace the image with your image. If it doesn't display then you have either not enabled the right decoder for your image or there is something funny about the image.

I hope that helps you find the problem.

Posted

Also, just looking at your gfxconf.h file, whilst you have enabled bmp images you have not enabled the particular sub-format of your image eg GDISP_NEED_IMAGE_BMP_8. As a first test set all the sub - image formats to TRUE in your gfxconf.h. You can always turn the extra ones off later to reduce code size.

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...