Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I'm building a 3d (red,cyan) program. It went well, but when combining, the "image" (see in code) doesn't seemed to be affected. what is my mistake?

RImage_P(point)= {5,5}
startCyan (point) = {0,0}
startRed (point) = {5,5}
CImage, RImage are below the code. image result is a fully black transparent image.
for testing and debugging, I have commented the Alpha ( the results are the same)

private void bitCombine(System.Drawing.Point startCyan, System.Drawing.Point startRed)

       using (Bitmap image = new Bitmap(CImage.Width + Math.Abs(RImage_P.X), CImage.Height + Math.Abs(RImage_P.Y),PixelFormat.Format32bppArgb))

            var rectfull = new Rectangle(0, 0, image.Width, image.Height);
            var rect = new Rectangle(0, 0, CImage.Width, CImage.Height);
            var bitsC = CImage.LockBits(rect, ImageLockMode.ReadOnly
                                        , PixelFormat.Format32bppArgb);
            var bitsA = alpha.LockBits(rect, ImageLockMode.ReadOnly
                                        , PixelFormat.Format32bppArgb);
            var bitsOutput = image.LockBits(rectfull, ImageLockMode.WriteOnly
                                        , PixelFormat.Format32bppArgb);
                for (int y = 0; y < CImage.Height; y++)
                    byte* ptrC = (byte*)bitsC.Scan0 +  y * bitsC.Stride;
                    byte* ptrA = (byte*)bitsA.Scan0 +  y * bitsA.Stride;
                    byte* ptrOutput = (byte*)bitsOutput.Scan0 
                                      + (y+startCyan.Y)* bitsOutput.Stride;
                    for (int x = 0; x < CImage.Width; x++)// cyan values
                    {// gui+ is reversed BGRA
                        ptrOutput[4 * (x+startCyan.X)] = ptrC[4 * x];           // blue
                        ptrOutput[4 * (x + startCyan.X) + 1] = ptrC[4 * x + 1];// green
                      //ptrOutput[4 * (x + startCyan.X) + 3] = ptrA[4 * x + 3];// alpha


                var bitsR = RImage.LockBits(rect, ImageLockMode.ReadOnly
                                           , PixelFormat.Format32bppArgb);
                for (int y = 0; y < RImage.Height; y++)// red values
                    byte* ptrR = (byte*)bitsR.Scan0 + y  * bitsR.Stride;
                    byte* ptrA = (byte*)bitsA.Scan0 + y  * bitsA.Stride;
                    byte* ptrOutput = (byte*)bitsOutput.Scan0
                                       + (y+ startRed.Y) * bitsOutput.Stride;
                    for (int x = 0; x < RImage.Width; x++)
                    {// gui+ is reversed BGRA
                        ptrOutput[4 * (x + startRed.X) + 2] = ptrR[4 * x + 2];   // red
                       //ptrOutput[4 * (x + startRed.X) + 3] = ptrA[4 * x + 3];// alpha


                this.image = image;


the images:(I guess I can't show them on this site...)
CIamge RImage

share|improve this question

closed as too localized by Wesley Murch, ChrisF, Josh Caswell, Al E., Bo Persson Sep 1 '12 at 17:50

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Suspended, perhaps? – Mr Lister Sep 1 '12 at 13:19
1. I'm not suspended. 2. all of my code is in the box... ( start: private void... end:...this.image = image; }}}) – Almog Dubin Sep 1 '12 at 13:25
Is this your first attempt at posting a question on Stack Overflow? Can you at least share the error message you get when trying to post this? One possibility is that the section after assume: looks like unformatted code. – Wesley Murch Sep 1 '12 at 13:27
Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon.... what do am I missing? – Almog Dubin Sep 1 '12 at 13:30
That might be due to the RImage_P(point)= {5,5} and such before your code block. That looks a lot like code. It might trick the system into thinking you didn't format properly. Try to format that as code for now and see if it changes anything. – Bart Sep 1 '12 at 13:33
Try formatting that section as a list, perhaps with `inline code blocks`. – Wesley Murch Sep 1 '12 at 13:36
Bart is correct, thank you Bart. – Almog Dubin Sep 1 '12 at 13:36
So you were able to post that question now? (Just asking because I don't see it appear in your profile). Nevermind, I see you have multiple accounts: – Bart Sep 1 '12 at 13:38
up vote 3 down vote accepted

Your post is confusing the algorithm that tries to detect that a user is posting code without properly formatting it. Very high odds that the 5 lines that start with "assume" cause this. Pretty odd that you got them all on a separate line like you did, that normally requires <br>.

Indent those lines by 4 spaces to un-confuse the algorithm.

share|improve this answer
OT, but instead of a <br/>, two spaces at the end will also do the trick. – Bart Sep 1 '12 at 13:39

Not the answer you're looking for? Browse other questions tagged .