Created
December 21, 2011 21:30
-
-
Save thomcc/1507796 to your computer and use it in GitHub Desktop.
show an image snip on a canvas in a new frame
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/gui | |
(define (show-image-snip-in-new-frame snip) | |
(define bmp (send snip get-bitmap)) | |
(define f (new frame% [label "image snip"] | |
[width (send bmp get-width)] | |
[height (send bmp get-height)])) | |
(define c | |
(new canvas% | |
[paint-callback (λ (c dc) (send dc draw-bitmap bmp 0 0))] | |
[parent f])) | |
(send f show #t)) | |
(require plot) | |
(show-image-snip-in-new-frame (plot (function sin (- pi) pi #:label "y = sin(x)"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment