Beispiel #1
0
String PackImlData(const Vector<Image>& image)
{
    StringBuffer block;
    for(int i = 0; i < image.GetCount(); i++) {
        const Image& img = image[i];
        StringStream ss;
        ss.Put(img.GetResolution() << 6);
        Size sz = img.GetSize();
        ss.Put16le(sz.cx);
        ss.Put16le(sz.cy);
        Point p = img.GetHotSpot();
        ss.Put16le(p.x);
        ss.Put16le(p.y);
        p = img.Get2ndSpot();
        ss.Put16le(p.x);
        ss.Put16le(p.y);
        block.Cat(ss.GetResult());
        const RGBA *s = img;
        const RGBA *e = s + img.GetLength();
        while(s < e) {
            block.Cat(s->r);
            block.Cat(s->g);
            block.Cat(s->b);
            block.Cat(s->a);
            s++;
        }
    }
    return ZCompress(block);
}