Construct 3 r421

You're viewing a single comment in a conversation. View all the comments
  • 7 Comments

  • Order by
  • I just checked 'Pixel painter' example. There is no color picker but when you use "bucket" script can look at color on canvas. I wonder: JS is only way to pick color from canvas or I missing something? Sorry if its wrong place to ask.

    • You can access/modify pixel data through events. Read the "Pixel manipulation with snapshots" section of the documentation: construct.net/en/make-games/manuals/construct-3/plugin-reference/drawing-canvas.

      • Thank you for response!

        I want to mix one/two type of objects on canvas and then look at result color at exact point.

        But as I understand all manipulations mentioned in that section uses: only snapshot of the whole frame and can be called only while it sits inside GPU memory.

        So I can't just draw something and check exact point.

        Or JS example doing same snapshot actions from documentation? And I asking for too much since its somehow becomes "backwards rendering"?

        • Have a look at these 4 expressions: SnapshotRedAt(x, y), SnapshotGreenAt(x, y), SnapshotBlueAt(x, y), SnapshotAlphaAt(x, y). Those expressions combined pick the colour of an exact point.

          • I saw them but they took info from whole frame/layers.

            Can I take snapshot of the frame just for certain objects or layers?

            If not, those expressions will get wrong color.

            For example lets take scene: color sprites with 50% opacity on top of ground image. SnapshotRedAt(x, y) will count RGB of the ground too but only RGB of sprites needed.

            Since I could not sample color directly from layer my idea was to use canvas as way to draw color info there and sample it from there somehow.

            • Paste just the objects you want into the canvas, take the snapshot, then sample the pixels. e.g.

              -> Paste object Sprite with effects

              -> Save snapshot

              -> Wait for previous actions to complete

              -> Log in console: DrawingCanvas.SnapshotRedAt(0, 0) & " " & DrawingCanvas.SnapshotGreenAt(0, 0) & " " & DrawingCanvas.SnapshotBlueAt(0, 0) & " " & DrawingCanvas.SnapshotAlphaAt(0, 0)

              • Oh my, NOW I get it!

                Somehow I thought of 'snapshot canvas' from System actions. Now I see that Drawing Canvas have its own snapshot that does everything I asked for.

                Thank you for your patience!