czml writer create map pins?

Is it possible to provide the ability to do one of the following?

  1. czml writer has the ability to create a map pin similar to client side PinBuilder.
  2. provide a method to pass an Image to PinBuilder to build a pin.

I have a servlet generating czml and am embedding an image into the billboard graphics, but what i really want is a map pin constructed from this image. However, there is no capability to do so in the czml writer, and no ability to take that embedded image on the client and construct an image from it either. Obviously it would be preferable to just construct the map pin when generating the czml, but I am guessing the latter is probably simpler to implement?

This implementation appears to work although I would have expected the image to actually be drawn and not just a black and white copy. Is there a way to change that, I am trying to put mil std 2525 icons in a map pin, and the color of the image is important.

public final native CanvasElement fromImage(Image image, Color color, double size) /*-{
    var stringifyScratch = new Array(5);
    stringifyScratch[0] = undefined;
    stringifyScratch[1] = undefined;
    stringifyScratch[2] = undefined;
    stringifyScratch[3] = size;
    stringifyScratch[4] =;
    var id = JSON.stringify(stringifyScratch);

    var item = this.imageCache[id];
    if (defined(item)) {
        return item;

    var canvas = document.createElement('canvas');
    canvas.width = size;
    canvas.height = size;
    var context2D = canvas.getContext("2d");
    this.drawPin(context2D, color, size);
    this.drawIcon(canvas.getContext("2d"), image, size);
    this.imageCache[id] = canvas;
    return canvas;