Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image processing 使用directx绘制行进蚂蚁_Image Processing_Graphics_Directx - Fatal编程技术网

Image processing 使用directx绘制行进蚂蚁

Image processing 使用directx绘制行进蚂蚁,image-processing,graphics,directx,Image Processing,Graphics,Directx,我必须在directx应用程序中绘制选择反馈,如Photoshop。我在维基百科上找到了一个这样做的网站。但是,我不确定这样做是否正确,特别是如果我的选择区域可以是任意几何体。有人使用Directx实现了它吗?非常感谢您的任何提示。根据我的评论,这里有一个简单的像素着色器,可以实现想要的结果: float4 PS( float4 pos : SV_POSITION) : SV_Target { float w = ((int)(pos.x + pos.y + t) % 8); r

我必须在directx应用程序中绘制选择反馈,如Photoshop。我在维基百科上找到了一个这样做的网站。但是,我不确定这样做是否正确,特别是如果我的选择区域可以是任意几何体。有人使用Directx实现了它吗?非常感谢您的任何提示。

根据我的评论,这里有一个简单的像素着色器,可以实现想要的结果:

float4 PS( float4 pos : SV_POSITION) : SV_Target
{
    float w = ((int)(pos.x + pos.y + t) % 8);
    return (w < 4 ? float4(0,0,0,1) : float4(1,1,1,1));
}

您可以只计算像素着色器中的图案,并将边界绘制为线条条。只需将偏移参数
t
传递给着色器并使用像素的屏幕坐标即可
t
会不时增加边框的动画效果。谢谢,但是位图蒙版(不仅仅是矩形和贝塞尔)怎么做呢?你能解释一下吗?只要找到遮罩的轮廓,用上面的像素着色器把它画成一条线条。或者你的意思不同?你能解释一下这个着色器吗?为什么你把x和y加在一起,然后用4做和?
float4 PS( float4 pos : SV_POSITION) : SV_Target
{
    int w = ((int)(pos.x + pos.y + t) & 4);
    return float4(w,w,w,1);
}