Monty  Boehm

Monty Boehm

1659525240

CSFML.jl: Julia bindings for CSFML

CSFML 

Julia wrapper for CSFML, the official binding of SFML for C. SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics, audio and network. The Julia bindings in this repo are auto-generated using Clang.jl.

Installation

pkg> add CSFML

Quick start

using CSFML
using CSFML.LibCSFML

mode = sfVideoMode(1280, 720, 32)

window = sfRenderWindow_create(mode, "SFML window", sfResize | sfClose, C_NULL)
@assert window != C_NULL

texture = sfTexture_createFromFile(joinpath(dirname(pathof(CSFML)), "..", "examples", "julia-tan.png"), C_NULL)
@assert texture != C_NULL

sprite = sfSprite_create()
sfSprite_setTexture(sprite, texture, sfTrue)

font = sfFont_createFromFile(joinpath(dirname(pathof(CSFML)), "..", "examples", "Roboto-Bold.ttf"))
@assert font != C_NULL

text = sfText_create()
sfText_setString(text, "Hello SFML")
sfText_setFont(text, font)
sfText_setCharacterSize(text, 50)

music = sfMusic_createFromFile(joinpath(dirname(pathof(CSFML)), "..", "examples", "Chrono_Trigger.ogg"))
@assert music != C_NULL

sfMusic_play(music)

event_ref = Ref{sfEvent}()

while Bool(sfRenderWindow_isOpen(window))
    # process events
    while Bool(sfRenderWindow_pollEvent(window, event_ref))
        # close window : exit
        event_ref.x.type == sfEvtClosed && sfRenderWindow_close(window)
    end
    # clear the screen
    sfRenderWindow_clear(window, sfColor_fromRGBA(0,0,0,1))
    # draw the sprite
    sfRenderWindow_drawSprite(window, sprite, C_NULL)
    # draw the text
    sfRenderWindow_drawText(window, text, C_NULL)
    # update the window
    sfRenderWindow_display(window)
end

sfMusic_destroy(music)
sfText_destroy(text)
sfFont_destroy(font)
sfSprite_destroy(sprite)
sfTexture_destroy(texture)
sfRenderWindow_destroy(window)

Author: JuliaMultimedia
Source Code: https://github.com/JuliaMultimedia/CSFML.jl 
License: Zlib license

#julia #binding 

What is GEEK

Buddha Community

CSFML.jl: Julia bindings for CSFML
Monty  Boehm

Monty Boehm

1659525240

CSFML.jl: Julia bindings for CSFML

CSFML 

Julia wrapper for CSFML, the official binding of SFML for C. SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics, audio and network. The Julia bindings in this repo are auto-generated using Clang.jl.

Installation

pkg> add CSFML

Quick start

using CSFML
using CSFML.LibCSFML

mode = sfVideoMode(1280, 720, 32)

window = sfRenderWindow_create(mode, "SFML window", sfResize | sfClose, C_NULL)
@assert window != C_NULL

texture = sfTexture_createFromFile(joinpath(dirname(pathof(CSFML)), "..", "examples", "julia-tan.png"), C_NULL)
@assert texture != C_NULL

sprite = sfSprite_create()
sfSprite_setTexture(sprite, texture, sfTrue)

font = sfFont_createFromFile(joinpath(dirname(pathof(CSFML)), "..", "examples", "Roboto-Bold.ttf"))
@assert font != C_NULL

text = sfText_create()
sfText_setString(text, "Hello SFML")
sfText_setFont(text, font)
sfText_setCharacterSize(text, 50)

music = sfMusic_createFromFile(joinpath(dirname(pathof(CSFML)), "..", "examples", "Chrono_Trigger.ogg"))
@assert music != C_NULL

sfMusic_play(music)

event_ref = Ref{sfEvent}()

while Bool(sfRenderWindow_isOpen(window))
    # process events
    while Bool(sfRenderWindow_pollEvent(window, event_ref))
        # close window : exit
        event_ref.x.type == sfEvtClosed && sfRenderWindow_close(window)
    end
    # clear the screen
    sfRenderWindow_clear(window, sfColor_fromRGBA(0,0,0,1))
    # draw the sprite
    sfRenderWindow_drawSprite(window, sprite, C_NULL)
    # draw the text
    sfRenderWindow_drawText(window, text, C_NULL)
    # update the window
    sfRenderWindow_display(window)
end

sfMusic_destroy(music)
sfText_destroy(text)
sfFont_destroy(font)
sfSprite_destroy(sprite)
sfTexture_destroy(texture)
sfRenderWindow_destroy(window)

Author: JuliaMultimedia
Source Code: https://github.com/JuliaMultimedia/CSFML.jl 
License: Zlib license

#julia #binding 

FLAC.jl: Julia Bindings for LibFLAC

FLAC.jl

Julia bindings for libFLAC 

Usage

Integration through FileIO makes loading and saving easy:

data, fs = load("input.flac")
data = data * 2
save("output.flac", data, fs)

save() can also take extra keyword parameters such as bits_per_sample and compression_level if such parameters are important. More advanced usage is possible through the use of the FLACDecoder API, which allows for, among other things, seeking within .flac streams and decoding segments of streams.

Download Details:

Author: JuliaIO
Source Code: https://github.com/JuliaIO/FLAC.jl 
License: View license

#julia #binding 

Chemfiles.jl: Julia Bindings to Chemfiles

Chemfiles.jl

This package contains the Julia binding for the chemfiles library. It allow you, as a programmer, to read and write chemistry trajectory files easily, with the same simple interface for all the supported formats. For more information, please read the introduction to chemfiles.

Installation

You can install Chemfiles with Pkg.add("Chemfiles"). You can also run the test suite with:

julia> Pkg.test("Chemfiles")

All the tests should pass. If they don't, please open an issue.

Usage example

Here is a simple usage example for Chemfiles.jl. Please see the examples folder for more examples.

using Chemfiles

trajectory = Trajectory("filename.xyz")
frame = read(trajectory)

println("There are $(size(frame)) atoms in the frame")
positions = positions(frame)

# Do awesome things with the positions here !

Bug reports, feature requests

Please report any bug you find and any feature you may want as a Github issue.

Documentation

Download Details:

Author: Chemfiles
Source Code: https://github.com/chemfiles/Chemfiles.jl 
License: View license

#julia #binding 

GraphViz.jl: Julia Binding to The GraphViz Library

GraphViz.jl

This package provides an interface to the the GraphViz package for graph visualization. There are two primary entry points:

  • The GraphViz.load function (not exported) to load graphs from a file
  • The dot""" string macro for literal inline specifications of graphs

Both of these accept Graph type accepts graph in DOT format. To load a graph from a non-constant string, use GraphViz.load with an IOBuffer.

Getting started

If you already have a graph you would like to work with, the following code snippets may be helpful. If not, have a look at the "Simple Examples" section below

using GraphViz
GraphViz.load("mygraph.dot")
dot"""
 digraph graphname {
     a -> b -> c;
     b -> d;
 }
""")

Usage

After obtaining the package through the package manager, the following suffices to load the package:

using GraphViz

Note that graphviz has many configuration options. In particular, both the Cairo and the GTK backends may be disabled by default.

Simple Examples

Try the following in an IJulia Notebook (this example is taken from here):

dot"""
graph graphname {
     // The label attribute can be used to change the label of a node
     a [label="Foo"];
     // Here, the node shape is changed.
     b [shape=box];
     // These edges both have different line properties
     a -- b -- c [color=blue];
     b -- d [style=dotted];
 }
"""

Download Details:

Author: JuliaGraphs
Source Code: https://github.com/JuliaGraphs/GraphViz.jl 
License: View license

#julia #graphs #binding 

Fontconfig.jl: Basic Julia Bindings for Fontconfig

Fontconfig 

Fontconfig.jl provides basic binding to fontconfig.

Pattern

Pattern corresponds to the fontconfig type FcPattern. It respresents a set of font properties used to match specific fonts.

It can be constructed in two ways. First with zero or more keyword arguments corresponding to fontconfig font properties.

Fontconfig.Pattern(; args...)

For example

Fontconfig.Pattern(family="Helvetica", size=10, hinting=true)

Secondly, it can be constructed with a fontconfig specifications string

Fontconfig.Pattern(name::String)

For example

Fontconfig.Pattern("Helvetica-10")

Match

The primary functionality fontconfig provides is matching font patterns. In Fontconfig.jl this is done with the match function, corresponding to FcMatch in fontconfig.

match(pat::Pattern)

It takes a Pattern and return a Pattern corresponding to the nearest matching installed font.

Format

Extracting property values from a Pattern can be done with the format function, which wraps FcPatternFormat.

format(pat::Pattern, fmt::String="%{=fclist}")

See man FcPatternFormat for the format string specification.

List

Fontconfig also provides a function list to enumerate all installed fonts. Optionally, a Pattern can be provided to list just matching fonts. The function will return a vector of Patterns

list(pat::Pattern=Pattern())

Download Details:

Author: JuliaGraphics
Source Code: https://github.com/JuliaGraphics/Fontconfig.jl 
License: View license

#julia #binding