Coder Social home page Coder Social logo

roc-zig-package-experiment's Introduction

Graphics for Roc ๐Ÿ’œ

A simple platform for creating 2D images using Roc.

It generates a .png image file in the directory where you run roc run from.

My goal with this platform is to learn Roc platform dev, and to have a baseline platfrom that demonstrates everything required end-to-end including cross-platform packaging.

Any PR's or ideas are welcome. Possible future directions include:

  • Add support for other graphics formats (svg etc)
  • Add support for other image formats (write to bmp, jpg etc)

Example - Build and run locally

If you are running the example locally it will require that you have a prebuilt-platform library located next to the platform main.roc.

If you have zig version 0.11.0 installed you can build the prebuilt-platform using bash bundle.sh. This will cross-compile the platform for all supported platforms and also bundle these into a package for distribution.

Then you can run the example using roc run --prebuilt-platform examples/rocLovesGraphics.roc.

How to use

The platform main expects a record Options which contains basic information for generating an image. The image content is a Str and is expecting a TinyVG in text format. See roc-tinvyvg package for how to generate this using Roc.

Options : {
    size ? [Inherit, Set {width : U32, height : U32}],
    title ? Str,
    antiAlias ? [X1, X4, X9, X16, X25],
    content : Str,
}

# E.g.
main = { title: "bird", content: tvgText }

roc-zig-package-experiment's People

Contributors

bhansconnect avatar lukewilliamboswell avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

bhansconnect

roc-zig-package-experiment's Issues

Update to use `build.roc`

Update this to use a build.roc script to build the platform.

Test if this is a useful pattern for roc cli to use instead of manually building the platform and then running using --prebuilt-platform.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.