@@ -327,7 +327,18 @@ export interface vtkOpenGLRenderWindow extends vtkOpenGLRenderWindowBase {
327
327
setViewStream ( stream : vtkViewStream ) : boolean ;
328
328
329
329
/**
330
- *
330
+ * Sets the pixel width and height of the rendered image.
331
+ *
332
+ * WebGL and WebGPU render windows apply these values to
333
+ * the width and height attribute of the canvas element.
334
+ *
335
+ * To match the device resolution in browser environments,
336
+ * multiply the container size by `window.devicePixelRatio`
337
+ * `apiSpecificRenderWindow.setSize(Math.floor(containerWidth * devicePixelRatio), Math.floor(containerHeight * devicePixelRatio));
338
+ * See the VTK.js FullscreenRenderWindow class for an example.
339
+ *
340
+ * @see getComputedDevicePixelRatio()
341
+ *
331
342
* @param {Vector2 } size
332
343
*/
333
344
setSize ( size : Vector2 ) : void ;
@@ -363,14 +374,15 @@ export interface vtkOpenGLRenderWindow extends vtkOpenGLRenderWindowBase {
363
374
getVrResolution ( ) : Vector2 ;
364
375
365
376
/**
366
- * Use to scale the size of a rendered canvas pixel to a browser CSS pixel.
367
- * `const cssPixelWidth = renderedPixelWidth / apiRenderWindow.getComputedDevicePixelRatio()`
377
+ * Scales the size of a browser CSS pixel to a rendered canvas pixel.
378
+ * `const renderedPixelWidth = cssPixelWidth * apiRenderWindow.getComputedDevicePixelRatio()`
379
+ * Use to scale rendered objects to a consistent perceived size or DOM pixel position.
380
+ *
368
381
* Rather than using window.devicePixelRatio directly, the device pixel ratio is inferred
369
- * from the container CSS pixel size and rendered image pixel size. The user can reduce the rendered size.
370
- * `apiSpecificRenderWindow.setSize(Math.floor(container.width * window.devicePixelRatio / 2), Math.floor(container.height * window.devicePixelRatio / 2))`
382
+ * from the container CSS pixel size and rendered image pixel size. The user directly sets the rendered pixel size.
371
383
*
384
+ * @see setSize()
372
385
* @see getContainerSize()
373
- * @see getSize()
374
386
*/
375
387
getComputedDevicePixelRatio ( ) : number ;
376
388
}
0 commit comments