EmitHeader() private method

private EmitHeader ( int offset, int width, int height ) : int
offset int
width int
height int
return int
Esempio n. 1
0
    public static int generateGradient(int heapOffset)
    {
        const int width         = 8;
        const int height        = 8;
        const int xScale        = 256 / width;
        const int yScale        = 256 / height;
        const int bytesPerPixel = Targa.BPP / 8;

        heapOffset = Targa.EmitHeader(heapOffset, width, height);

        for (int y = 0; y < height; y++)
        {
            int rowOffset = heapOffset + ((width * bytesPerPixel) * y);

            for (int x = 0; x < width; x++)
            {
                int pixelOffset = rowOffset + (x * bytesPerPixel);

                U8[pixelOffset, 0] = (byte)(y * yScale);
                U8[pixelOffset, 1] = 0;
                U8[pixelOffset, 2] = (byte)(x * xScale);
            }
        }

        const int length = (width * height * bytesPerPixel);

        SetStdout("gradient.tga");
        Write(heapOffset, length);

        return(heapOffset + length);
    }
Esempio n. 2
0
    public static int test()
    {
        var offset = Targa.EmitHeader(0, width, height);

        byte *dest = &U8.Base[offset];
        byte *src  = &dest[numBytes];

        rasterize(blend50, src, dest);

        SetStdout("blendfunc.tga");
        Write(offset, numBytes);

        return(offset + numBytes);
    }