void Video_DX9::init_context() { // Enable Alpha Blitting m_d3d_device->SetRenderState(D3DRS_ALPHABLENDENABLE, true); m_d3d_device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); m_d3d_device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); m_d3d_device->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); // Configure Texture Stages m_d3d_device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE); m_d3d_device->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TEXTURE); m_d3d_device->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE); m_d3d_device->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE); // Set Lighting Variables m_d3d_device->SetRenderState(D3DRS_NORMALIZENORMALS, true); // Multisampling m_d3d_device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, DWORD(get_multisampling() > 1)); // More basic stuff set_2d(); set_Color(get_Color()); set_clear_Color(get_clear_Color()); set_backface_culling(get_backface_culling()); set_lighting(get_lighting()); set_ambient_lighting(get_ambient_lighting()); set_alpha_test(is_alpha_test_enabled(), get_alpha_test_function(), get_alpha_test_value()); set_zwrite(is_zwrite_enabled()); set_ztest(is_ztest_enabled()); }
STDMETHODIMP CGaugeOverlay::Render(LONG hdc) { long val = 0; IMeter *iMeter; get_meter(&iMeter); if (iMeter && SUCCEEDED(iMeter->GetAsLong(selector, &val))) { GraphicsPath path(FillModeAlternate); long max, min, length, thickness; get_Max(&max); get_Min(&min); get_Length(&length); get_Thickness(&thickness); long size = max - min; long offset = val - min; path.AddRectangle(RectF(0.0, 0.0, (float)length, (float)thickness)); REAL el[6]; CumulativeTransform(size, offset, el); Matrix matrix(el[0], el[1], el[2], el[3], el[4], el[5]); path.Transform(&matrix); Graphics graphics((HDC)hdc); graphics.SetInterpolationMode(InterpolationModeHighQuality); graphics.SetSmoothingMode(SmoothingModeAntiAlias); graphics.SetPixelOffsetMode(PixelOffsetModeHalf); long rgb; BYTE alpha; get_Color(&rgb); get_Alpha(&alpha); Color color; color.SetFromCOLORREF(rgb); rgb = color.GetValue() & 0x00FFFFFF; color.SetValue(rgb | ((long)alpha << 24)); SolidBrush fg(color); graphics.FillPath(&fg, &path); } return S_OK; }
// virtual __release<LDraw::Brush> SolidColorBrush::CreateBrush(UIElement* pReferencingElement, double scaleX, double scaleY) { int opacity = get_Opacity()*255; if (opacity < 0) opacity = 0; else if (opacity > 255) opacity = 255; Color color = get_Color(); // if (color != NULL) { LDraw::Color dcolor = LDraw::Color(color.get_A()*opacity/255, color.get_R(), color.get_G(), color.get_B()); return new LDraw::SolidBrush(dcolor); } /* else { return NULL; } */ }
STDMETHODIMP CLogoMarkerSymbol::get_Current(LPUNKNOWN pUnk, LPUNKNOWN *currentObject) { IColorPtr ipColor(pUnk); if (ipColor) { IColorPtr ipCurrentColor; get_Color(&ipCurrentColor); ipCurrentColor.QueryInterface(IID_IUnknown, (void**)currentObject); return S_OK; } ILogoMarkerSymbolPtr ipSymbol(pUnk); if (ipSymbol) { IClonePtr ipClone; Clone(&ipClone); ipClone.QueryInterface(IID_IUnknown, (void**)currentObject); return S_OK; } return E_FAIL; }