public GetVideoWindows ( |
||
rSource | ||
rDest | ||
return | void |
private void HandleMouseMessages() { if (!GUIGraphicsContext.IsFullScreenVideo) { return; } //if (GUIGraphicsContext.Vmr9Active) return; try { Point pt; foreach (Message m in _mouseMsg) { long lParam = m.LParam.ToInt32(); double x = (double)(lParam & 0xffff); double y = (double)(lParam >> 16); double arx, ary; Rectangle src, dst; // Transform back to original window position / aspect ratio // in order to know the intended position _vmr9.GetVideoWindows(out src, out dst); x -= dst.X; y -= dst.Y; arx = (double)dst.Width / (double)src.Width; ary = (double)dst.Height / (double)src.Height; x /= arx; y /= ary; pt = new Point((int)x, (int)y); if (m.Msg == WM_MOUSEMOVE) { // Select the button at the current position, if it exists _dvdCtrl.SelectAtPosition(pt); } if (m.Msg == WM_LBUTTONUP) { // Highlight the button at the current position, if it exists _dvdCtrl.ActivateAtPosition(pt); } } } catch (Exception ex) { Log.Error("DVDPlayer9:HandleMouseMessages() {0} {1} {2}", ex.Message, ex.Source, ex.StackTrace); } _mouseMsg.Clear(); }
public bool SaveBitmap(Bitmap bitmap, bool show, bool transparent, float alphaValue) { if (!_isVmr9Initialized) { return(false); } if (_vmr9Filter == null) { return(false); } if (MixerBitmapInterface == null) { return(false); } if (GUIGraphicsContext.Vmr9Active == false) { Log.Info("SaveVMR9Bitmap() failed - no VMR9"); return(false); } int hr = 0; // transparent image? using (MemoryStream mStr = new MemoryStream()) { if (bitmap != null) { if (transparent == true) { bitmap.MakeTransparent(Color.Black); } bitmap.Save(mStr, ImageFormat.Bmp); mStr.Position = 0; } VMR9AlphaBitmap bmp = new VMR9AlphaBitmap(); if (show == true) { // get AR for the bitmap Rectangle src, dest; g_vmr9.GetVideoWindows(out src, out dest); int width = g_vmr9.VideoWidth; int height = g_vmr9.VideoHeight; float xx = (float)src.X / width; float yy = (float)src.Y / height; float fx = (float)(src.X + src.Width) / width; float fy = (float)(src.Y + src.Height) / height; // using ( Surface surface = GUIGraphicsContext.DX9Device.CreateOffscreenPlainSurface(GUIGraphicsContext.Width, GUIGraphicsContext.Height, Format.X8R8G8B8, Pool.SystemMemory)) { SurfaceLoader.FromStream(surface, mStr, Filter.None, 0); bmp.dwFlags = (VMR9AlphaBitmapFlags)(4 | 8); bmp.clrSrcKey = 0; unsafe { bmp.pDDS = (IntPtr)surface.UnmanagedComPointer; } bmp.rDest = new NormalizedRect(); bmp.rDest.top = yy; bmp.rDest.left = xx; bmp.rDest.bottom = fy; bmp.rDest.right = fx; bmp.fAlpha = alphaValue; //Log.Info("SaveVMR9Bitmap() called"); hr = g_vmr9.MixerBitmapInterface.SetAlphaBitmap(ref bmp); if (hr != 0) { //Log.Info("SaveVMR9Bitmap() failed: error {0:X} on SetAlphaBitmap()",hr); return(false); } } } else { bmp.dwFlags = (VMR9AlphaBitmapFlags)1; bmp.clrSrcKey = 0; bmp.rDest = new NormalizedRect(); bmp.rDest.top = 0.0f; bmp.rDest.left = 0.0f; bmp.rDest.bottom = 1.0f; bmp.rDest.right = 1.0f; bmp.fAlpha = alphaValue; hr = g_vmr9.MixerBitmapInterface.UpdateAlphaBitmapParameters(ref bmp); if (hr != 0) { return(false); } } } // dispose return(true); }