<div dir="ltr"><div>Thanks. Yes, they want to (say) draw a solid green circle next to the name of someone who has been active in the last five minutes. As I understand it, they followed the GUI Toolkit intro and arrived at the point where they have a canvas% with the on-paint method specified in its constructor. The on-paint method then needs to draw the green circle. They are familiar with (circle 20 "solid" "green"), so they just want to do the equivalent of (place-image green-circle x y ?dc?).<br><br>I think the image->bitmap function Alexander provided looks like what they need, and then they can use the draw-bitmap message.<br><br></div><div>I didn't know how to pull the functions from different packages to make them usable one file.<br><br></div>Thanks for the help.<br><div><br></div><div>Andrew<br><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">Andrew Mauer-Oats<br>Mathematics Ph.D.<br>Chicago Public Schools: Whitney Young<br></div></div>
<br><div class="gmail_quote">On Thu, Mar 19, 2015 at 8:15 PM, Alexander D. Knauth <span dir="ltr"><<a href="mailto:alexander@knauth.org" target="_blank">alexander@knauth.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here’s one way, if you mean a bitmap% object:<br>
<br>
#lang racket/base<br>
<br>
(provide image->bitmap)<br>
<br>
(require racket/class<br>
         (only-in racket/draw make-bitmap bitmap-dc%)<br>
         (only-in 2htdp/image image-width image-height)<br>
         (only-in mrlib/image-core render-image))<br>
<br>
(define (image->bitmap image)<br>
  (let* ([width (image-width image)]<br>
         [height (image-height image)]<br>
         [bm (make-bitmap width height)]<br>
         [dc (make-object bitmap-dc% bm)])<br>
    (send dc clear)<br>
    (render-image image dc 0 0)<br>
    bm))<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Mar 19, 2015, at 7:05 PM, Robby Findler <<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>> wrote:<br>
<br>
> When you say "bitmap" do you mean "bitmap% object"? And if so, why do<br>
> they want to do that? If not, do you mean something else?<br>
><br>
> Robby<br>
><br>
><br>
> On Thu, Mar 19, 2015 at 5:24 PM, Andrew Mauer-Oats <<a href="mailto:maueroats@gmail.com">maueroats@gmail.com</a>> wrote:<br>
>> Is there a public way to change an image created using the 2htdp/image<br>
>> library into a bitmap?<br>
>><br>
>> My students are used to those functions and it would be easier for some of<br>
>> them to go and build the GUI they want if they didn't have to change over to<br>
>> explicitly using drawing contexts.<br>
>><br>
>> I have looked at the source for mrlib/image-core, 2htdp/private/image-more,<br>
>> and 2htdp/image. It looks like no exported functions can change an image to<br>
>> a bitmap.<br>
>><br>
>> The only thing they want to do is be able to render an image onto a dc.<br>
>> Presumably the render-image function would do that, were it exported.<br>
>><br>
>> What should I do?<br>
>><br>
>> Thanks for your help,<br>
>><br>
>> Andrew Mauer-Oats<br>
>> Mathematics Ph.D.<br>
>> Chicago Public Schools: Whitney Young<br>
>><br>
>> ____________________<br>
>>  Racket Users list:<br>
>>  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
>><br>
> ____________________<br>
>  Racket Users list:<br>
>  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br>
</div></div></blockquote></div><br></div>