示例#1
0
        private void uploadBitmapToOpenGl()
        {
            _texture = createTexture();
            IBitmap bitmap = _bitmapPool.Acquire(_draw.BitmapWidth, _draw.BitmapHeight);

            try
            {
                IBitmapTextDraw textDraw = bitmap.GetTextDraw();
                using (var context = textDraw.CreateContext())
                {
                    textDraw.DrawText(_draw.Text, _draw.Config, _draw.TextSize, _draw.BaseSize, _draw.MaxWidth, (int)_draw.HeightF, 0f);
                    drawCaret(_draw.OriginalText, _draw.TextSize, _draw.HeightF, _draw.BaseSize, textDraw, _draw.Config, _draw.MaxWidth);
                }
                // Upload the Bitmap to OpenGL.
                // Do this only when text changes.
                bitmap.LoadTexture(_texture);
            }
            catch (InvalidOperationException e)
            {
                Debug.WriteLine(e.ToString());
                throw;
            }
            finally
            {
                releaseBitmap(bitmap);
            }
        }
示例#2
0
        private IImage loadImage(ITexture texture, IBitmap bitmap, string id, ILoadImageConfig config, ISpriteSheet spriteSheet)
        {
            manipulateImage(bitmap, config);
            bitmap.LoadTexture(null);
            GLImage image = new GLImage(bitmap, id, texture, spriteSheet, config);

            string imageId = image.ID;

            _textures?.GetOrAdd(imageId, () => image.Texture);
            image.OnImageDisposed.Subscribe(() => _textures.Remove(imageId));
            return(image);
        }
示例#3
0
        private IImage loadImage(ITexture texture, IBitmap bitmap, string id, ILoadImageConfig config, ISpriteSheet spriteSheet)
        {
            manipulateImage(bitmap, config);
            bitmap.LoadTexture(null);
            GLImage image = new GLImage(bitmap, id, texture, spriteSheet, config);

            if (_textures != null)
            {
                _textures.GetOrAdd(image.ID, () => image.Texture);
            }
            return(image);
        }
示例#4
0
 private void uploadBitmapToOpenGl()
 {
     try
     {
         // Upload the Bitmap to OpenGL.
         // Do this only when text changes.
         _bitmap.LoadTexture(_texture);
     }
     catch (InvalidOperationException e)
     {
         Debug.WriteLine(e.ToString());
         throw;
     }
 }
示例#5
0
        private IImage loadImage(ITexture texture, IBitmap bitmap, string id, ILoadImageConfig config, ISpriteSheet spriteSheet)
		{
			manipulateImage(bitmap, config);
			bitmap.LoadTexture(null);
			GLImage image = new GLImage (bitmap, id, texture, spriteSheet, config);

			if (_textures != null)
                _textures.GetOrAdd (image.ID, () => image.Texture);
			return image;
		}