public static GDIGraphic Create(int width, int height, HandleRef handle)
    {
        float size_unit = height * 0.08F;

        GDIGraphic graphic = new GDIGraphic();

        graphic.width  = width;
        graphic.height = height;
        graphic.info   = GDIHelper.CreateBitmapinfo(width, height);
        graphic.handle = handle;

        graphic.frame = new int[width * height];
        graphic.depth = new int[width * height];

        graphic.worldViewMatrix = new Matrix3x3(
            size_unit, 0, width / 2,
            0, size_unit, height / 2,
            0, 0, 1);

        graphic.screenViewMatrix = new Matrix3x3(
            width, 0, width / 2,
            0, height, height / 2,
            0, 0, 1);

        init(ref graphic.frame[0], ref graphic.depth[0], width, height);

        return(graphic);
    }
Exemple #2
0
        public void InitGDI(int Width, int Height)
        {
            try
            {
                var graphics = CreateGraphics();

                width  = Width;
                height = Height;

                info   = GDIHelper.CreateBitmapinfo(width, height);
                handle = new HandleRef(graphics, graphics.GetHdc());

                isInitialized = true;
            }
            catch (Exception e)
            {
            }
        }