Jump to content

wctltya

Members
  • Posts

    87
  • Joined

  • Last visited

Posts posted by wctltya

  1. Thank you Joel,

    9 hours ago, Joel Bodenmann said:

    I didn't try it but you should be able to just open a file regularly and load it into a gImage object (named gdispImage in older versions of the library) and then assign that to the imagebox widget's gImage member. Afterwards you have to trigger a re-render of the imagebox widget.

    But, could you give an example, please? I'm using version 2.8.

  2. Hi,

    I have to render a GIF image in many image boxes. So far I'm doing it in a loop, for example

    GHandle image_handle[NumberOf];

    for(i = 0; i < NumberOf; i++) {

    ....

    image_handle = gwinImageCreate(0, &wi.g);

    gwinImageOpenFile(image_handle, "image_file.gif");

    }

    Is there another way, open file once, then link it to the imagebox handlers?

    I know that there are several other function to open image file once, then to draw it, etc, but I don't see a function to link it to the imagebox handler.

    I don't have frame buffer, the screen is rendered directly in the display memory.

     

  3. On 22/08/2013 at 17:01, Joel Bodenmann said:

    Two lined button text is currently not possible.

    Actually It is, just use the new line inside the text and the library will take care. I've the following code for example:

    snprintf(buff, sizeof(buff), "%s\n%s", GetStringResource(txtUnitbackupsTitle[unbackupsItem_IAMtoMB], language), TextBuff);
    gwinSetText(ghUnitbackupsPageElmButton[unbackupsItem_IAMtoMB], buff, TRUE);

     

  4. @inmarket

    On 05/07/2018 at 22:58, inmarket said:

    3. There is a bug in gfxRealloc. This we consider unlikely as the code has been well tested but it is not impossible.

    Definitely there is a bug and it is obvious, I think. See line 138 in gos_x_heap.c:

    if (pfree)
    	return 0;

     Should be

    if (!pfree)
    	return 0;

    And this fixes the issue.

  5. Hi,

    The uGFX studio's v.0.24.1 font converter has an option (check box) Anti-Alias when it is used from studio.

    Why this options doesn't exists in the mcufont.exe (..\foo\ugfx\tools\mcufontencoder\binaries\windows\), attached is a screenshot. Or if it does exists, how to use it?

    BTW about adding a new font in studio:

    1. It will be nice to have an option for multi-range in case of "Custom Range" is selected for filter. For example a "+" button can add another range selector line.

    2. "Unnamed" is a very annoying. I know that using F2 I can rename it, but have a look at the generated font files. If I keep it not renamed, the file name  is "unnamed_arial_regular12_aa" for example and it is similar for constants and defines inside. Or if I rename it for example to "arial_regular12_aa", then the file name is "arial_regular12_aa_arial_regular12_aa", and same for constants and defines.

    mcufont.png

  6. Hi again,

    I found what actually is causing the issue, I think and it is

    28 minutes ago, wctltya said:

    #define GFX_OS_HEAP_SIZE                        61440UL 

    Although I've RAW32 defined and relevant heap size as well, seems that another 60k are booked for OS, which I don't use.

    Since I didn't expect this, and because it is something left just from the beginning of the project, I haven't look into the linker output for. Now I can see it. 

    Joel and inmarket, definitely it's my mistake. But a common detailed description of the all keys in gfxconf with their relations etc., will help us to avoid such mistakes, I think.

    For example I've removed 

    41 minutes ago, wctltya said:

    #define GFX_OS_NO_INIT                              TRUE

    as well, supposing (now) it is not relevant to RAW32 too?

    Do you think a regression test is needed now? I'm afraid it is too complicated and will take a lot of time, because the project is in a very advanced stage.  

  7. The quote from previous report of the same issue:

    "

    Thank you inmarket,

    Just FYI - I'm running RAW32. The uC is Cortex-M4 with plenty of resources (Flash, RAM, FPU). The project is under KDS (single file including) with GCC compiler and the relevant gfxconf are: 

    #define GFX_USE_OS_RAW32    TRUE
    #define GFX_COMPILER        GFX_COMPILER_GCC
    #define GFX_CPU             GFX_CPU_CORTEX_M4_FP
    #define CORTEX_USE_FPU      TRUE
    #define GFX_EMULATE_MALLOC  FALSE

    And the heap size is set accordingly. I was wondering if the compiler shall be set to GFX_COMPILER_ARMCC? Please, let me know, if I shall turn on/off some other keys..  

    "

    Except the compiler definition, which I've removed according to your advice Inmarket. 

    In addition:

    #define GFX_CPU_ENDIAN                           GFX_CPU_ENDIAN_UNKNOWN
    #define GOS_RAW_HEAP_SIZE                    61440UL     //RAW32 relevant
    #define GFX_OS_HEAP_SIZE                        61440UL 
    #define GFX_OS_NO_INIT                              TRUE

    Please, let me know if I've to change something.

  8. Hi Joel and Inmarket,

    Almost an year ago I've reported this issue, but perhaps with very bad and complicated explanation and I didn't get support on it.

    So, today I dig more into and debug it a bit. I'll try to describe the issue and my findings shortly and as clear as possible:

     I have 3 textedit widgets, each into its own container(together with two labels), but all of them are in a common parent container. All textedits widgets are restricted to 4 chars max. But we can focus on two edit box only. Lets name them TE_1 and TE_2.

    Adding max 4 chars in TE_1 is not a problem, unless at least one char is added in TE_2, then I can't add 4th char in TE_1. I'm restricting explanation to TE_1, because even it is the same for TE_2 related to TE_1 its getting more complicated...

    Please see the attached video file. 

    Debugging the issue, shows that the TextEditAddChars(...) in line 74 invokes gfxRealloc(...) , which returns 0 in line 139, which leads to TextEdditAddChars returns FALSE in line 75.

    The particular parameters (filmed in the attached video)  passed to gfxRealloc are pointer to "111", oldsize is 4 and size is 5. Perhaps old size and size includes the NULL terminator, otherwise they should be 3 and 4, I think. But this doesn't cause the issue, as long as the same values are passed when it works, i.e. when TE_2 is empty.

    The link to my previous report describing that issue is here(see the last post) 

     

  9. BTW, my application requiring a second Y-axis (right side), so I've created a function for it.

    You might would like to consider adding an optional second Y-axis to a next library revision as well.

  10. // A graph styling
    static GGraphStyle GraphStyle1 = {
        { GGRAPH_POINT_DOT, 0, Blue },          // Point
        { GGRAPH_LINE_NONE, 2, Gray },          // Line
        { GGRAPH_LINE_SOLID, 0, Red/*White*/ },        // X axis
        { GGRAPH_LINE_SOLID, 0, Blue/*White*/ },        // Y axis
        { GGRAPH_LINE_DASH, 5, Red/*Gray*/, 50 },      // X grid
        { GGRAPH_LINE_DOT, 7, Blue/*Yellow*/, 50 },     // Y grid
        GWIN_GRAPH_STYLE_POSITIVE_AXIS_ARROWS   // Flags
    };
    // Another graph styling
    static const GGraphStyle GraphStyle2 = {
        { GGRAPH_POINT_SQUARE, 5, Red },        // Point
        { GGRAPH_LINE_DOT, 2, Pink },           // Line
        { GGRAPH_LINE_SOLID, 0, Red/*White*/ },        // X axis
        { GGRAPH_LINE_SOLID, 0, Blue/*White*/ },        // Y axis
        { GGRAPH_LINE_DASH, 5, Red/*Gray*/, 50 },      // X grid
        { GGRAPH_LINE_DOT, 7, Blue/*Yellow*/, 50 },     // Y grid
        GWIN_GRAPH_STYLE_POSITIVE_AXIS_ARROWS   // Flags
    };

    so:

    x-Grid, shall be Red, Dash-line

    y-Grid, shall be Blue, Dot-line

  11. The attached image quality is not the best one, but it is enough to see that the grid x/y are exchanged.

    It is always better to read the doc's first :D - saw the window background color is the default background color.

    IMAG2529.jpg

  12. Hi guys,

    Sorry for delayed replay. The code looks like:

    // GHandles
    static GHandle ghGraphPageContainer;
    static GHandle ghGraphPageToolbarButtonBack;
    static GHandle ghGraphPageContentContainer;
    static GHandle ghGraphPageGraphWindow;
    // A set of data points that will be displayed in the graph
    static const point data[5] = {
        { -40, -40 },
        { 70, 40 },
        { 140, 60 },
        { 210, 60 },
        { 280, 200 }
    };
    // A graph styling
    static GGraphStyle GraphStyle1 = {
        { GGRAPH_POINT_DOT, 0, Blue },          // Point
        { GGRAPH_LINE_NONE, 2, Gray },          // Line
        { GGRAPH_LINE_SOLID, 0, Red/*White*/ },        // X axis
        { GGRAPH_LINE_SOLID, 0, Blue/*White*/ },        // Y axis
        { GGRAPH_LINE_DASH, 5, Red/*Gray*/, 50 },      // X grid
        { GGRAPH_LINE_DOT, 7, Blue/*Yellow*/, 50 },     // Y grid
        GWIN_GRAPH_STYLE_POSITIVE_AXIS_ARROWS   // Flags
    };
    // Another graph styling
    static const GGraphStyle GraphStyle2 = {
        { GGRAPH_POINT_SQUARE, 5, Red },        // Point
        { GGRAPH_LINE_DOT, 2, Pink },           // Line
        { GGRAPH_LINE_SOLID, 0, Red/*White*/ },        // X axis
        { GGRAPH_LINE_SOLID, 0, Blue/*White*/ },        // Y axis
        { GGRAPH_LINE_DASH, 5, Red/*Gray*/, 50 },      // X grid
        { GGRAPH_LINE_DOT, 7, Blue/*Yellow*/, 50 },     // Y grid
        GWIN_GRAPH_STYLE_POSITIVE_AXIS_ARROWS   // Flags
    };
    void createPageGraph(void)
    {
    	GWidgetInit wi;
    	gwinWidgetClearInit(&wi);
    
    //Creates a page container with show = false, a toolbar inside with a title and a back button
    	page_common_start(&ghGraphPageContainer,
    	            &ghGraphPageToolbarButtonBack,
    	            NO_SUB_PAGE_BUTTON,
    	            NO_SUB_PAGE_BUTTON_LABEL,
    	            strID_SERVICE_LOGS_PARAMETERS_GRAPHS_TITLE,
    	            0);	//no subpages
    //Creates a content container with application's common backgownd color
    	page_common_add_generic_container(&ghGraphPageContainer, &ghGraphPageContentContainer);
    
    //Graph 320x320
    	wi.g.show = TRUE;
    	wi.g.x = 0;
    	wi.g.y = (PAGE_COMMON_ELEMENTS_HEIGHT - 320)/2;
    	wi.g.width = 320;
    	wi.g.height = 320;
    	wi.g.parent = ghGraphPageContentContainer;
    	//wi.customStyle = &black;	//doesn't work
    	ghGraphPageGraphWindow = gwinGraphCreate(0, &wi.g);
    }
    
    void graphPageDrawGraph(GHandle gh) {
    
    	uint16_t    i;
    
    	/* doesn't work
    	 * gwinSetBgColor(gh, Black);
    	gwinRedraw(gh);*/
    
    	// Set the graph origin and style
        gwinGraphSetOrigin(gh, gwinGetWidth(gh)/2, gwinGetHeight(gh)/2);	//middle
        gwinGraphSetStyle(gh, &GraphStyle1);
        gwinGraphDrawAxis(gh);
    
        // Draw a sine wave
        for(i = 0; i < gwinGetWidth(gh); i++) {
            gwinGraphDrawPoint(gh, i-gwinGetWidth(gh)/2, 80*sin(2*0.2*M_PI*i/180));
        }
    
        // Modify the style
        gwinGraphStartSet(gh);
        GraphStyle1.point.color = Green;
        gwinGraphSetStyle(gh, &GraphStyle1);
    
        // Draw a different sine wave
        for(i = 0; i < gwinGetWidth(gh)*5; i++) {
            gwinGraphDrawPoint(gh, i/5-gwinGetWidth(gh)/2, 95*sin(2*0.2*M_PI*i/180));
        }
    
        // Change to a completely different style
        gwinGraphStartSet(gh);
        gwinGraphSetStyle(gh, &GraphStyle2);
    
        // Draw a set of points
        gwinGraphDrawPoints(gh, data, sizeof(data)/sizeof(data[0]));
    }
    
    void showPageGraph(void) {
    	gwinShow(ghGraphPageContainer);
    	graphPageDrawGraph(ghGraphPageGraphWindow);
    }
    
    //The main loop invokes:
    	createPageGraph();
    	showPageGraph();

    I'm not in front of device(tomorrow I'll post a picture), but the rendered window is:

    - white background color,

    - both sine are OK, i.e. they are drawn horizontally

    - the third line and dots are OK,

    - x axle is solid red west - east line, i.e. horizontal (------>)

    - y axle is solid blue, south - north line, i.e. vertical

    - the origin is in the graph window center

    - x grid's lines are dot, blue (according to GraphStyle1/2 above must be dashed red lines)

    - y grid's lines are dash, red (according to GraphStyle1/2 above must be doted blue lines)

    i.e. everything is fine, except the grid and background. 

    The displays is 320x480 and its orientation is fine. 

  13. I've implemented the graph demo but the picture looks slightly different than result-640x480.gif (aside of the widow dimensions, of course) : 

    1. Seems the Graph grid x/y are exchanged?  Obviously the mistake is in gwin_graph.c between lines 220 and 238.

    2. The background color is not black, so in order to see the axes and grid I've changed their colors.

    In order to set it's  background I tried:

    - setting custom style at creation time wi.customStyle = &black; and

    - setting the widget color at drawing time: gwinSetBgColor(gh, Black);  gwinRedraw(gh);

    both w/o success. 

    Could you tell me, please, how can I set it?

  14. @inmarket Sorry but seems there is another issue which happens when there are more textedit on a page.

    I have 3 on a page, but lets assuming there are two (TE1 and TE2), both are limited to 4 chars.

    Typing in TE1 up to 4 chars, clearing one or more etc. (I'm using virtual kb) is OK, then just focus the TE2(w/o typing), getting back to TE1, still OK;

    But if:

    1. I type one char only in TE2 (assuming TE1 is full) 

    2. then getting back to TE1 and clear(backspace) one char, suddenly the limit for TE1 becomes 3,

    3. then focus on TE2 and I can't type more chars, including replacing of exited.

    The order (TE1 then TE2 or TE2 then TE1) doesn't matter. The starting number of chars entered in the first TEx also doesn't matter. Sounds like a "magic" relations between TE widgets.

    There are many variations of that bug, hopefully I've described it well. But even I've not, play a bit and will see it.

  15. Hi inmarket,

    It's OK for me for now, as long as my app depends on that, i.e. that the all resources will be released on the image box destroying. Otherwise I'll  exceed the defined GFILE_MAX_GFILES.

    But, I still don't understand how to use in an image box widget an already opened image file. Could you give me an example, please? Because, the only way I know to open an image file in an image widget is  

    gwinImageOpenFile(ghImage, "image_file_name");

    and really don't know how to display an already opened image in an image box widget.

  16. @inmarket, whether the file will be closed if the object is destroyed?

    ....
    ghImage1 = gwinImageCreate(0, &wi.g);
    gwinImageOpenFile(ghImage1, "ugfx_logo_banner.bmp");
    ...........
    
    gwinDestroy(ghImage1); //Will this close the file "ugfx_logo_banner.bmp", i.e. will it release the resources?

    and how to reuse the already opened image file in many image boxes widgets? For example: 

    gdispImage myImage;
    gdispImageOpenFile(&myImage, "myImage.gif");

    then how to use it in multiple image boxes, for example ghImage1...ghImageN?

  17. And there is one more symptom I forgot to tell you - When the textedit wg text is set to "1234" (or actually 4 spaces in my workaround) and the marker is before the first or between them, typing is not inserting the new char, but replacing the existing one. And that works fine for me.

    BTW another guy (one at lest) has been reported that issue before me. Don't have time to find his post right now.

  18. Thank you inmarket,

    Just FYI - I'm running RAW32. The uC is Cortex-M4 with plenty of resources (Flash, RAM, FPU). The project is under KDS (single file including) with GCC compiler and the relevant gfxconf are: 

    #define GFX_USE_OS_RAW32    TRUE
    #define GFX_COMPILER        GFX_COMPILER_GCC
    #define GFX_CPU             GFX_CPU_CORTEX_M4_FP
    #define CORTEX_USE_FPU      TRUE
    #define GFX_EMULATE_MALLOC  FALSE

    And the heap size is set accordingly. I was wondering if the compiler shall be set to GFX_COMPILER_ARMCC? Please, let me know, if I shall turn on/off some other keys..  

×
×
  • Create New...