Posts by anuj.tanksali

    Hello,

    I believe Emwin 6.16 is backward compatible with api's used in v5.48. I have a MCUXpresso project which is build using the emwin library. But recently I got the Emwin v6.16.
    I want to use the same API's as before without any modifications in my application code. Currently don't want to use the APP Wizard. Can I do that?

    Thanks
    Regards,
    Anuj

    Hello,

    Am using Image_setGif for setting the gif's which seems to be affecting the timing for the other tasks in my application. I have 4 gifs which animate at a time on one screen.
    I have certain tasks which have to be executed every 5 seconds but the gif drawing affects this timing.

    Is there any way the performance can be increased or any other method of drawing which increases the gif drawing performance.

    Thanks
    Regards,
    Anuj

    Hello,

    I am using iMXRT1064 controller and NXP and Emwin library 5.48. I am using bare metal system i.e. no RTOS. GUI_Exec() is called continuously in super loop while(1). The device communicates with another system through serial communication and I have used interrupts for receiving the serial data. It is observed that when bytes are received in serial interrupt and if at the same time GUI_Exec is called then it seems to block the interrupt and bytes are missed. Is this expected?

    The window contains antialiased arcs and initializes the memdev for rotating a bitmap and memdev draw for displaying the rotated image is also called from PAINT of the window.

    The serial interrupt seems to block and this generally happens when i create or delete the window with lots of widgets , if any intensive tasks such as scrolling text in multiedit.

    So does the Emwin GUI_Exec() function block interrupts from the controller?

    Thanks
    Regards,
    Anuj

    Hi Florian,

    I set the WM_CF_HASTRANS flag to image widget using WM_SetTransState() function in WM_INIT_DIALOG.
    But still facing same issue.

    What I noticed is without the flag if no callback is used then doing only IMAGE_SetGif starts the GIF and it is continuously animating with transparency. So its not the WM_CF_HASTRANS flag issue I think. when I use GUI_GIF_DrawSub with callback I face an issue.

    I need to use the Callback as I want to stop the Animation after last frame is displayed.

    Thanks
    Regards
    Anuj

    Hello Florian,

    Thanks for the quick reply.
    Yes the image has transparency and I checked this on my windows computer.

    When I draw the same sub images in my dialog WM_PAINT they display fine i.e. with transparency. Only when I draw sub images in the image callback I get the transparency issue. So I believe the the GIF is fine as drawing in dialog WM_PAINT is working fine.

    I get the issue with Transparency only when drawing is done in image callback.

    Thanks
    Regards,
    Anuj

    Hi Florian,

    Thanks,
    The issue was with the coordinates I changed the coordinates to (0,0) then it is working but facing an odd issue.
    This is my code in the image callback function.

    if(gasIconState == GAS_ANIMATION_START){
    gasGifSubImageCntr++;
    if(gasGifSubImageCntr >= gasGifInfo.NumImages){
    gasIconState = GAS_ANIMATION_STOP;
    (void)GUI_GIF_DrawSub(GetGasOnImagePtr(), GetGasOnImageSize(), 0, 0, (gasGifInfo.NumImages - 1));
    }
    else{
    (void)GUI_GIF_DrawSub(GetGasOnImagePtr(), GetGasOnImageSize(), 0, 0, gasGifSubImageCntr);
    }
    }
    else if(gasIconState == GAS_ANIMATION_STANDBY){
    DrawBitmap(uimBitmaps[BITMAP_GAS_STANDBY],0,0);
    }
    else if(gasIconState == GAS_ANIMATION_STOP){
    (void)GUI_GIF_DrawSub(GetGasOnImagePtr(), GetGasOnImageSize(), 0, 0, (gasGifInfo.NumImages - 1));
    }

    I display 7 frames for the GIF then stop i.e. display the last frame only.
    While the GIF is animating from first to last frame the background of GIF is black i.e. transparency is not displayed but when the GIF reaches last frame the last frame is displayed correctly i.e. with Transparency.

    How do I resolve this?

    Thanks
    Regards,
    Anuj

    Hello,

    I want to control the no of GIF frames displayed on an image widget so have used a callback for the image widget.

    I use the IMAGE_SetGIFData(hItem, pData, FileSize) to set the GIF to image widget and use WM_SetCallback(hObj, Image_CallbackFunc) to set a callback to image widget.
    The LCD displays blank in this case. When I remove the WM_SetCallback function call then the GIF animation is visible on the LCD. I assume the callback is overwriting the drawing which is done automatically by IMAGE_SetGIFData. So currently I draw a static image in callback function but it is not drawing on LCD.

    My callback function is below,

    static void Image_CallbackFunc(WM_MESSAGE* pMsg) {

    switch (pMsg->MsgId) {
    case WM_PAINT:
    Image_Draw(pMsg);
    break;

    default:
    IMAGE_Callback(pMsg); // The original callback
    break;
    }
    }

    // my callback calls Image_Draw below
    static void Image_Draw(WM_MESSAGE* pMsg){

    GUI_DrawBitmap(&image1, 50, 260);

    }

    The above code does not draw anything on the LCD.

    Am not sure why this is happening.
    Please let me know if this is the right way to use callback with GIF animation on image widget.

    Thanks
    Regards,

    Anuj

    Hello,

    It seems the WM_PAINT invalidates a larger area in above case where the arc gets cleared.

    As GIF widgets are at the left of the window and date and time text widget is at the bottom right of the window if both have to be updated then emwin updates the whole rectangle. Due to this the center area where ARC is present gets cleared. (As per "Invalidation" section in Emwin Manual)

    I used WM_ValidateWindow to specify emwin do not update the ARC area, due to this if earlier the issue was coming in 2-3 minutes then after calling WM_ValidateWindow the issue arises after approx an hour.

    Is there any way to avoid the above default emwin behavior?

    Thanks
    Regards
    Anuj

    Hello,

    I have 2 image widgets on which I show GIF animations or static image depending on events.
    The 2 image widgets have same height and width and are placed at same location on the dialog window.

    Initial state when the dialog window loads is image1 is static and image 2 on which I want to show GIF is hidden.

    On 25msec scheduler depending on conditions I enable image 2 using IMAGE_SetGif and hide the image 1 which I don't want to show. The image 1 hides for a second and then reappears. In this case I see image 1 is static and visible and image 2 is animating on top on Image 1. I observed that image 1 reappears after WM_PAINT is called.

    my sample code is below

    if(var1){
    var1 = 0;
    IMAGE_SetGif();

    if(var2){
    var2 = 0;
    WM_HideWindow(hImage1);
    }
    }

    both If conditions are true at once.
    Is it because of the invalidation of image 2 is happening continuously as IMAGE_SetGif() is called for it.
    I tried calling WM_Paint(hImage1) immediately after WM_HideWindow(hImage1) but still same issue.

    How do I resolve this issue?


    Thanks
    Regards
    Anuj

    Hello,

    I have used 2-3 gif's on my dialog window and am using using image_SetGif function and they are working fine. I have other Text widgets and some drawing in Paint too.

    The following widgets below have to be updated and some drawing in my dialog window,

    1) Image widget on Top Left corner of window on event in 25msec scheduler.
    2) 3 GIF's using 3 image widgets placed at the left of the window. (at one time all the GIF's are animating simultaneously) animation initiated in 25msec scheduler on events.
    3) Arc's and GUI_MEMDEV_WriteAt at the center of the window have to be updated on variable change. (called WM_InvalidateArea only if change in 25msec scheduler to update)
    4) Text widget placed at the top right updated only on event. checked in 25msec scheduler.
    5) Text widget at the bottom corner right updated every minute. checked in 25msec scheduler.

    While loading the dialog window the area drawn in point 3 above gets cleared. It is not repetitive and the behavior is random. Also whenever any text widget is updated in 25msec loop the area drawn in point 3 gets cleared.

    The point no 3 is handled in WM_PAINT as below,

    case WM_PAINT:

    GUI_SetBkColor();
    GUI_Clear();

    // Handle point 3 mentioned above
    if(paramChange){
    paramChange = 0;
    GUI_drawArc1();
    GUI_drawArc2();
    GUI_drawArc3();
    GUI_drawArc4();

    GUI_MEMDEV_WriteAt();

    }

    break;

    Observations

    1) using Image_SetGif continuously calls WM_PAINT.
    2) if I remove the IF condition above it works without any issue but I do not want to draw the other area every time. It also decreases the performance if drawn every time.
    3) If I keep the IF condition then the area with the dial and memdev write area gets displayed once on dialog load and then gets cleared.
    4) if the dial area is not cleared on window load then sometimes whenever a TEXT_SetText is called then it gets cleared. TEXT widget is on a totally different area on the window and it does not coincide with the dial area.

    So am not sure how to handle this behavior. How can I make sure to draw the Arcs and GUI_MEMDEV_WriteAt only when required in WM_PAINT.
    Please let me know what can be done to resolve this.

    Thanks
    Regards,
    Anuj

    Hello,

    I have using Image_SetGif to display a gif but wanted to stop the Gif animation after last frame is displayed. Currently the Gif is displayed in a continuous loop.
    Animated sprites are one option but it seems sprites take up lot of memory so I wanted to use Image_SetGif only and stop the anination.
    Is there any way to do this?

    Thanks
    Regards
    Anuj

    Hello,

    How do I go about adding multiple language support. Am using iMXTR1064 with SDRAM for LCD buffer and external flash WITHOUT FILESYSTEM which I plan to use for storing strings, fonts, bitmaps etc.

    Other than English, I need to add support for French, German, Dutch and Chinese.
    How do I go about generating font files for languages mentioned above using the font convertor?.

    Also is there a way to generate a single font file with all the sizes and fonts. Currently for English I have to generate different font files as per font size, and whether it is bold or not. for e.g. if I want a single font file century gothic which will contain all the sizes and bold fonts too.

    Thanks
    Regards
    Anuj

    Hi,

    Thanks for your reply.

    By "separate window" do you mean using image widget for each of the drawings? ? If yes then not sure if possible as for the first drawing I can use image widget as it is GIF which I want to show but for drawing other 2 areas I use GUI_draw_arc and GUI_MEMDEV_Writeat functions

    If you mean using separate child windows for drawing 3 areas then I think it can be done but handling will be little complex.

    Regards,
    Anuj

    Hello,

    I was not able to understand clearly.

    My paint event is

    SetBkColor(color);
    GUI_Clear();


    if(variable1)
    {
    GIF_drawsub();
    }

    if( variable2)
    {
    variable2 = 0;
    drawArc()
    }

    if( variable3)
    {
    variable2 = 0;
    GUI_MEMDEV_WriteAt();
    }

    I want to retain the arc and memdev image drawn earlier on LCD. How do I do that?.
    As in above code I am drawing everything each time PAINT is called it takes time.

    Thanks
    Regards,
    Anuj

    Hello,

    Thanks for your reply.

    Is my code correct above. if I want to update an area continuously and update different areas intermittently do I need to draw all areas in PAINT as shown in above code.

    As currently GUI_Clear is called I may have to redraw everything.
    Can GUI_Clear be avoided and clear only specific areas which have to be updated and draw only those areas.

    Thanks
    Regards,
    Anuj

    Hello,

    I have a GIF animation which I want to continuously show on a dialog window based on a variable. Currently the animation works but it slows down the system.
    I have a function which is called every 25msec in my super loop while(1). In the function I get the Sub image from the GIF image and call WM_InvalidateArea to update only the rectangle area of the GIF image shown. I have other areas too for which I call the same WM_InvalidateArea to be updated based on other variables but this is not frequent and need to be done only on variable change.

    When WM_InvalidateArea is called it triggers the PAINT event and on paint I draw the image using GUI_GIF_DrawSub.

    So the requirements are,

    1) Update GIF area by WM_InvalidateArea called every 25msec. once the variable is set then animation is to be continuously shown until variable gets cleared.

    GUI_GIF_DrawSub is called in PAINT to handle above point.

    2) Update other area1 by WM_InvalidateArea called on 25msec but WM_InvalidateArea is called only when change in variable. Called only once if change.

    DrawOtherArea1() is called in PAINT which calls GUI_Draw_Arc1(), GUI_Draw_Arc2(), GUI_Draw_Arc3() to handle above point.

    3) Update other area2 by WM_InvalidateArea called on 25msec but WM_InvalidateArea is called only when change in variable. Called only once if change. MEMDEV is updated here

    DrawOtherArea2() is called in PAINT to handle above point.
    (This uses GUI_MEMDEV_WriteAt function)


    My PAINT function is as below

    GUI_SetBkColor(color);
    GUI_Clear();
    GUI_GIF_DrawSub(...) // Handle point 1 above

    DrawOtherArea1(); // Handle point 2 above // GUI_Draw_Arc is called 3 times to draw 3 arcs.
    DrawOtherArea2(); // Handle point 3 above // GUI_MEMDEV_WriteAt is called.

    This takes up some time due to which the system becomes slow.
    I am not sure how to handle all the 3 points at once in PAINT as currently all get drawn.

    Even if there are no updates for point 2 and point 3 whether still I have to call DrawOtherArea1() DrawOtherArea2() in PAINT?
    Are there any better ways to handle such scenario?

    Thanks
    Regards,

    Anuj