File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88- [ ] ** PROPERTY** name
99- [ ] ** PROPERTY** quirks
1010- [ ] ** PROPERTY** safe symbol tags
11- - [ ] supports canvas and pixel mode
11+ - [ / ] supports canvas and pixel mode
1212
1313## Enums
1414- [ ] (Query) cell size px
Original file line number Diff line number Diff line change @@ -396,3 +396,55 @@ def _best_pixel_mode(self):
396396 res = _Chafa .chafa_term_info_get_best_pixel_mode (self ._term_info )
397397
398398 return res
399+
400+
401+ def supports (self , mode : CanvasMode | PixelMode ):
402+ """
403+ TODO: docs
404+ """
405+
406+ if type (mode ) == CanvasMode :
407+ supported = bool (self ._is_canvas_mode_supported (mode ))
408+
409+ elif type (mode ) == PixelMode :
410+ supported = bool (self ._is_pixel_mode_supported (mode ))
411+
412+ else :
413+ raise TypeError ("Provided 'mode' is neither PixelMode or CanvasMode" )
414+
415+ return supported
416+
417+
418+ def _is_canvas_mode_supported (self , canvas_mode : CanvasMode ):
419+ """
420+ wrapper for chafa_term_info_is_canvas_mode_supported
421+ """
422+
423+ _Chafa .chafa_term_info_is_canvas_mode_supported .argtypes = [
424+ ctypes .c_void_p ,
425+ ctypes .c_uint
426+ ]
427+
428+ _Chafa .chafa_term_info_is_canvas_mode_supported .restype = ctypes .c_bool
429+
430+ res = _Chafa .chafa_term_info_is_canvas_mode_supported (self ._term_info , canvas_mode )
431+
432+ return res
433+
434+
435+ def _is_pixel_mode_supported (self , pixel_mode : PixelMode ):
436+ """
437+ wrapper for chafa_term_info_is_pixel_mode_supported
438+ """
439+
440+ _Chafa .chafa_term_info_is_pixel_mode_supported .argtypes = [
441+ ctypes .c_void_p ,
442+ ctypes .c_uint
443+ ]
444+
445+ _Chafa .chafa_term_info_is_pixel_mode_supported .restype = ctypes .c_bool
446+
447+ res = _Chafa .chafa_term_info_is_pixel_mode_supported (self ._term_info , pixel_mode )
448+
449+ return res
450+
You can’t perform that action at this time.
0 commit comments