Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'schanzer/master'

  • Loading branch information...
commit 36537ed5b7b7ad9ba59c4e23f90ec26ae6a540a0 2 parents 046ae7e + 9bef304
@dyoo dyoo authored
View
2  js-runtime/lib/primitive.js
@@ -4694,7 +4694,7 @@ PRIMITIVES['put-pinhole'] =
new PrimProc('put-pinhole',
3,
false, false,
- function(aState, x, y, img) {
+ function(aState, img, x, y) {
check(aState, img, isImage, "put-pinhole", "image", 1, arguments);
check(aState, x, isReal, "put-pinhole", "real", 2, arguments);
check(aState, y, isReal, "put-pinhole", "real", 3, arguments);
View
3  js-runtime/lib/world/world.js
@@ -790,6 +790,9 @@ if (typeof(world) === 'undefined') {
CropImage.prototype.render = function(ctx, x, y) {
ctx.save();
+ ctx.beginPath();
+ ctx.rect(x, y, this.width, this.height);
+ ctx.clip();
ctx.translate(-this.x, -this.y);
this.img.render(ctx, x, y);
ctx.restore();
View
2  src/compiler/mzscheme-vm/collections/bootstrap2012/cage-teachpack.ss
@@ -56,7 +56,7 @@
(number->string (world-y w)))
14 'black)
(quotient (image-width scene) 2)
- 0
+ 15
scene))))
(draw-butterfly w
(draw-text w (empty-scene WIDTH HEIGHT)))))
View
10 src/compiler/mzscheme-vm/collections/bootstrap2012/function-teachpack.ss
@@ -20,7 +20,7 @@
(define IMAGE0 (empty-scene WIDTH HEIGHT))
(define source (bitmap/url "http://www.wescheme.org/images/teachpacks2012/rocket.png"))
-(define ROCKET source #;(put-pinhole source (/ (image-width source) 2) (image-height source)))
+(define ROCKET source)
;; -----------------------------------------------------------------------------
;; draw-world: Number -> Image
@@ -32,11 +32,11 @@
;; add the height of the rocket and the time elapsed to the image
(define (text-add time height IMAGE0)
(place-image (text (string-append "Time: " (number->string time)) 14 (make-color 41 128 38))
- 67
- 0
+ 60
+ 15
(place-image (text (string-append "Height: " (number->string height)) 14 (make-color 38 38 128))
60
- 20
+ 30
IMAGE0)))
;; rocket-add : Number Image -> Image
@@ -45,7 +45,7 @@
(cond
[(>= (image-height ROCKET) (- HEIGHT ((cdr w) (car w))))
(place-image ROCKET 100 200 IMAGE0)]
- [else (place-image ROCKET 100 (- HEIGHT ((cdr w) (car w))) IMAGE0)]))
+ [else (place-image ROCKET 100 (- (- HEIGHT ((cdr w) (car w))) (/ (image-height source) 2)) IMAGE0)]))
;; (Number (Number -> Number)) Symbol -> (Number (Number -> Number))
View
16 tests/test-htdocs/image-library-test.scm
@@ -167,6 +167,17 @@
(regular-polygon 38 4 "solid" (make-color 200 200 255))
(regular-polygon 44 4 "solid" (make-color 250 250 255)))
+"overlay with place-image - target should be centered"
+ (place-image (overlay (ellipse 10 10 "solid" "white")
+ (ellipse 20 20 "solid" "black")
+ (ellipse 30 30 "solid" "white")
+ (ellipse 40 40 "solid" "black")
+ (ellipse 50 50 "solid" "white")
+ (ellipse 60 60 "solid" "black"))
+ 150 100
+ (rectangle 300 200 "solid" "black"))
+
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; OVERLAY/XY
@@ -578,6 +589,11 @@ Australia2
(beside (crop 40 0 40 40 (circle 40 "solid" "lightcoral"))
(crop 0 0 40 40 (circle 40 "solid" "palevioletred"))))
+"should be a quarter of a circle, inscribed in a square"
+(place-image
+ (crop 0 0 20 20 (circle 20 "solid" "Magenta"))
+ 10 10
+ (rectangle 40 40 "solid" "blue"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; LINE, ADD-LINE & SCENE+LINE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Please sign in to comment.
Something went wrong with that request. Please try again.