dr-geo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Dr. Geo] Include bitmaps in sketches


From: Rafael Luque
Subject: Re: [Dr. Geo] Include bitmaps in sketches
Date: Wed, 3 Nov 2021 11:37:20 +0100

Thank you, Hilaire.

The "comeToFront" method is just what I needed.

I'd like to position the scale Earth where you click on the canvas, however
right now I only get the position of the argument. I wonder if I could get
the position where you click from the script code.

Thank you!


El mié, 3 nov 2021 a las 9:59, H. Fernandes (<hilaire@drgeo.eu>) escribió:

> Hi Rafael,
>
> Wow, I am impressed! Do you have prior experience with Smalltalk?
>
> To control the z-order, you send the message #comeToFront to the morph you
> want to be on the front.
> In your script add something like below after creating the item:
>
> (self app costumeOf: item) morph comeToFront
>
> Best
>
> Dr. Geo -- http://drgeo.eu
>
> ----- Rafael Luque <rafael.luque.leiva@gmail.com> a écrit :
> > I've managed to open an sketch with an astrophoto with the following code
> > in a Playground:
> >
> > | sketch imageMorph bitmapItem |
> > sketch := DrGeoSketch new.
> > imageMorph := (Form fromFileNamed: 'sun5.jpg') asMorph.
> > bitmapItem := (DrGBitmapItem newWith: {(Point x: 0 y: 0)})
> >     data: (DrGSurfacePaintResource
> >         forSurfaceProvider: sketch view area
> >         withData: imageMorph);
> >     insertAtScale: 1.
> > sketch domain createFromMathItem: bitmapItem.
> >
> > To give some context, my intention is to locate the Sun's center given 3
> > points in the limb (the edge of the Sun's disk) interactively placed by
> the
> > user and apply a Smalltalk script to show an Earth image appropriately
> > scaled.
> >
> > For the script showing as result a bitmap I'm using the following
> "compute"
> > method:
> >
> > compute
> > | item width result |
> > width := self arg1 valueItem * 2.
> > self app costumes
> >     detect: [ :aCostume | aCostume mathItem name = 'ScaledEarth' ]
> >     ifFound: [ :aCostume | self app domain deleteMathItem: aCostume
> > mathItem. ].
> > item :=
> >     (DrGBitmapItem newWith: { self arg1 position + (80@7) })
> >         data: (DrGSurfacePaintResource
> >             forSurfaceProvider: self costume drawable
> >             withData: (self earthForm scaledToSize: width@width));
> >         insertAtScale: 1;
> >         name: 'ScaledEarth'.
> > self app domain createFromMathItem: item.
> > ^ 'Scaled Earth (', width asString, ' px)'
> >
> > I'm getting an acceptable result like the attached image.
> >
> > One pending issue is that I'd like to move the Earth image over the Sun's
> > one, however it is hidden below it. I don't know how to control a kind of
> > z-order for the DrGBitmapItem objects.
> >
> > Thank you.
> >
> >
> >
> >
> >
> > El vie, 29 oct 2021 a las 18:48, Hilaire Fernandes (<hilaire@drgeo.eu>)
> > escribió:
> > >
> > > Rafael,
> > >
> > > Beware I am porting DrGeo to Cuis Smalltalk and I will abandon Pharo.
> > >
> > > So Cuis-Smalltalk is where new work is done. If you want to jump in, I
> > will tell you more details.
> > >
> > > Of course, it is perfectly ok to work on the Pharo version to add the
> > feature you want. But I will very likely not work anymore on the Pharo
> > version. you just need to know it.
> > >
> > > Best
> > >
> > > Le 29/10/2021 à 12:19, Rafael Luque a écrit :
> > >
> > > Thank you, Hilaire.
> > >
> > > I'm going to read the code to try to include the bitmap element
> > programmatically.
> > >
> > > Thank you for your help.
> > >
> > > --
> > > GNU Dr. Geo
> > > http://drgeo.eu
> > > http://blog.drgeo.eu
> >
> > >
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]