{"id":15394280,"url":"https://github.com/xyproto/pf","last_synced_at":"2025-04-15T23:53:24.344Z","repository":{"id":136550693,"uuid":"145709687","full_name":"xyproto/pf","owner":"xyproto","description":"Apply functions to each pixel in an image, concurrently","archived":false,"fork":false,"pushed_at":"2021-08-12T16:09:50.000Z","size":17,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T03:03:56.276Z","etag":null,"topics":["argb","concurrent","map","pixels"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xyproto.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,"publiccode":null,"codemeta":null}},"created_at":"2018-08-22T13:00:47.000Z","updated_at":"2024-03-07T15:38:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"67ab3aac-0788-4693-ba89-6c04d3f62bcc","html_url":"https://github.com/xyproto/pf","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xyproto%2Fpf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xyproto%2Fpf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xyproto%2Fpf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xyproto%2Fpf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xyproto","download_url":"https://codeload.github.com/xyproto/pf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249173061,"owners_count":21224481,"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":["argb","concurrent","map","pixels"],"created_at":"2024-10-01T15:22:58.369Z","updated_at":"2025-04-15T23:53:24.326Z","avatar_url":"https://github.com/xyproto.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PixelFunctions\n\nApply functions to each pixel in an image, concurrently.\n\nThis module contains functions that fit well together with the [pixelpusher](https://github.com/xyproto/pixelpusher) module.\n\nThe `PixelFunction` type has this signature:\n\n    func(v uint32) uint32\n\nIf you have a pixel buffer of type `[]uint32`, with colors on the form `ARGB`, then this modules allows you to apply functions of the type `PixelFunction` to that slice, concurrently.\n\nThe goal is to avoid looping over all pixels more than once, while applying many different effects, concurrently.\n\n## Combine and Map\n\n* Several `PixelFunction` functions can be combined to a single `PixelFunction` by using the `Combine` function.\n* A `PixelFuncion` can be applied to a pixel buffer by using the `Map` function.\n\nExample:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/xyproto/pf\"\n    \"runtime\"\n)\n\nfunc main() {\n    // Resolution\n    const w, h = 320, 200\n\n    pixels := make([]uint32, w*h)\n\n    // Find the number of available CPUs\n    n := runtime.NumCPU()\n\n    // Combine two pixel functions\n    pfs := pf.Combine(pf.InvertEverything, pf.OnlyBlue)\n\n    // Run the combined pixel functions over all pixels using all available CPUs\n    pf.Map(n, pfs, pixels)\n\n    // Retrieve the red, green and blue components of the first pixel\n    red := (pixels[0] | 0x00ff0000) \u003e\u003e 0xffff\n    green := (pixels[0] | 0x0000ff00) \u003e\u003e 0xff\n    blue := (pixels[0] | 0x000000ff)\n\n    // Should output only blue: rgb(0, 0, 255)\n    fmt.Printf(\"rgb(%d, %d, %d)\\n\", red, green, blue)\n}\n```\n\n# General info\n\n* License: BSD\n* Version: 0.1.0\n* Author: Alexander F. Rødseth \u0026lt;xyproto@archlinux.org\u0026gt;\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxyproto%2Fpf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxyproto%2Fpf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxyproto%2Fpf/lists"}