Rotate bmp image

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Rotate bmp image

    I got a problem when trying to rotate an image.
    I'm able to rotade a gradient. When I try to rotate an image, the image isn't shown. Even if I try do create an image in a memory device and try to copy it directly to the screen it fails.

    Source Code

    1. GUI_MEMDEV_Handle hDst;
    2. GUI_MEMDEV_Handle src;
    3. int rot=getGraphicsRotation();
    4. src=GUI_MEMDEV_CreateFixed(0,0,sizeX,sizeY ,GUI_MEMDEV_NOTRANS,GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_888);
    5. if(rot==0 || rot==180)
    6. {
    7. hDst=GUI_MEMDEV_CreateFixed(0,0,sizeX,sizeY, GUI_MEMDEV_NOTRANS,GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_888);
    8. }
    9. else
    10. {
    11. hDst=GUI_MEMDEV_CreateFixed(0,0,sizeY,sizeX,GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_888);
    12. }
    13. GUI_MEMDEV_Select(src);
    14. err=GUI_BMP_Draw ( fileBuffer,x,y);
    15. /*GUI_RECT RectSource = {0, 0, 69, 39};
    16. GUI_DrawGradientV(RectSource.x0, RectSource.y0,
    17. RectSource.x1, RectSource.y1,
    18. GUI_WHITE, GUI_DARKGREEN);*/
    19. GUI_MEMDEV_RotateHQ( src,hDst ,0,0,0,rot*100);
    20. GUI_MEMDEV_Select(0);
    21. GUI_MEMDEV_CopyToLCDAt(src,x,y);
    22. GUI_MEMDEV_Delete(hDst);
    Display All
  • Hello,

    Please check the return value of create functions. If the returned handle equals 0, the Memory Device is not created. If the Memory Device is not created emWin likely does not have enough memory.

    The rotated result is stored in hDst, but the function GUI_MEMDEV_CopyToLCDAt() is called with src as parameter.

    Best regards,
    Adrian