Giter Site home page Giter Site logo

dotmatrix's Issues

Feature Request: Matrix manipulation

Description

It would be nice to be able to rotate/transpose/crop/shift/etc. any give matrix.

Code

from dotmatrix import Matrix

m = Matrix(5, 5)

print("Initial")
m.polygon((0, 0), (0, 4), (4, 4))
print(m.render())

print("Transposed")
m.transpose()
print(m.render())

Output

Initial
⡗⢄⠀
⠉⠉⠁
Transposed
⠙⢍⡇
⠀⠀⠁

Anything else?

No response

Feature Request: Different "Character sets"

Description

One "nice to have" feature could be the addition of matrices that use other character sets for rendering. One nice set could be ▖▗▘▝▀▄▌▐▚▞▙▛▜▟█, i.e. a 2x2 grid per character.

This could be accomplished by extracting all the character set dependent code into a subclass and leave an ABC that makes use of __getitem__, __setitem__, __init__, and render provided by the subclass.

Code

from dotmatrix import BlockMatrix

m = BlockMatrix(16, 8)

m.rectangle((0, 0), (15, 7))

print(m.render())

Output

▛▀▀▀▀▀▀▜
▌      ▐
▌      ▐
▌      ▐
▌      ▐
▌      ▐
▌      ▐
▙▄▄▄▄▄▄▟

Anything else?

No response

Bug: Bad images in README

Description

As you mentioned in reddit post, pictures of matrix can be broken due to browsers "smart" behaviour. This problem is on README too

Code

Not the code, only ask for use picture in README

Output

Will add picture in "Anything else?" section as I am not certain in posting picture here

Anything else?

Example:
image

Feature Request: Dithered Images

Description

An amazing feature would be the ability to render a given image onto a dotmatrix. And to make things prettier some sort of dithering, be it Floyd-Steinberg or Atkinson or something else entirely, would also be nice.

Code

import dotmatrix as dm

m = dm.Matrix(256, 256)

m.blit(
    "path/to/my/image",
    area=((63, 63), (191, 191)),  # The area to blit the image to.
    dither=dm.dither.Floyd        # The dithering algorithm to use.
)

print(m.render())

or

import dotmatrix as dm
from PIL import Image


m = dm.Matrix(256, 256)
img = Image.open("path/to/my/image")

m.blit(
    img,
    area=((63, 63), (191, 191)),  # The area to blit the image to.
    dither=dm.dither.Floyd        # The dithering algorithm to use.
)

print(m.render())

Output

No response

Anything else?

Example: DotArt by Garrett Albright

The latter example usage would require pillow as dependency. Thus it might be sensible to block this feature behind an "import guard" and add pillow as an extra-install-option, àla dotmatrix[images].

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.