public ImageFrameDepthPointFilter(IntSize size, int minimumDepthThreshold, int maximumDepthThreshold, int lowerBorder) { this.size = size; this.minimumDepthThreshold = minimumDepthThreshold; this.maximumDepthThreshold = maximumDepthThreshold; this.lowerBorder = lowerBorder; }
internal UniformInfo(string name, UniformType type, IntSize dimensions, int arraySize) { Name = name; Type = type; Dimensions = dimensions; ArraySize = arraySize; }
public HandDataSource(IShapeDataSource shapeDataSource, HandDataSourceSettings settings) : base(shapeDataSource) { this.factory = new ShapeHandDataFactory(settings); this.size = shapeDataSource.Size; this.CurrentValue = new HandCollection(); }
public KMeansClusterFactory(ClusterDataSourceSettings settings, IClusterMergeStrategy mergeStrategy, IntSize size) { this.settings = settings; this.mergeStrategy = mergeStrategy; this.algorithm = new KMeans(this.settings.ClusterCount, settings.DepthRange, size); this.value = new ClusterCollection(); }
public Int32Rect GetCrop(IntSize original) { IntSize scale = GetScale(original); Int32Rect crop = ReferencePosition.GetCrop(scale, GetShow(original), wannaOffset); return(GetImprovedCrop(crop, scale)); }
public Int32Rect GetCrop(IntSize scale, IntSize show, IntPoint relativeOffset) { int x = relativeOffset.X + Convert.ToInt32((scale.Width - show.Width) / 2.0); int y = relativeOffset.Y + Convert.ToInt32((scale.Height - show.Height) / 2.0); int width = show.Width; int height = show.Height; if (x + width > scale.Width) { x = scale.Width - width; } if (x < 0) { x = 0; } if (y + height > scale.Height) { y = scale.Height - height; } if (y < 0) { y = 0; } return(new Int32Rect(x, y, width, height)); }
public static void Main() { var canvasSize = new IntSize(400, 800); var div = new HTMLDivElement(); div.style.width = $"{canvasSize.Width}px"; div.style.height = $"{canvasSize.Height}px"; document.body.appendChild(div); var button = new HTMLButtonElement(); button.innerHTML = "Click on game area to start it!"; button.style.width = "100%"; button.style.height = "100%"; button.style.backgroundColor = "#6495ED"; button.style.color = "#ffffff"; button.style.fontSize = "20px"; div.appendChild(button); button.onclick = (ev) => { div.removeChild(button); var canvas = new HTMLCanvasElement(); canvas.style.width = "100%"; canvas.style.height = "100%"; canvas.id = "monogamecanvas"; div.appendChild(canvas); game = new TheGame(canvasSize, Platform.Desktop); game.Run(); }; }
private Int32Rect GetImprovedCrop(Int32Rect crop, IntSize scale) { if (ModeType == EditMode.EditModeType.ScaleHeight || ModeType == EditMode.EditModeType.ScaleWidth) { return(crop); } if (crop.X + crop.Width > scale.Width) { crop.X = scale.Width - crop.Width; } else if (crop.X < 0) { crop.X = 0; } if (crop.Y + crop.Height > scale.Height) { crop.Y = scale.Height - crop.Height; } else if (crop.Y < 0) { crop.Y = 0; } return(crop); }
public BitmapDataSource(IImagePointerDataSource dataSource, IBitmapFactory imageFactory) : base(dataSource) { this.CurrentValue = new Bitmap(dataSource.Width, dataSource.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); this.size = new IntSize(this.CurrentValue.Width, this.CurrentValue.Height); this.imageFactory = imageFactory; }
public ClusterShapeDataSource(IClusterDataSource clusterDataSource, ShapeDataSourceSettings settings) : base(clusterDataSource) { this.factory = new ClusterShapeFactory(settings); this.size = clusterDataSource.Size; this.CurrentValue = new ShapeCollection(); }
public HeirloomSurfaceView(Activity context, IntSize resolution, MultisampleQuality multisample = MultisampleQuality.None) : base(context) { // Holder.AddCallback(this); Holder.SetFixedSize(resolution.Width, resolution.Height); Holder.SetFormat(Format.Rgb888); Console.WriteLine($"[EGL] Creating OpenGL ES 3.0 Context"); // Find best configuration for 24 bit color no depth var config = Egl.ChooseConfig(new EglConfigAttributes { RedBits = 8, GreenBits = 8, BlueBits = 8, AlphaBits = 0, DepthBits = 0, StencilBits = 0, Samples = 0 }); // Create OpenGL ES 3.0 Context & Surface EglContext = Egl.CreateContext(config); // Create render context, and set to initial size _renderContext = new AndroidRenderContext(this, multisample); _renderContext.SetDefaultSurfaceSize(resolution); }
public static void Test() { Window window = Gui.Instance.CreateWidget <Window>("WindowCSX", new IntCoord(620, 620, 100, 100), Align.Default, "Popup"); window.Caption = "WindowCSX"; window.EventWindowChangeCoord += new Window.HandleWindowChangeCoord(window_EventWindowChangeCoord); window.EventWindowButtonPressed += new Window.HandleWindowButtonPressed(window_EventWindowButtonPressed); window.Snap = !window.Snap; window.SetMaxSize(1000, 1000); window.SetMinSize(80, 80); IntSize size = window.MaxSize; window.MaxSize = new IntSize(1001, 1001); size = window.MinSize; window.MinSize = new IntSize(82, 82); window.AutoAlpha = !window.AutoAlpha; window.Visible = false; window.SetVisibleSmooth(true); }
public OpenNIClusterDataSource(IDepthPointerDataSource dataSource, IClusterFactory clusterFactory, IDepthPointFilter <IntPtr> filter) : base(dataSource) { this.size = dataSource.Size; this.CurrentValue = new ClusterCollection(); this.clusterFactory = clusterFactory; this.filter = filter; }
public ImageDataSource(IImagePointerDataSource dataSource, IImageFactory imageFactory) : base(dataSource) { this.writeableBitmap = new WriteableBitmap(dataSource.Width, dataSource.Height, 96, 96, PixelFormats.Bgr24, null); this.CurrentValue = writeableBitmap; this.size = new IntSize(dataSource.Width, dataSource.Height); this.imageFactory = imageFactory; }
public IClusterDataSource CreateClusterDataSource(ClusterDataSourceSettings clusterDataSourceSettings) { var size = new IntSize(this.Adapter.DepthStreamWidth, this.Adapter.DepthStreamHeight); var clusterFactory = new KMeansClusterFactory(clusterDataSourceSettings, size); var filter = new ImageFrameDepthPointFilter(this.Adapter, size, clusterDataSourceSettings.MinimumDepthThreshold, clusterDataSourceSettings.MaximumDepthThreshold, clusterDataSourceSettings.LowerBorder); return(new SDKClusterDataSource(this.Adapter, clusterFactory, filter)); }
private Surface GetSurface(IntSize screenSize, EffectLayer layer) { var surface = SurfacePool.Request(screenSize / layer.Downscale, Multisample); surface.Interpolation = InterpolationMode.Linear; surface.Repeat = RepeatMode.Clamp; return(surface); }
public IntPoint GetOffsetPoint(Int32Rect crop, IntSize scale, IntSize show) { int x, y; x = crop.X - Convert.ToInt32((scale.Width - show.Width) / 2.0); y = scale.Height - (crop.Y + crop.Height); return(new IntPoint(x, y)); }
public IntPoint GetOffsetPoint(Int32Rect crop, IntSize scale, IntSize show) { int x, y; x = crop.X; y = scale.Height - (crop.Y + crop.Height); return(new IntPoint(x, y)); }
public IntPoint GetOffsetPoint(Int32Rect crop, IntSize scale, IntSize show) { int x, y; x = crop.X; y = crop.Y; return(new IntPoint(x, y)); }
public IntSize GetScaleSize(IntSize wanna, IntSize original) { double wannaRatio = wanna.Width / (double)wanna.Height; double originalRatio = original.Width / (double)original.Height; IEditMode mode = wannaRatio > originalRatio ? (IEditMode) new EditModeWidth() : new EditModeHeight(); return(mode.GetScaleSize(wanna, original)); }
public IntSize GetScaleSize(IntSize wanna, IntSize original) { if (original.Width == 0) { return(new IntSize(wanna.Width, 0)); } return(new IntSize(wanna.Width, original.Height * wanna.Width / original.Width)); }
public void Test_ToString() { var size = new IntSize(10, 12); var sizeText = size.ToString(); Assert.IsTrue(sizeText.Contains("10")); Assert.IsTrue(sizeText.Contains("12")); }
public IntPoint GetOffsetPoint(Int32Rect crop, IntSize scale, IntSize show) { int x, y; x = crop.X; y = crop.Y - Convert.ToInt32((scale.Height - show.Height) / 2.0); return(new IntPoint(x, y)); }
public IntSize GetScaleSize(IntSize wanna, IntSize original) { if (original.Height == 0) { return(new IntSize(0, wanna.Height)); } return(new IntSize(original.Width * wanna.Height / original.Height, wanna.Height)); }
public IntPoint GetOffsetPoint(Int32Rect crop, IntSize scale, IntSize show) { int x, y; x = scale.Width - (crop.X + crop.Width); y = crop.Y; return(new IntPoint(x, y)); }
public EditPictureProperties(bool flipX, bool flipY, IntSize wanna, IntPoint relativeOffset, EditMode.EditModeType modeType, EditReferencePositionType referencePositionType) { FlipX = flipX; FlipY = flipY; Wanna = wanna; ModeType = modeType; wannaOffset = relativeOffset; ReferencePositionType = referencePositionType; }
public PointerVolumePointFilter(IntSize size, int leftBorder, int rightBorder, int topBorder, int lowerBorder, int minDepth, int maxDepth) { this.size = size; this.leftBorder = leftBorder; this.rightBorder = rightBorder; this.topBorder = topBorder; this.lowerBorder = lowerBorder; this.minDepth = minDepth; this.maxDepth = maxDepth; }
public HandDataFactory(IntSize size, ClusterDataSourceSettings clusteringSettings, ShapeDataSourceSettings shapeSettings, HandDataSourceSettings handSettings) { this.clusteringSettings = clusteringSettings; this.shapeSettings = shapeSettings; this.handSettings = handSettings; this.clusterFactory = new KMeansClusterFactory(this.clusteringSettings, size); this.filter = new PointerDepthPointFilter(size, this.clusteringSettings.MinimumDepthThreshold, this.clusteringSettings.MaximumDepthThreshold, this.clusteringSettings.LowerBorder); this.shapeFactory = new ClusterShapeFactory(this.shapeSettings); this.handFactory = new ShapeHandDataFactory(this.handSettings); }
public void Test_Equals() { var size = new IntSize(10, 10); var equalSize = new IntSize(10, 10); var unequalSize = new IntSize(11, 10); Assert.AreEqual(size, equalSize); Assert.AreNotEqual(size, unequalSize); Assert.AreNotEqual(size, null); Assert.AreNotEqual(size, new object()); }
public EditImage(string path, EditPictureProperties properties) { picBytes = File.ReadAllBytes(path); BitmapImage originalBmp = LoadBitmap(picBytes, IntSize.Empty); OriginalSize = new IntSize(originalBmp.PixelWidth, originalBmp.PixelHeight); Properties = properties; SetImage(); }
void tileControl_TileArrangementChanged(IntSize gridSize, double tileSize, Point centerPos) { m_renderData.Size = gridSize; rect.Width = tileControl.TileSize; rect.Height = tileControl.TileSize; var mp = tileControl.MapLocationToScreenLocation(new Point(5, 5)); var p = tileControl.ScreenLocationToScreenPoint(mp); Canvas.SetLeft(rect, p.X); Canvas.SetTop(rect, p.Y); }
public IList<ClusterPrototype> CreateClusters(int numberOfClusters, IntSize areaSize) { Contract.Requires(numberOfClusters >= 0); Contract.Requires(areaSize.Width > 0 && areaSize.Height > 0); var result = new List<ClusterPrototype>(); float sliceWidth = areaSize.Width / numberOfClusters; float sliceHeight = areaSize.Height / numberOfClusters; for (int index = 0; index < numberOfClusters; index++) { int minX = (int)((index) * sliceWidth); int maxX = (int)((index + 1) * sliceWidth); int minY = (int)((index) * sliceHeight); int maxY = (int)((index + 1) * sliceHeight); result.Add(this.CreateClusterWithin(minX, maxX, minY, maxY)); } return result; }
public DepthDataFrameFactory(IntSize size) { this.size = size; }
public KMeans(int numberOfClusters, Range zRange, IntSize size) { this.size = size; this.zRange = zRange; this.clusters = clusterFactory.CreateClusters(numberOfClusters, size); }
public KMeansClusterFactory(ClusterDataSourceSettings settings, IntSize size) : this(settings, new DefaultMergeStrategy(settings), size) { }
public WinformsDevice(WinformsEye eye, Direct3D direct3D, CAdapter adapter, ControlWindow primaryWindow, SwapChainDescription implicitSwapChainDesc, DeviceInitializationFlags flags, IFileSystem fileSystem) { this.eye = eye; this.adapter = adapter; this.primaryWindow = primaryWindow; this.implicitSwapChainDesc = implicitSwapChainDesc; this.flags = flags; caps = adapter.Info.GetCaps(DeviceType.Hardware); devicePresentParams = new PresentParameters(); FillDevicePresentParams(); d3dDevice = new Device(direct3D, adapter.Index, DeviceType.Hardware, primaryWindow.Handle, CreateFlags.FpuPreserve | CreateFlags.HardwareVertexProcessing, devicePresentParams); CreateBackBufferAndDepthStencil(); additionalSwapChains = new List<CAdditionalSwapChain>(); creator = new CDeviceChildCreator(this); immediateContext = new CDeviceContext(this); lastSwapChainSize = new IntSize(primaryWindow.SwapChainWidth, primaryWindow.SwapChainHeight); fullscreenState = FullscreenState.Windowed; fullscreenDisplayMode = adapter.GetSupportedDisplayModes().First(); }
/// <summary> /// Check device cooperative level before calling! /// </summary> void ResetProcedure() { creator.OnDeviceLost(); implicitDepthStencilBuffer.ReleaseIfExists(); implicitBackBuffer.ReleaseIfExists(); foreach (CAdditionalSwapChain t in additionalSwapChains) t.OnDeviceLost(); FillDevicePresentParams(); d3dDevice.Reset(devicePresentParams); lastSwapChainSize = new IntSize(primaryWindow.SwapChainWidth, primaryWindow.SwapChainHeight); CreateBackBufferAndDepthStencil(); foreach (CAdditionalSwapChain t in additionalSwapChains) t.OnDeviceReset(fullscreenState == FullscreenState.Fullscreen); creator.OnDeviceReset(); immediateContext.OnDeviceReset(); }