コード例 #1
0
        /// <summary>
        /// Gets pixel color of a specified texture, returning default if otherwise failed. Slow.
        /// </summary>
        /// <param name="texture">Texture.</param>
        /// <param name="x">X.</param>
        /// <param name="y">Y.</param>
        /// <param name="defaultColor">Color to return on failure.</param>
        /// <returns>Pixel color.</returns>
        public override Color PixelColor(Texture texture, uint x, uint y, Color defaultColor)
        {
            Texture2D tex = texture.RendererData as Texture2D;

            if (tex != null)
            {
                if (PrivateRendererContext.Application.ManagedThreadId == System.Threading.Thread.CurrentThread.ManagedThreadId)
                {
                    FreezingArcher.Math.Color4 col = tex.GetPixelColor((int)x, (int)y);

                    return Color.FromArgb((int)(col.A), (int)(col.R), (int)(col.G), (int)(col.B));
                }
                else
                {

                    RendererCore.RCActionGetPixelColor getpix = new RendererCore.RCActionGetPixelColor(tex, (int)x, (int)y);

                    PrivateRendererContext.AddRCActionJob(getpix);

                    while (!getpix.OutputReady);

                    FreezingArcher.Math.Color4 col = getpix.OutputColor;

                    return Color.FromArgb((int)(col.A), (int)(col.R), (int)(col.G), (int)(col.B));
                }
            }

            return defaultColor;
        }
コード例 #2
0
ファイル: FrameBuffer.cs プロジェクト: AreonDev/NoWayOut
 public TextureAttachment(Texture t, AttachmentUsage a)
 {
     tex = t;
     au = a;
 }
コード例 #3
0
 public override Color PixelColor(Texture texture, uint x, uint y)
 {
     return PixelColor(texture, x, y, Color.Yellow);
 }