This is what I'm currently doing. I've tried many different variations of D3DBLEND. I can get the equivalent of the adding as shown above, but not subtracting.
// 2D box with colours per vertex.
void GradientBox(int x1, int y1, int x2, int y2, DWORD dwColourA, DWORD dwColourB, DWORD dwColourC, DWORD dwColourD)
{
TransformedVertex *pVertices = NULL;
g_pTS_Box[0].x = (float)x1;
g_pTS_Box[0].y = (float)y1;
g_pTS_Box[0].color = dwColourA;
g_pTS_Box[1].x = (float)x2;
g_pTS_Box[1].y = (float)y1;
g_pTS_Box[1].color = dwColourB;
g_pTS_Box[2].x = (float)x1;
g_pTS_Box[2].y = (float)y2;
g_pTS_Box[2].color = dwColourC;
g_pTS_Box[3].x = (float)x2;
g_pTS_Box[3].y = (float)y2;
g_pTS_Box[3].color = dwColourD;
g_pD3DDevice->SetViewport(&g_p2DViewPort);
g_pD3DDevice->SetTexture(0, NULL);
g_pD3DDevice->SetTexture(1, NULL);
g_pD3DDevice->SetVertexShader(NULL);
g_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
g_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
g_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
g_pD3DDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
g_pVB_Box->Lock(0, sizeof(g_pTS_Box), (void**)&pVertices, D3DLOCK_DISCARD);
memcpy(pVertices, g_pTS_Box, sizeof(g_pTS_Box));
g_pVB_Box->Unlock();
g_pD3DDevice->SetStreamSource(0, g_pVB_Box, 0, sizeof(TransformedVertex));
g_pD3DDevice->SetFVF(D3DFVF_2D_VERTEX);
g_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
}
Let me know what you find.
D3DFunc - Superfast Antialiased text & much much more