Write Bitmap hexadecimal to framebuffer (For FreeRTOS)

Hello,
Your library looks amazing but unfortunately ,I cannot use it on FreeRTOS for display of images.

In my algorithm i need to convert an image to a byte array then output this byte array to framebuffer so instead of using the usual libraries that just display the image to framebuffer,I want to read the values from the byte array and write them to the framebuffer. Main problem is how to convert the image and after that how to display it .

I managed thanks to this header of fonts in this https://github.com/RitwikGupta/SyscallGraphicsLibrary/blob/master/library.c to print letters . I tried with image to save it as c code with GIMP or use the convert command line in ubuntu (which both of them return a byte array in a c file containing more than 10000 lines) but I couldn't render it so I don't know if it is because of my code or because of the conversion.

I saw in your textures.c a function named ImageDraw but it is too complex to use it :(
Would you mind telling me how to take the hexadecimals values from an image and then write it to the corresponding pixel of the framebuffer?

Any help to solve this would be greatly appreciated.

Thank You so muchhh!!

Comments

  • Summarizing my mail answer on this topic:

    raylib is primary intended for OS with OpenGL support... but I prepared a set of functions in raylib to deal directly with image data buffers, independently of any external library.

    Those functions work directly with an Image struct (https://github.com/raysan5/raylib/blob/master/src/raylib.h#L347), where image.data is directly an array of bytes organized in the format defined by image.format (https://github.com/raysan5/raylib/blob/master/src/raylib.h#L521). To load the image data from disk, just need to do:

    Image myImage = LoadImage("my_image.png"); // Note there are multiple variants of LoadImage*() (https://github.com/raysan5/raylib/blob/master/src/raylib.h#L799)

    Once you have an image loaded, you already have the image.data filled and you can use it as a canvas to draw to, using the multiple Image*() functions provided by raylib (https://github.com/raysan5/raylib/blob/master/src/raylib.h#L822)

    Definitely, I need to add some examples to illustrate all this functionality usage. I could prepare some sample but it could take me some days...

    Cheers,

    Ray
  • Thank you so much for answering me so quickly.

    I need the image data provided as a byte array same as the font.h in the repository I gave you. I would love to have your tool to convert image to plain C byte arrays :)

    I don't have hardware limitations.The resolution is 1024*768.

    It would be fabulous if you could provide me with an example to do the same as what is shown in the repository but for an image (convert it to byte array then write it to framebuffer pixels).

    I will wait for you because right now I am trying to make it work without results unfortunately.

    Thank you so much again.

    Best regards,

    Youssef
Sign In or Register to comment.