Skip to content

Instantly share code, notes, and snippets.



Last active Dec 8, 2017
What would you like to do?
Draw Image Resizing Test with reaction
Red [
Title: "Draw Image Resizing Test"
Author: [REBOL version "Carl Sassenrath" Red port "Gregg Irwin" Reacting version "Marco Antoniazzi"]
Version: 0.0.2
Needs: View
img: load/as any [
attempt [read/binary img-url:]
attempt [read/binary img-url:]
attempt [read/binary img-url: %ukiah.jpg]
] 'jpeg
draw-blk: [image img 0x0 img/size]
view compose [
title "Draw Image Resizing Test"
backdrop water
style nub: base 10x10 glass loose draw [pen yellow fill-pen yellow circle 4x4 4]
text water bold font-color white "Red resize image test"
text 200 water bold font-color yellow "Drag the grab handles"
; resizing drawn image
canvas: base 960x720 black draw draw-blk react [
face/draw/3: n1/offset + 5x5 - face/offset
face/draw/4: n2/offset + 5x5 - face/offset
at 100x100
n1: nub
at (100x100 + img/size - 5x5)
n2: nub
; resizing face
at 450x50
image img react [face/offset: n3/offset + 5x5 face/size: n4/offset - n3/offset]
at 450x50
n3: nub
at 850x450
n4: nub

This comment has been minimized.

Copy link

@greggirwin greggirwin commented Aug 5, 2017

Very cool! If I drag the loose image, the handles don't stick with it though.


This comment has been minimized.

Copy link
Owner Author

@luce80 luce80 commented Dec 8, 2017

Thanks. In fact it was not meant to be loose so I simply disabled loose behavior. But now I have something to think about...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment