WriteableBitmapEx from codeplex

The WriteableBitmapEx library is a collection of extension methods for Silverlight’s WriteableBitmap. The WriteableBitmap class that was added in Silverlight 3, allows the direct manipulation of a bitmap and could be used to generate fast procedural images by drawing directly to a bitmap. The WriteableBitmap API is very minimalistic and there’s only the raw Pixels array for such operations. The WriteableBitmapEx library tries to compensate that with extensions methods that are easy to use like built in methods. The library extends the WriteableBitmap class with elementary and fast (2D drawing) functionality, conversion methods and functions to combine (blit) WriteableBitmaps.
The extension methods are grouped into different CS files with a partial class. It is possible to include just a few methods by using the specific source CS files directly or all extension methods through the built library assembly.
wbx_announcement.png

Features

  • Base
    • Support for the Color structure
    • SetPixel method with various overloads
    • Fast Clear methods
    • ForEach method to apply a given function to all pixels of the bitmap
  • Shapes
    • Fast line drawing algorithms
    • Ellipse, polyline, quad, rectangle and triangle
  • Blitting
    • Different blend modes including alpha, additive, subtractive, multiply, mask and none
    • Optimized fast path for non blended blitting
  • Conversion
    • Convert a WriteableBitmap to a byte array
    • Create a WriteableBitmap from a byte array

Sample Code

// Initialize the WriteableBitmap with size 512x512 and set it as source of an Image control
WriteableBitmap writeableBmp = new WriteableBitmap(512, 512);
ImageControl.Source = writeableBmp;

// Clear the WriteableBitmap with white color
writeableBmp.Clear(Colors.White);

// Green line from P1(1, 2) to P2(30, 40)
writeableBmp.DrawLine(1, 2, 30, 40, Colors.Green);

// Black triangle with the points P1(10, 5), P2(20, 40) and P3(30, 10)
writeableBmp.DrawTriangle(10, 5, 20, 40, 30, 10, Colors.Black);

// Red rectangle from the point P1(2, 4) that is 10px wide and 6px high
writeableBmp.DrawRectangle(2, 4, 12, 10, Colors.Red);

// Blue ellipse with the center point P1(2, 2) that is 8px wide and 5px high
writeableBmp.DrawEllipseCentered(2, 2, 8, 5, Colors.Blue);

// Closed green polyline with P1(10, 5), P2(20, 40), P3(30, 30) and P4(7, 8)
int[] p = new int[] { 10, 5, 20, 40, 30, 30, 7, 8, 10, 5 };
writeableBmp.DrawPolyline(p, Colors.Green);

// Present the WriteableBitmap!
writeableBmp.Invalidate();

For more visit: http://writeablebitmapex.codeplex.com/

Teach your kids games programing using Kodu

What is Kodu?

Kodu is a visual programming language made specifically for creating games. It is designed to be accessible for children and enjoyable for anyone. Kodu provides an end-to-end creative environment for designing, building, and playing your own new games.

Programming as a Creative Medium

The core of the Kodu project is the programming user interface. The language is simple and entirely

icon-based. Programs are composed of pages, which are broken down into rules, which are further divided into conditions and actions. Conditions are evaluated simultaneously.

The Kodu language is designed specifically for game development and provides specialized primitives derived from gaming scenarios. Programs are expressed in physical terms, using concepts like vision, hearing, and time to control character behavior. While not as general-purpose as classical programming languages, Kodu can express advanced game design concepts in a simple, direct, and intuitive manner.

Screen
The Game Load / Community Screen.

Screen
Yes, we have a turtle.

Screen
"Physical" sensors are used as rule input.

Screen
Stick can’t walk but he packs a wallop.

Download Kodu for PC Technical Preview Now

The programming environment also runs on the Xbox, allowing rapid design iteration using only a game controller for input. Kodu Game Lab can be found in the Xbox Marketplace in the Indie Games channel.

Click here to find out more

Silverlight Client for Facebook available – But where is the source code?

Remember the final moments of the Scott Guthrie keynote presentation at PDC09?  Where Brian Goldfarb came on stage and demonstrated a completed application using a lot of the features of Silverlight 4?  Yeah, that Facebook application.  Well, it’s here now!

Microsoft 
Silverlight 4 Beta Client for Facebook

Silverlight Client for Facebook - Home view

You can install it from here. But wait … I have a bad news for you, they are not providing the source and code and worst of all they obfuscated the application so you can’t even use Reflector to look inside!  :<

31 Days of Silverlight Series by Jeff Blankenburg

Day #1: Mouse Events in Silverlight
Day #2: Silverlight Screen Transitions
Day #3: Custom Silverlight Loading Screen
Day #4: Communicating Between Two Silverlight Controls
Day #5: Silverlight Drag and Drop
Day #6: Silverlight and the Twitter “Hello, World!”
Day #7: Using WCF Web Services With Silverlight (and LINQ)
Day #8: Custom Fonts in Silverlight
Day #9: Using Keystrokes in Silverlight
Day #10: Styling Silverlight Control
Day #11: Animating Your Silverlight Application
Day #12: Jumping From XAML to XAML in Silverlight
Day #13: Binding Elements In Silverlight 3
Day #14: Perspective 3D in Silverlight
Day #15: Silverlight Charting
Day #16: Silverlight AutoComplete Textbox
Day #17: Silverlight Layout Options
Day #18: Silverlight Effects
Day #19: Silverlight Pixel Shader Effects
Day #20: Adding Audio to Silverlight Events
Day #21: Rapid Silverlight Prototyping In SketchFlow
Day #22: Using The Farseer Physics Engine in Silverlight
Day #23: Silverlight Outside The Browser (Part 1 of 3)
Day #24: Silverlight Outside The Browser (Part 2 of 3)
Day #25: Silverlight Outside The Browser (Part 3 of 3)
Day #26: Silverlight Data Grid
Day #27: Templating Controls In Silverlight
Day #28: Silverlight Application Themesa
Day #29: Using Isolated Storage in Silverlight
Day #30: Bing Maps in Silverlight
Day #31: Geocoding and More Fun in Bing Maps for Silverlight