{"id":13802134,"url":"https://github.com/peter-l5/framebuf2","last_synced_at":"2025-05-13T12:32:24.795Z","repository":{"id":62694285,"uuid":"529876673","full_name":"peter-l5/framebuf2","owner":"peter-l5","description":"MicroPython FrameBuffer extension: larger and rotated font, triangles and circles","archived":false,"fork":false,"pushed_at":"2023-05-30T09:33:30.000Z","size":22,"stargazers_count":12,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-18T17:51:19.048Z","etag":null,"topics":["circle","font","framebuffer","large-font","micropython","size","triangle"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peter-l5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-08-28T13:52:47.000Z","updated_at":"2024-11-15T22:08:15.000Z","dependencies_parsed_at":"2024-01-29T19:30:23.906Z","dependency_job_id":null,"html_url":"https://github.com/peter-l5/framebuf2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-l5%2Fframebuf2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-l5%2Fframebuf2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-l5%2Fframebuf2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-l5%2Fframebuf2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peter-l5","download_url":"https://codeload.github.com/peter-l5/framebuf2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253942625,"owners_count":21988099,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circle","font","framebuffer","large-font","micropython","size","triangle"],"created_at":"2024-08-04T00:01:36.929Z","updated_at":"2025-05-13T12:32:24.524Z","avatar_url":"https://github.com/peter-l5.png","language":"Python","readme":"# framebuf2\n\n## MicroPython FrameBuffer large and rotated font, triangle and circle extension\n\nThis module extends the `FrameBuffer` class in MicroPython's [framebuf module](https://docs.micropython.org/en/latest/library/framebuf.html \"MicroPython documentation\"). It enables drawing of double, triple, quadruple, and larger size text to FrameBuffer objects using the built-in font provided in the framebuf module.\u003cbr\u003e \nAlso included are methods to draw triangles and circles. These can be outlines only or filled.\u003cbr\u003e\nThe module has been tested on a Raspberry Pi Pico with a 128x128 pixel SH1107 display. It should work with all MicroPython FrameBuffer objects.\n\n## Methods\n\n**`large_text(s, x, y, m [, c=1] [, r=0 [, t=None]])`**\n\nWrite text, `s`, to a FrameBuffer using the the `x` and `y` coordinates as the upper-left corner of the text. The colour of the text can be defined by the optional argument, `c`, but is otherwise a default value of 1. The parameter `m` sets the size multiple for the text. The normal size for text with the 'FrameBuffer.text()' method is 8x8 pixels. This would be a multiple of 1. To obtain larger text output, with 16x16 pixel characters, for example, use 2 for the m parameter. The optional parameter r controls the rotation of the text, 0 degrees is the default, 90, 180 and 270 degrees are possible. In addition the t parameter enables individual characters within a string to be independently rotated to 0, 90, 180 or 270 degrees. \n\n**`circle(x0, y0, radius, c [, f:bool] )`** \n\nDraw a circle centred on `x0, y0` with the specified `radius` and border colour, `c` (integer). Optionally fill the circle by adding `f=True`.\n\n**`triangle(x0, y0, x1, y1, x2, y2, c [, f:bool] )`**\n\nDraw a triangle with vertices at points `x0,y0` , `x1,y1` and `x2,y2` and border colour, `c` (integer). Optionally fill the circle by adding `f=True`.\n\n\n## Usage\n\nExample use:\n```\n    # display is a framebuffer object\n    display.large_text('double', 0, 0, 2, 1)  # double size text\n    display.large_text('size!', 0, 16, 2, 1)\n    display.large_text('HUGE', 0, 32, 4, 1)   # quadruple size text\n\n    # draw a circle centred at point (x=64, y=64) with radius 56 and colour 1.\n    display.circle(64, 64, 56 , c=1)\n    display.circle(64, 64, 48 , c=1, f=True) # filled circle\n\n    # draw a filled triangle with corners at (x=0, y=0), (x=0, y=127) and (x=127, y=127)\n    # filled with colour 1.\n    display.triangle(0, 0, 0, 127, 127, 127, c=1, f=True)\n```\nAdditional examples are included in the example code for this [SH1107](https://github.com/peter-l5/SH1107 \"SH1107 OLED display driver\") display driver\n\n## Loading the module\n\nUse the following to import the module and extend the FrameBuffer class.\u003cbr\u003e\n`import framebuf2 as framebuf`\u003cbr\u003e\nThe FrameBuffer class will then offer these additional methods besides all the standard methods.\n\n## Requirements\n\nWorks with MicroPython version 1.19.1. Will also work with other versions. \n\n## Release notes\n\n#### v209\n\n- code formatted to [PEP8](https://peps.python.org/pep-0008/) standards using [black](https://pypi.org/project/black/)\n\n#### v208\n\n- fix for issue #1\n- fix for an issue where filled triangles were not drawn properly around the middle vertex (middle in vertical order)  \n\n#### v206\n\n- large_text() enhanced by the addition of rotation parameter \n- substantial speed improvements  to the large_text() method\n\n#### v202\n\n- triangle() and circle() drawing methods added\n","funding_links":[],"categories":["Libraries"],"sub_categories":["Display"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-l5%2Fframebuf2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeter-l5%2Fframebuf2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-l5%2Fframebuf2/lists"}