picogl.backend.gl.api.dpr
Device pixel ratio helpers for HiDPI OpenGL surfaces.
Functions
|
Return a platform heuristic device-pixel ratio for viewport setup. |
|
Return the color-attachment size in pixels, or |
|
|
|
Estimate effective DPR from the OpenGL framebuffer. |
Module Contents
- picogl.backend.gl.api.dpr.get_dpr() int[source]
Return a platform heuristic device-pixel ratio for viewport setup.
Prefer
device_pixel_ratio()when an OpenGL context is current and the logical widget size is known.
- picogl.backend.gl.api.dpr.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[source]
Return the color-attachment size in pixels, or
Noneif unsupported.Must be called while an OpenGL context is current.
- picogl.backend.gl.api.dpr._gl_get_framebuffer_parameter(attachment: picogl.backend.gl.enums.frame.GLFrameBufferAttachment, parameter_name: 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[source]
- picogl.backend.gl.api.dpr.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[source]
Estimate effective DPR from the OpenGL framebuffer.
Must be called while an OpenGL context is current.
- Parameters:
logical_size – Widget size in logical (CSS / Qt) pixels (
logical_size.width/logical_size.height).target – Framebuffer target to query.
attachment – Color attachment point to measure.
- Returns:
Average of width and height scale factors, or
1.0on failure.