Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Black Belt
3 Views

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). :-)

0 Kudos
1 Reply
Highlighted
Black Belt
3 Views

Never mind, it's a writeable field:

[cpp]

{

    // 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;

}

[/cpp]

0 Kudos