Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to reverse that function
    text
    copied!<p>I've asked before about the opposite of Bitwise AND(&amp;) and you told me its impossible to reverse.</p> <p>Well,this is the situation: The server sends an image,which is encoded with the function I want to reverse,then it is encoded with zlib.</p> <p>This is how I get the image from the server:</p> <pre><code> UInt32[] image = new UInt32[200 * 64]; int imgIndex = 0; byte[] imgdata = new byte[compressed]; byte[] imgdataout = new byte[uncompressed]; Array.Copy(data, 17, imgdata, 0, compressed); imgdataout = zlib.Decompress(imgdata); for (int h = 0; h &lt; height; h++) { for (int w = 0; w &lt; width; w++) { imgIndex = (int)((height - 1 - h) * width + w); image[imgIndex] = 0xFF000000; if (((1 &lt;&lt; (Int32)(0xFF &amp; (w &amp; 0x80000007))) &amp; imgdataout[((h * width + w) &gt;&gt; 3)]) &gt; 0) { image[imgIndex] = 0xFFFFFFFF; } } } </code></pre> <p>Width,Height,Image decompressed and Image compressed length are always the same.</p> <p>When this function is done I put image(UInt32[] array) in a Bitmap and I've got it.</p> <p>Now I want to be the server and send that image.I have to do two things:</p> <p>Reverse that function and then compress it with zlib.</p> <p>How do I reverse that function so I can encode the picture?</p> <pre><code> for (int h = 0; h &lt; height; h++) { for (int w = 0; w &lt; width; w++) { imgIndex = (int)((height - 1 - h) * width + w); image[imgIndex] = 0xFF000000; if (((1 &lt;&lt; (Int32)(0xFF &amp; (w &amp; 0x80000007))) &amp; imgdataout[((h * width + w) &gt;&gt; 3)]) &gt; 0) { image[imgIndex] = 0xFFFFFFFF; } } } </code></pre> <p>EDIT:The format is 32bppRGB</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload