[Gambas-user] an "Is this possible question" about images

Shane Powell shanep at ...2481...
Sun Apr 17 02:16:52 CEST 2011


On 16/04/11 21:38, richard terry wrote:
> On Saturday 16 April 2011 20:32:22 Shane Powell wrote:
> Hi Shane,
>
> I''ve re-arranged the screen from 0.0.3 to show you what happens when  you
> have a (roughly) proportional picture.
>
> If you leave the drawing code as is in DrawingArea1_Draw() you'll see what I
> mean about the area under the mouse cursor point not being translated into the
> viewing window. I've set it back to the shoulder Xray which is tiny.
>
> I wondered if there was a logical relationship then, between the mouse cursor
> using this drawing method and what to show.
>
> Regards
>
> Richard
>
>> On 16/04/11 15:27, richard terry wrote:
>>> On Saturday 16 April 2011 10:29:15 Shane Powell wrote:
>>>
>>> Hi Shane,
>>>
>>> I had an 11MB picture I wanted to magnify (I'll send you an image of this
>>> off list), with your last code iteration only part of the image was
>>> shown, so I changed the code in the drawingarea1_draw, to make the whole
>>> image show.
>>>
>>> However now, the mouse pointer dosn't show what's under it.
>>>
>>> ?? fixable??
>>>
>>> I'll send make the picture where the mouse was so that you can see what
>>> the mouse was actually pointing at and what showed in the magnified area.
>>>
>>> Otherwise, the prototype looks good. We should buff it up and put it into
>>> the gambas examples!
>>>
>>> Regards
>>>
>>> richard
>>>
>>>> On 16/04/11 08:53, richard terry wrote:
>>>>> On Saturday 16 April 2011 00:23:47 Shane Powell wrote:
>>>>>
>>>>> Thanks heaps to shane, Caveat and all - I'll try a look at all this
>>>>> today and report back.
>>>>>
>>>>> Regards
>>>>>
>>>>> Richard
>>>>>
>>>>>> On 15/04/11 22:58, richard terry wrote:
>>>>>>> On Friday 15 April 2011 17:02:25 richard terry wrote:
>>>>>>> Hi Kevin/List,
>>>>>>>
>>>>>>> I took at quick look at this, but my lame brain never functions with
>>>>>>> basic mathematical problems, I enclose an embryonic code.
>>>>>>>
>>>>>>> This 'sort of' works, theres a drawing area into which I loaded the
>>>>>>> image of a shoulder Xray and then another  on top which will be the
>>>>>>> magnifier. I put a couple of textboxes on it to change some of the
>>>>>>> internal values, but can't seem to figure out the magnification
>>>>>>> factors.
>>>>>>>
>>>>>>> If I click over this it does move around and magnify, albeit not
>>>>>>> lined up properly and sometimes it seems to get lost. It would be
>>>>>>> nice to have this be say a circle, with a border, and be accurate,
>>>>>>> maybe someone can modfy the code to make it work.
>>>>>>>
>>>>>>> Any help appreciated.
>>>>>>>
>>>>>>>> On Friday 15 April 2011 16:15:13 Kevin Fishburne wrote:
>>>>>>>> Thanks, and to  Rolf-Werner Eilert's reply, I'll take a look at
>>>>>>>> these suggestions when I go home.
>>>>>>>>
>>>>>>>> I need a little 'side project' to stave off the bordum of the
>>>>>>>> hum-drum debugging of the main project.
>>>>>>>>
>>>>>>>> Will post back my  sucess or lack therof
>>>>>>>>
>>>>>>>> Regards
>>>>>>>>
>>>>>>>> Richard
>>>>>>>>
>>>>>>>>> On 04/15/2011 12:47 AM, richard terry wrote:
>>>>>>>>>>> Do you need it to look like a fisheye-style lens effect, or just
>>>>>>>>>>> box-zoom an area? If the latter this can be done easily in gb
>>>>>>>>>>> code.
>>>>>>>>>> Just the box-zoom .
>>>>>>>>>>
>>>>>>>>>> Any change of you giving me a helping hand? I've not done anything
>>>>>>>>>> much with images or drawing.
>>>>>>>>>>
>>>>>>>>>> I'll mail you a sample png if you want - the purpose here is to
>>>>>>>>>> magnify areas of either skin, xray films or dermatascope images -
>>>>>>>>>> all are images at the end of the day.
>>>>>>>>>>
>>>>>>>>>> Its for our open - source medical records project that Ian and I
>>>>>>>>>> are chuggling slowly along with - not releasable as yet by I'm
>>>>>>>>>> hoping that by the end of 2011 it will be pretty much beta.
>>>>>>>>> That is very cool. I'm doing a game so I know a little about images
>>>>>>>>> in gb.
>>>>>>>>>
>>>>>>>>> I'm going to assume that you're using Qt or GTK and not SDL or
>>>>>>>>> OpenGL, but correct me if I'm wrong. For those the easiest way to
>>>>>>>>> do graphics is with a DrawingArea control. After creating it on the
>>>>>>>>> form I'd change the Cached property to True so it will
>>>>>>>>> automatically redraw itself if something moves over it.
>>>>>>>>>
>>>>>>>>> You create image variables and load image files into them like
>>>>>>>>> this:
>>>>>>>>>
>>>>>>>>> Dim/Public someimage As Image
>>>>>>>>> someimage = Image.Load("FleshEatingVirusNooooo.jpg")
>>>>>>>>>
>>>>>>>>> You write images to the DrawingArea control like this:
>>>>>>>>>
>>>>>>>>> Draw.Begin(DrawingArea1)
>>>>>>>>>        Draw.Image(someimage, X, Y, [Width, Height, SrcX, SrcY,
>>>>>>>>> SrcWidth, SrcHeight])
>>>>>>>>>        ' Add more "Draw.Image" statements here to composite
>>>>>>>>> additional images into the DrawingArea.
>>>>>>>>> Draw.End ' Commits the composition to the DrawingArea so that it
>>>>>>>>> may be seen. May need a "Wait" statement if done repeatedly.
>>>>>>>>>
>>>>>>>>> The [bracketed] parameters are optional. someimage is the source
>>>>>>>>> and the DrawingArea is the target. You can specify a subset of the
>>>>>>>>> source (the area to be zoomed) by playing with SrcX and SrcY
>>>>>>>>> (upper-left corner of source to be drawn) and SrcWidth and
>>>>>>>>> SrcHeight (width and height relative to SrcX and SrcY of source to
>>>>>>>>> be drawn). You can scale the source by playing with Width and
>>>>>>>>> Height.
>>>>>>>>>
>>>>>>>>> So that the source image writes to the DrawingArea don't leave a
>>>>>>>>> trail, I'd first draw the main (unzoomed) image to the DrawingArea,
>>>>>>>>> then draw the zoomed area onto that for each "frame" that you draw.
>>>>>>>>> The logic would go something like:
>>>>>>>>>
>>>>>>>>> ' Create your image variables.
>>>>>>>>> ' Load images into your image variables.
>>>>>>>>> Draw.Begin(DrawingAreaControlName)
>>>>>>>>> ' Draw the main image into the DrawingArea.
>>>>>>>>> ' Draw part of the main image into the DrawingArea adjusted by
>>>>>>>>> cursor position, zoom area size and zoom level.
>>>>>>>>> ' Draw text or whatever else you need to into the DrawingArea.
>>>>>>>>> Draw.End
>>>>>>>>>
>>>>>>>>> To draw text, which is really cool, you may do something like this
>>>>>>>>> inside the Draw.Begin/End:
>>>>>>>>>
>>>>>>>>> Draw.Foreground = Color.Black
>>>>>>>>> Draw.Text("Look, it's text on an image with a crappy shadow!!!", X,
>>>>>>>>> Y) Draw.Foreground = Color.White
>>>>>>>>> Draw.Text("Look, it's text on an image with a crappy shadow!!!", X
>>>>>>>>> + 1, Y - 1)
>>>>>>>>>
>>>>>>>>> I don't have any project examples that are simple enough to
>>>>>>>>> demonstrate this, but if you're really having trouble I could put
>>>>>>>>> something together.
>>>>>>>> --------------------------------------------------------------------
>>>>>>>> -- -- --- --- Benefiting from Server Virtualization: Beyond Initial
>>>>>>>> Workload Consolidation -- Increasing the use of server
>>>>>>>> virtualization is a top priority.Virtualization can reduce costs,
>>>>>>>> simplify management, and improve application availability and
>>>>>>>> disaster protection. Learn more about boosting the value of server
>>>>>>>> virtualization.
>>>>>>>> http://p.sf.net/sfu/vmware-sfdev2dev
>>>>>>>> _______________________________________________
>>>>>>>> Gambas-user mailing list
>>>>>>>> Gambas-user at lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------
>>>>>>>> -- -- ------ Benefiting from Server Virtualization: Beyond Initial
>>>>>>>> Workload Consolidation -- Increasing the use of server
>>>>>>>> virtualization is a top priority.Virtualization can reduce costs,
>>>>>>>> simplify management, and improve application availability and
>>>>>>>> disaster protection. Learn more about boosting the value of server
>>>>>>>> virtualization.
>>>>>>>> http://p.sf.net/sfu/vmware-sfdev2dev
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Gambas-user mailing list
>>>>>>>> Gambas-user at lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>>>> this is how i would do it when the mouse cursor get to the right  or
>>>>>> the bottom of the image it starts to strech but you could just limit
>>>>>> the mouse travel and the rest you could make how you wanted easy i
>>>>>> think hope it helps
>>>>> -----------------------------------------------------------------------
>>>>> -- ----- Benefiting from Server Virtualization: Beyond Initial Workload
>>>>> Consolidation -- Increasing the use of server virtualization is a top
>>>>> priority.Virtualization can reduce costs, simplify management, and
>>>>> improve application availability and disaster protection. Learn more
>>>>> about boosting the value of server virtualization.
>>>>> http://p.sf.net/sfu/vmware-sfdev2dev
>>>>> _______________________________________________
>>>>> Gambas-user mailing list
>>>>> Gambas-user at lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>> just some more tinkering
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>> ------ Benefiting from Server Virtualization: Beyond Initial Workload
>>>> Consolidation -- Increasing the use of server virtualization is a top
>>>> priority.Virtualization can reduce costs, simplify management, and
>>>> improve application availability and disaster protection. Learn more
>>>> about boosting the value of server virtualization.
>>>> http://p.sf.net/sfu/vmware-sfdev2dev
>>>>
>>>>
>>>> _______________________________________________
>>>> Gambas-user mailing list
>>>> Gambas-user at lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>> hi richard try this
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Benefiting from Server Virtualization: Beyond Initial Workload
>> Consolidation -- Increasing the use of server virtualization is a top
>> priority.Virtualization can reduce costs, simplify management, and improve
>> application availability and disaster protection. Learn more about boosting
>> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
>>
>>
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
ok i see what you mean The reason for this is the magnifying code works 
with the original picture loaded but when you load the main picture it 
has been scaled up to fit the drawing area or in some case maybe scaled 
down and possibly not keeping the aspect ratio. to my mind showing the 
picture at it original size and then magnifying a small area would be 
the way to but if not you just need to work with the picture in the 
drawingarea. also if this is the case why not just scale the whole 
picture up and down ?




More information about the User mailing list