How to handle tiles/sprites

Nov 28, 2010 at 7:14 PM
Edited Nov 28, 2010 at 7:30 PM


First off, great project!

I'm writing an isometric tile engine and using this project. Each isometric tile has surrounding area which is of a fixed color (in this case a black, but it would usually be an extreme color). Sprites will work in the same way. Does the current Blit method support any way to ignore a certain pixel color?

Or is there another way to approach this?

Screen from current app below.



Nov 28, 2010 at 8:25 PM

Hi Liam,


The Blit method supports alpha blending. Just set the alpha value of the green area to 0 and use Alpha as BlendMode. You can also implement this procedure in your code. Alternatively just adapt the WriteableBitmapEx Blit method for your needs.


- Rene Schulte

Nov 29, 2010 at 9:48 AM

I will have a look at extending the method.

I like this project, alot, what are your plans for it going forward?

Nov 29, 2010 at 10:26 AM

Have a look at the open issues

Esp. this when you plan to add the color keying blend mode:


- rene

Nov 29, 2010 at 11:27 AM

I'll most likly add an overload to the Blit Method that includes a parameter to ignore a certain pixel color. Is this somthing that could be added to the main project?

Nov 29, 2010 at 12:35 PM

It's actually a BlendMode called ColorKeying. I need to refactor the whole Blit story. It's not very well designed at the moment.



Nov 29, 2010 at 1:15 PM

Well lets work with what we have to start with. I'll try and get the extra blend mode added!

Nov 29, 2010 at 2:34 PM

                        else if(BlendMode == BlendMode.ColorKeying)
                            sr = ((sourcePixel >> 16) & 0xff);
                            sg = ((sourcePixel >> 8) & 0xff);
                            sb = ((sourcePixel) & 0xff);

                            if (sr != color.R || sg != color.G || sb != color.B)
                                destPixels[idx] = sourcePixel;


This will work, when the color parameter is passed with a blending option (Else it uses white for the color).

Nov 29, 2010 at 3:00 PM

Looks good. The color parameter was meant for tinting by Bill (original author). I'd add it like you proposed. Since the whole method and functionality needs to be refactored before v1.

Can you create a subversion patch / diff and submit it at



- rene

Nov 29, 2010 at 3:13 PM

Generation of the Patch didnt seem to work, any pointers on how to do this? Used SVN for years never created a patch :-/

Nov 29, 2010 at 3:41 PM

I use TortoiseSVN, which makes this pretty easy.

  1. Check out the repository
  2. Make your changes in the file.
  3. Right click on the changed file and select Create Patch from the context menu.
  4. Upload it via the link on this page
Nov 29, 2010 at 3:53 PM

When I check the code out, all code is checked out as locked! Thats what is causing my issue I think.

Nov 29, 2010 at 4:37 PM

The MIME type of the patch was image and it was basically empty. Just upload the source file somewhere and I'll compare it here.

Nov 29, 2010 at 4:47 PM
Edited Nov 29, 2010 at 4:51 PM

See link below, also see screen shot for the locks that I am seeing. How can I get around this for future changes?

Link Here (



Nov 29, 2010 at 4:55 PM
Edited Nov 29, 2010 at 4:55 PM

This locking is a problem of CodePlex since it applies the wrong MIME type. I removed them all and commited, but CodePlex added those always as soon as I updated. Codeplex's SVN is only a bridge for TFS.

Just remove the read only flag in the file's properties.

Nov 29, 2010 at 5:02 PM
Edited Nov 29, 2010 at 5:03 PM

OK, it works. Checked in. See r64516 and the start page for credits.

Thanks for your contribution.

Nov 29, 2010 at 8:23 PM

Great, thanks!