Code Monkey home page Code Monkey logo

graphics's Issues

Representation of matrices

2D matrices are kind of special, because they only require 6 numbers which reduces computation. The natural way of writing a unit matrix is:

[1.0, 0.0, 0.0,
 0.0, 1.0, 0.0]

In the end, matrices are just arrays with numbers, so I would like to just use

pub type Matrix2d = [f64, ..6]

Integration with platform GUI

I don't like platform specific GUI, because it makes the behavior and look of the application in-deterministic. One need to test the application for every new feature on all the platforms.

Benchmarking

I assume in order to make decisions about which direction to go, one needs to run the same tests using different algorithms.

Add EllipseContext

I think this should be a separate object than RectangleContext, even those two are similar. The reason is I would like to use circle etc. instead of square and make it mean something different.

Interaction with fonts

I need to collect the necessary information to deal with fonts.

  • Is is much work to write a pure Rust decoder of various font formats?
  • Is is much work to deal with globalization, right-to-left etc?

How to organize documentation about back-ends

It should be easy to integrate with back-ends.
Some libraries might have a collection of back-ends.

The source docs about the BackEnd trait should provide details about the expected behavior.

Feature completeness

Having a nice syntax counts, but having battery included also means a lot. Most people might become interested when they see the syntax. After a while they will see the things that are missing and then drop the project. It is important to keep enough speed in the development until it reaches a point where it is usable. The goal is to create the best portable 2D graphics library for Rust in the world. This means I have to think things through to the degree that it feels complete.

If we can't manage to create a such library or if there are any major obstacles, I would like to know sooner than realizing that weeks later. It might be necessary to reduce the scope of the project, but there are certain things people expect a graphics library to have.

The Shoes framework repository has almost 2000 commits, which is about 20x times the commits in Rust-Empty. Assuming that this project is going to be 20x times harder than Rust-Empty it would require a lot more man hours.

Node tree

One idea is to develop a default back-end that just structures the drawing calls into a data structure. The structure can then be fed back into the context, generating a new structure, and checking that those two structures are the same.

The graphics API and the node tree should then be of the same complexity. A such node tree can be sent across the network, read from a file etc.

Use another word than `back-end`?

The word back-end implies that one is adding a target in an existing package.
Rust-Graphics is designed to build the 'back-end' on top, such that one can write a new 'back-end' in the same application one uses it.

Hit test rectangle

A function that returns true if a point is inside a rectangle.

Could be added to RectangleContext.

Animated features

Should Rust-Graphics have animated features?

What kind of abstraction would fit animation?

Would things as interpolation be sufficient?

Base vs Current convention

It could be useful to pair two values, one as a base value and one as current value.

Base color vs Current color
Base transform vs Current transform
Base control points vs Current control points

Image formats bindings

Instead of wasting time reimplementing image formats in pure Rust, one could have a simple enough back-end to wrap around various formats.

I imagine having an enum that contains commonly used image formats. A function takes the raw data of an image, writes to a file in a given format. The enum can have methods that returns default file extensions and detects version from file extension.

image::write(file, img);
image::write_format(file, img, format);

Alpha channel

Should this be on by default?

How will it affect the performance?

Floating precision

f32 has problems with matrices since it requires very good precision specially in the range between 0.0 and 1.0.

Using f64 has the advantage that I = M^-1 M can have a larger invariant space and still be true under a certain epsilon absolute value.

Most CPUs are 64bit now and the speed of f64 will increase with the development of technology.

Cooperating with others and taking pull requests

I think it is best to think things through a little while and engage others when there are specific tasks to do. It takes a quite bit of work to come up with a design that addresses all the concerns. In that process I might need some input, but so far this is a kind of project I can deal best with by working on it in peace.

Back-end design

One way is to have context wrap a generic type T:

pub struct Context<'a, Backend> {
  ....
   backend: &'a Backend
}

Text layout algorithm

A TextLayoutContext could be created to position characters.

Each character could be drawn in a CharContext.

Testing whether the compiler optimizes out unused fields of context

Assuming that most methods inline everything, the compiler should be able to determine that

.trans(1.0, 0.0).trans(0.0, 1.0)

only create pointers to the other fields, but does not use them.

How can one check that this is the case? Is it possible to see that by looking at the emitted IR?

Taking advantage of Rust's type system

Computer graphics is a complicated subject, but there are certain things that are universal:

  • You want to change the context dynamically
  • You want to undo recently changes to the context
  • You want to know what is going on in the context
  • You don't want to keep track of changes required to undo changes
  • You want to check for hit test and get context relevant information
  • You want to work with context specific methods to build patterns etc.
  • You want good defaults

The enum in Rust allows one to create a building block for both values and pointer to values:

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.