Hi,

  I downloaded Mirone standalone to take a look and I see what you mean.
But I prefer a non auto-resize window.

  Did you notice that in the last IUP version the IupPlot control can
display an image on the background (referenced by the plot coordinates)?
And you can use the plot callbacks to draw overlays on the image. Bu I
don't know what is simpler to use plot or to implement your own canvas.

Best,
Scuri


On Mon, Mar 23, 2015 at 9:17 PM, Joaquim Luis <[email protected]> wrote:

>  On Mon, 23 Mar 2015 23:47:00 -0000, Antonio Scuri <
> [email protected]> wrote:
>
> The image displayed as its complement is related to:
> cdCanvasWriteMode(handles.cd_canvas, IUP_CD.CD_NOT_XOR)
> Probably there is a case where it missed the reset to normal, which
> actually I just did not find in your code.
>
>
> Thanks for hint (and for looking). I'll tackle this when the sizing issue
> is solved but noticed that the complement only happens after an
> indeterminate number of window resizings with the mouse drag.
>
>
> This:
> IupSetAttributes(IupFill(),"SIZE=5, EXPAND=NO"),
> Can be reduced to:
> IupSetAttributes(IupFill(),"SIZE=5"),
> Because setting the size of a IupFill already has that effect. It is a
> special control with a different behavior for size.
>
>
> Ok, (I must have copied it from somewhere else).
>
>
> I wouldn't recommend setting the size of the canvas inside it own action
> callback. This could cause an infinite loop. You could load the image, only
> once, some where else, then set the size and only redraw the image on the
> action callback. im_view actually does exactly that, except for the size.
>
>
> I tried to use im_view as a guide but I couldn't find out where it sets
> the window size so I came out with this solution. ... and as I referred
> before, not easy do learn IUP without dedicated tutorials. I'll try to do
> it the way you say.
>
> Also changing the size of the dialog every time you load a new image can
> have a very unpleasant effect on screen. Sometimes it is simpler to load
> the image and redraw in the space you have available. But this is up to you.
>
>
> I'm trying to reproduce the Mirone behavior where that actually works
> nicely (or so I think).
>
>
> Best,
> Scuri
>
>
>
>
> Best,
> Scuri
>
>
>
>
> On Mon, Mar 23, 2015 at 8:01 PM, Joaquim Luis <[email protected]> wrote:
>
>> I think I have no EXPAND set to YES. The code, that  crafted after seeing
>> for example the im_view example starts in
>>
>> https://github.com/joa-quim/IUP.jl/blob/master/examples/mirone_toy_.jl#L40
>>
>> later down, in function
>>
>>
>> https://github.com/joa-quim/IUP.jl/blob/master/examples/mirone_toy_.jl#L301
>>
>> if I uncomment the line with
>>
>> IupSetAttribute(handles.figure1, "RASTERSIZE", C_NULL)
>>
>> than, not even it doesn't do any better as I can't even rescale the
>> window to a size larger than the loaded image.
>> There are a lot of other strange things that happen (like a random
>> conversion of the displayed image to its complement) that are difficult to
>> explain in a mail.
>>
>>
>>
>>   For instance, if it has the EXPAND attribute set to Yes. Or if the
>> dialog has a MINSIZE attribute set.
>>
>>   If you are not using EXPAND, or any other restriction on the dialog,
>> then setting size/rastersize should work.
>>
>>   It also depends if you set the size before or after the dialog is shown.
>>
>>   So assuming that your dialog is resizeable, and EXPAND is not set, nor
>> there is no restrictions. Doing:
>>
>> IupSetStrAttribute(iup_canvas, "RASTERSIZE", t);  // notice that I used
>> "Str" since the t string is not static
>> IupRefresh(iup_canvas);
>>
>>   Should resize the canvas, although it will not resize the dialog. So it
>> can also resize the dialog, you should do:
>>
>> IupSetStrAttribute(iup_canvas, "RASTERSIZE", t);  // notice that I used
>> "Str" since the t string is not static
>> IupSetAttribute(iup_dialog, "RASTERSIZE", NULL) ;
>> IupRefresh(iup_canvas);
>>
>> Best,
>> Scuri
>>
>>
>>
>> On Mon, Mar 23, 2015 at 5:29 PM, Joaquim Luis <[email protected]> wrote:
>>
>>> OK, I added a IupRefresh call but made no difference.
>>> But if setting a control size depends on the control configuration how
>>> can I set the size that I want?
>>> In this case it refers to setting the control with the size of an image
>>> being displayed on it.
>>>
>>> Thanks
>>>
>>> Joaquim
>>>
>>>
>>>   Hi,
>>>
>>>   Notice that set and get the RASTERSIZE of a control in IUP does
>>> necessarily returns the same result. Depends a lot on the dialog and the
>>> control configuration.
>>>
>>>   If the dialog is already visible, then after setting the size you
>>> should call IupRefresh so the dialog layout can be updated with the new
>>> size.
>>>
>>> Best,
>>> Scuri
>>>
>>>
>>> On Sat, Mar 21, 2015 at 8:49 PM, Joaquim Luis <[email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> I want to resize the figure window to the size of an image being
>>>> displayed
>>>> (not bigger than the screen ofc) but having (bad) surprises because I
>>>> get
>>>> something else than required.
>>>>
>>>> For example, this piece of code clearly shows that the size requested is
>>>> not being respected.
>>>> This is Julia code but understandable, I think
>>>>
>>>> t = @sprintf("%dx%d", img.width, img.height)
>>>> @show(t)
>>>> IupSetAttribute(iup_canvas, "RASTERSIZE", t)
>>>> @show(bytestring(IupGetAttribute(iup_canvas, "RASTERSIZE")))
>>>>
>>>> and the display is
>>>>
>>>> t = "430x300"
>>>> bytestring(IupGetAttribute(iup_canvas,"RASTERSIZE")) = "414x168"
>>>>
>>>>
>>>> Joaquim
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Dive into the World of Parallel Programming The Go Parallel Website,
>>>> sponsored
>>>> by Intel and developed in partnership with Slashdot Media, is your hub
>>>> for all
>>>> things parallel software development, from weekly thought leadership
>>>> blogs to
>>>> news, videos, case studies, tutorials and more. Take a look and join the
>>>> conversation now. http://goparallel.sourceforge.net/
>>>> _______________________________________________
>>>> Iup-users mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
>
>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to