English 中文(简体)
是否有使白人难以理解的甲型价值?
原标题:Is there an alpha value that makes white go invisible?

如果我使用以下文字:

for(int i = 255; i > 0; i--)
{
    Color transparentBlack = new Color(0, 0, 0, i);
}

我使用这种颜色来从黑色到轻灰色,然后当甲型数值达到零时看不见。 然而,如果我开始怀着白色的价值:

new Color(255, 255, 255, i);

这些物体永远不会被看不到,只能停留在白色。 我也注意到,如果我使用比黑色(50、50、50)光线的数值,则从达尔文到看不见的白色。

我假定,我不理解甲型混杂工程如何,但是否有办法使白色颜色变得容易渗透?

Edit:我引用的背景是科罗拉·CornflowerBlue(100,149,237,255)。

Edit: Sample XNA Program reproduction the interpret. 供使用;创建新的XNA游戏室4.0项目——Windows 游戏(4.0),称为AlphaBlend 测试和测验; 在内容项目中增加新的标准,称之为测试。

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace AlphaBlendTest
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;


    SpriteFont font;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
    }

    /// <summary>
    /// Allows the game to perform any initialization it needs to before starting to run.
    /// This is where it can query for any required services and load any non-graphic
    /// related content.  Calling base.Initialize will enumerate through any components
    /// and initialize them as well.
    /// </summary>
    protected override void Initialize()
    {
        // TODO: Add your initialization logic here

        base.Initialize();
    }

    /// <summary>
    /// LoadContent will be called once per game and is the place to load
    /// all of your content.
    /// </summary>
    protected override void LoadContent()
    {
        // Create a new SpriteBatch, which can be used to draw textures.
        spriteBatch = new SpriteBatch(GraphicsDevice);

        font = Content.Load<SpriteFont>("testfont");
    }

    /// <summary>
    /// UnloadContent will be called once per game and is the place to unload
    /// all content.
    /// </summary>
    protected override void UnloadContent()
    {
        // TODO: Unload any non ContentManager content here
    }

    /// <summary>
    /// Allows the game to run logic such as updating the world,
    /// checking for collisions, gathering input, and playing audio.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.</param>
    protected override void Update(GameTime gameTime)
    {
        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

        // TODO: Add your update logic here

        base.Update(gameTime);
    }

    /// <summary>
    /// This is called when the game should draw itself.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.</param>
    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
        spriteBatch.Begin();

        //spriteBatch.Draw(tR, new Rectangle(100, 100, 100, 100), Color.Red);

        Vector2 v2 = new Vector2(0, 0);
        spriteBatch.DrawString(font, "Test - White", v2, Color.White);

        v2.Y = v2.Y + 50;

        spriteBatch.DrawString(font, "Test - Black", v2, Color.Black);

        v2.Y = v2.Y + 50;

        Color BlackTransparent = new Color(0, 0, 0, 0);
        spriteBatch.DrawString(font, "Test - Black Transparent", v2, BlackTransparent);

        v2.Y = v2.Y + 50;
        Color WhiteTransparent = new Color(255, 255, 255, 0);
        spriteBatch.DrawString(font, "Test - White Transparent", v2, WhiteTransparent);

        spriteBatch.End();

        base.Draw(gameTime);
    }
}
}

Edit: This is the image this code draws: alt text

Edit: One of the comments is concerned that this is a Text only related feature of windows. I used text as an example to keep the demo program small; testing with an image gives the same result. alt text

在脱盲方案中添加方括号;制作白白民族党形象,并在内容目录中添加(使用内容管道的缺省值)。 之后加进这一类:

Texture2D tWhiteBox;

在装载方法中添加:

tWhiteBox = Content.Load<Texture2D>("whitebox");

之后在引文中添加以下案文:

v2.Y = v2.Y + 50;
spriteBatch.Draw(tWhiteBox, v2, WhiteTransparent);
最佳回答

灰色是你在XNA 4.0(如果你试图在不调整RGB频道的情况下调整alpha频道,则完全是白人)。 采用多面字母的甲型六氯环己烷(缺省)。 如果你重新研究原先的不孕前XNA3.1行为,请参看Shawn Hargreaves的这个职位:rel=“noreferer”http://blogs.msdn.com/b/shawnhar/archive/04/08/multiplied-al-in-pha-x-x-MO-studio-40.aspx。 在员额的底层,它告诉你如何这样做。

d 我建议阅读他在多字母顺序上的所有职位,然后才能这样做(你可以使用“博客指数”在他网页顶端左侧链接),而预言实际上更好,而且更加符合逻辑。

问题回答

这是历史限制,至少在Windows。 GDI的原始价值,如TextEx,不支持透明度。 他们只会忽视甲型频道。 这一限制通过诸如GDI+和Mil分等图形图书馆解决。 但是,只有一名真菌病理学家,做的工作过于温和,难以替代。 你的屏幕显示,这种限制在经常窗户内,因此很可能适用。 不清楚这在青少年中是否有所不同。

可能的工作是使用类似于制图的功能。 加入。 然而,你将失去打击贩毒活动的效果。 不能确保XNA中的事项。 我也非常了解这一点,无法提出相等的图表。

我认为,它与SpriteBatch的沥青混合环境有关。

违约是BlendState。 AplhaBlend。 这套方案有:背景研究*(1-Alpha)+地面协作。 这将解释黑人和白人的不同行为。

B. 使用不同的rite Batch。 Beginmeth with BlendState. 尚未取得预期结果。 这将导致:背景研究*(1-Alpha)+陆地 Color*Aplha, 甚至使白人完全透明。

如果黑色在半透明时成为“灰色”,那就意味着你会发现一个白人背景......当时,把一个完全透明的白色颜色 top上。

用你的白色物体进行不同的彩色背景――红色,可以说,这种背景应当从白色(alpha=255)到ink(alpha=127)到单纯红色(alpha=0)。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签