Code Monkey home page Code Monkey logo

Comments (5)

soimy avatar soimy commented on May 21, 2024

@ksesong Is it OK to just allow 0 or 90-degree rotation in packing? I'll be working on this soon

from maxrects-packer.

ksesong avatar ksesong commented on May 21, 2024

Yes, this was what I had in mind, and it should cover most situations.

from maxrects-packer.

soimy avatar soimy commented on May 21, 2024

Done via 7e914bc
@ksesong Can you do some test and report back?

from maxrects-packer.

ksesong avatar ksesong commented on May 21, 2024

I did some testing, and it does work in my situation (which is quite basic to be honest, so I can't talk about more complex scenarios). Thanks!
I would also mention in the description how you expect the rect to be rotated if rot is true (-90 degrees centered around the top-right corner).

from maxrects-packer.

soimy avatar soimy commented on May 21, 2024

@ksesong For the rects in the bin, only width, height, rot(boolean) is given as results. CW/CCW will have the same width \ height so that decision is yours when you actually composite your altas.

Take a lot at these code as an example:
https://github.com/soimy/msdf-bmfont-xml/blob/f1e5b6c58712a2461d150da015af3939863c3f42/index.js#L199-L204

      bin.rects.forEach(rect => {
        if (rect.data.imageData) {
          if (rect.rot) {
            rect.data.imageData.rotate(90);
          }
          img.composite(rect.data.imageData, rect.x, rect.y);
      }

from maxrects-packer.

Related Issues (18)

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.