omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    canvas XOR scene?

    Pythonista
    2
    4
    3113
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • RickW37
      RickW37 last edited by

      Can you use canvas and scene objects together? I like that complex objects can be built up using a canvas object (e.g. add_quad_curve/fill_path). However, I'd like to interact with the drawing as well using a scene (e.g. touch_began). Any suggestions as to how I can "have my cake and eat it too"?

      1 Reply Last reply Reply Quote 0
      • omz
        omz last edited by

        At the moment, no. You can use the <a href="http://omz-software.com/pythonista/docs/ios/ImageDraw.html">ImageDraw module</a> to build images dynamically that can then be loaded into a scene with <a href="http://omz-software.com/pythonista/docs/ios/scene.html#scene.load_pil_image">load_pil_image</a>.

        However, ImageDraw doesn't support antialiasing or bezier curves, only relatively simple shapes, lines, and text. You could probably emulate anti-aliasing relatively well by drawing into a larger image and then <a href="http://omz-software.com/pythonista/docs/ios/Image.html#Image.Image.resize">scaling it down</a> with the Image.ANTIALIAS filter. Bezier curves would be possible by calculating all the line segments manually, using <a href="http://en.wikipedia.org/wiki/Bézier_curve">some math</a>, but it's probably quite a hassle to do that...

        1 Reply Last reply Reply Quote 0
        • RickW37
          RickW37 last edited by

          Do you think getting them to "play nice" together could happen anytime soon?

          If the missing drawing ops, found in 'canvas' could move over into 'scene' then 'canvas' could get dropped/deprecated. It's ok if all apps start as console-mode and require a 'scene' for drawing+interaction.

          Otherwise, it would be great to just add those wonderful "missing" drawing ops into 'scene'.

          1 Reply Last reply Reply Quote 0
          • omz
            omz last edited by

            I plan to overhaul the canvas module to work better with others (mostly PIL and scene). Basically, I want canvas to work more like PIL, i.e. allow multiple canvasses that can be drawn to and saved as images etc. I can't say yet when I'll get to that, I'm pretty busy with some other things at the moment, but it's on my radar.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors