Graphical examples over the network to different endianness

Graphical examples over the network to different endianness

It is possible to run the graphical examples over the network, e.g., using "ssh -X". However, if client and server use different endianness, the colours look unfamiliar compared to an all-local setup.

If you're familiar with the X Window System, you might consider contributing a solution that uses XImage::byte_order to conditionally swap the bytes returned from get_color() and whatever else is needed to make this problem go away, so I can go read a book instead (I'm getting only partial success so far). :-)

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Never mind, it's a writeable field:

    // Note: It may be more efficient to adopt the server's byte order
    //       and swap once per get_color() call instead of once per pixel.
    const uint32_t probe =0x03020100;
    const bool big_endian = (((const char*)(&probe))[0]==0x03);
    ximage->byte_order = big_endian ? MSBFirst : LSBFirst;

Leave a Comment

Please sign in to add a comment. Not a member? Join today