picogl.backend.gl.api.dpr ========================= .. py:module:: picogl.backend.gl.api.dpr .. autoapi-nested-parse:: Device pixel ratio helpers for HiDPI OpenGL surfaces. Functions --------- .. autoapisummary:: picogl.backend.gl.api.dpr.get_dpr picogl.backend.gl.api.dpr.framebuffer_attachment_size picogl.backend.gl.api.dpr._gl_get_framebuffer_parameter picogl.backend.gl.api.dpr.device_pixel_ratio Module Contents --------------- .. py:function:: get_dpr() -> int Return a platform heuristic device-pixel ratio for viewport setup. Prefer :func:`device_pixel_ratio` when an OpenGL context is current and the logical widget size is known. .. py:function:: framebuffer_attachment_size(*, target: picogl.backend.gl.enums.target.frame_buffer.GLFrameBufferTarget = GLFrameBufferTarget.FRAMEBUFFER, attachment: picogl.backend.gl.enums.frame.GLFrameBufferAttachment = GLFrameBufferAttachment.COLOR0) -> tuple[int, int] | None Return the color-attachment size in pixels, or ``None`` if unsupported. Must be called while an OpenGL context is current. .. py:function:: _gl_get_framebuffer_parameter(attachment: picogl.backend.gl.enums.frame.GLFrameBufferAttachment, parameter_name: Union[picogl.backend.gl.enums.frame.GLFrameBufferAttachmentParameter.OBJECT_TYPE, picogl.backend.gl.enums.frame.GLFrameBufferAttachmentParameter.OBJECT_NAME], target: picogl.backend.gl.enums.target.frame_buffer.GLFrameBufferTarget) -> int .. py:function:: device_pixel_ratio(logical_size: picoui.dimensions.Dimensions, *, target: picogl.backend.gl.enums.target.frame_buffer.GLFrameBufferTarget = GLFrameBufferTarget.FRAMEBUFFER, attachment: picogl.backend.gl.enums.frame.GLFrameBufferAttachment = GLFrameBufferAttachment.COLOR0) -> float Estimate effective DPR from the OpenGL framebuffer. Must be called while an OpenGL context is current. :param logical_size: Widget size in logical (CSS / Qt) pixels (``logical_size.width`` / ``logical_size.height``). :param target: Framebuffer target to query. :param attachment: Color attachment point to measure. :returns: Average of width and height scale factors, or ``1.0`` on failure.