Esempio n. 1
0
 protected virtual void drawView(string style)
 {
     GUI.Box(ViewRect, Title, ViewSkin.GetStyle(style));
     using (var area = new ClipArea(ViewRect))
     {
         if (OnDraw != null)
         {
             OnDraw(ViewRect, ViewSkin);
         }
     }
 }
Esempio n. 2
0
        public void ForceRefresh()
        {
            if (IsInitialized)
            {
                if (IsOnScreen)
                {
                    OnRefresh();
                }

                ClipArea.Update();
            }
        }
Esempio n. 3
0
    public static ClipArea create(double x, double y, eq.gui.vg.VgPath path, eq.gui.vg.VgTransform vt)
    {
        if (path == null)
        {
            return(null);
        }
        var v = new ClipArea();

        v.x  = x;
        v.y  = y;
        v.vp = path;
        v.vt = vt;
        return(v);
    }
Esempio n. 4
0
        public Component()
        {
            ClipArea = new ClipArea(this);

            _positionController = new PositionController(this);
            _sizeController     = new SizeController(this);
            _marginController   = new MarginController(this);
            _paddingController  = new PaddingController(this);
            _scrollController   = new ScrollController(this);

            _tPosObserver    = new Observer <Vector2i>(TargetPosition);
            _tRelPosObserver = new Observer <Vector2i>(TargetRelativePosition);
            _tSizObserver    = new Observer <Vector2i>(TargetSize);
            _tMarObserver    = new Observer <Spacing>(TargetMargins);
            _tPadObserver    = new Observer <Spacing>(TargetPaddings);
            _tScrObserver    = new Observer <Vector2i>(TargetScrollOffset);

            StyleManager     = new StyleManager(this);
            TransformChanged = true;
            StyleChanged     = true;
        }
Esempio n. 5
0
        public int beginSurface(int contextId, int x, int y, int width, int height, int type)
        {
            throw new NotImplementedException();

#if PENDING
            Render.Context context = getContext(contextId);
            ClipArea       clip    = new ClipArea();

            clip.parent           = context.clip;
            clip.x                = max(context.clip.x, x);
            clip.y                = max(context.clip.y, y);
            clip.width            = min(context.clip.x + context.clip.width, x + width) - clip.x;
            clip.height           = min(context.clip.y + context.clip.height, y + height) - clip.y;
            clip.type             = type;
            clip.texture          = 0;
            clip.offsetX          = clip.x;
            clip.offsetY          = clip.y;
            clip.linearColorSpace = clip.parent.linearColorSpace;

            if (clip.width < 1 || clip.height < 1)
            {
                delete clip;

                return(0);
            }

            context.clip = clip;
            context.setPrimitives(0);

            Texture oldTexture = textureCache.getTexture(clip.width, clip.height);
            int     w = 0, h = 0;

            if (oldTexture && !oldTexture.contentsLost() &&
                oldTexture.getWidth() >= clip.width &&
                oldTexture.getHeight() >= clip.height)
            {
                //ENTER(Java_scenic_jni_Renderer_beginSurface.1);
                clip.texture       = oldTexture;
                oldTexture         = 0;
                clip.textureWidth  = clip.texture.getWidth();
                clip.textureHeight = clip.texture.getHeight();
            }
            if (oldTexture)
            {
                w = oldTexture.getWidth();
                h = oldTexture.getHeight();
                oldTexture.release();
                oldTexture = 0;
            }
            if (!clip.texture)
            {
                //ENTER(Java_scenic_jni_Renderer_beginSurface.2);
                w = max(clip.width, w + 100);
                h = max(clip.height, h + 100);

                // Some graphics cards (GeForce 2 - 4) do not support small render targets
                if (w < 16)
                {
                    w = 16;
                }
                if (h < 16)
                {
                    h = 16;
                }

                Console.WriteLine("Create temporary surface (width=%d, height=%d)\n", w, h);
                clip.texture = new Texture(w, h, FMT_A8R8G8B8, USAGE_RENDER_TARGET);
                if (!clip.texture)
                {
                    Console.WriteLine("Device::createTexture failed\n");

                    return(0);
                }
                clip.textureWidth  = w;
                clip.textureHeight = h;
            }
            {
                //ENTER(Java_scenic_jni_Renderer_beginSurface.3);
                clip.surface = clip.texture.getSurface(0);
                context.setRenderTarget(clip.surface);
                RGBAFloat color;

                color.red = color.green = color.blue = color.alpha = 0.0;

                context.device.clear(color, NULL);
            }

            return(1);
#endif
            return(0);
        }
Esempio n. 6
0
        public int beginSurface(int contextId, int x, int y, int width, int height, int type)
        {
            throw new NotImplementedException();

            #if PENDING
                Render.Context context = getContext(contextId);
                ClipArea clip = new ClipArea();

                clip.parent = context.clip;
                clip.x = max(context.clip.x, x);
                clip.y = max(context.clip.y, y);
                clip.width = min(context.clip.x + context.clip.width, x + width) - clip.x;
                clip.height = min(context.clip.y + context.clip.height, y + height) - clip.y;
                clip.type = type;
                clip.texture = 0;
                clip.offsetX = clip.x;
                clip.offsetY = clip.y;
                clip.linearColorSpace = clip.parent.linearColorSpace;

                if (clip.width < 1 || clip.height < 1)
                {
                    delete clip;

                    return 0;
                }

                context.clip = clip;
                context.setPrimitives(0);

                Texture oldTexture = textureCache.getTexture(clip.width, clip.height);
                int w = 0, h = 0;

                if (oldTexture && !oldTexture.contentsLost() &&
                    oldTexture.getWidth() >= clip.width &&
                    oldTexture.getHeight() >= clip.height)
                {
                    //ENTER(Java_scenic_jni_Renderer_beginSurface.1);
                    clip.texture = oldTexture;
                    oldTexture = 0;
                    clip.textureWidth = clip.texture.getWidth();
                    clip.textureHeight = clip.texture.getHeight();
                }
                if (oldTexture)
                {
                    w = oldTexture.getWidth();
                    h = oldTexture.getHeight();
                    oldTexture.release();
                    oldTexture = 0;
                }
                if (!clip.texture)
                {
                    //ENTER(Java_scenic_jni_Renderer_beginSurface.2);
                    w = max(clip.width, w + 100);
                    h = max(clip.height, h + 100);

                    // Some graphics cards (GeForce 2 - 4) do not support small render targets
                    if (w < 16)
                        w = 16;
                    if (h < 16)
                        h = 16;

                    Console.WriteLine("Create temporary surface (width=%d, height=%d)\n", w, h);
                    clip.texture = new Texture(w, h, FMT_A8R8G8B8, USAGE_RENDER_TARGET);
                    if (!clip.texture)
                    {
                        Console.WriteLine("Device::createTexture failed\n");

                        return 0;
                    }
                    clip.textureWidth = w;
                    clip.textureHeight = h;
                }
                {
                    //ENTER(Java_scenic_jni_Renderer_beginSurface.3);
                    clip.surface = clip.texture.getSurface(0);
                    context.setRenderTarget(clip.surface);
                    RGBAFloat color;

                    color.red = color.green = color.blue = color.alpha = 0.0;

                    context.device.clear(color, NULL);
                }

                return 1;
            #endif
            return 0;
        }