Re: Working with images



On 2007-05-14, angelraposo@xxxxxxxxx <angelraposo@xxxxxxxxx> wrote:
First of all, thank you for all the help you´re providing me. Acording
to scaled_bitmap library, once loaded I can use the scale, size
operations. I find it easier to use the size operation since each
image have a different resolution, so the scale will be different for
each one.

:- pce_global(@myimage, new(bitmap)).
......
:-use_module(library(scaledbitmap)).

ver:-
.....
send(@myimage, image,resource(imagenum1)),
send(@myimage, size('100','100')),

But not on an _image_. You include library(scaledbitmap) to define
class scaled_bitmap, so you better using instances of that class.

But when I try this, I complains about the size arguments. I've also
tried with no success:

send(@myimage, size(100,100)),
send(@myimage, size,100,100),
send(@myimage, size, '100' , '100'),

None of this will work. The syntax for send is either

send(Object, Selector, Arg1, Arg2, ...)
or
send(Object, Selector(Arg1, Arg2, ...))

The selector is =send=, the argument is a size-object. So it is one
of

send(Object, size, size(100, 100))
or
send(Object, size(size(100,100))).

Here is a small example putting it together:

================================================================
:- use_module(library(scaledbitmap)).

resource(clouds, image, '/opt/gnome/share/pixmaps/backgrounds/novell/Clouds.jpeg').

test :-
send(new(@p, picture('Test image scaling')), open),
send(@p, display, scaled_bitmap(resource(clouds))).

scale(W, H) :-
get(@p, member, scaled_bitmap, BM),
send(BM, size, size(W, H)).

?- test.

?- scale(100,100).
================================================================

Here is a bit more intelligent example that will allow you to resize
the window and show the image scaled to the actual window size.

================================================================
:- use_module(library(scaledbitmap)).

resource(clouds, image, '/opt/gnome/share/pixmaps/backgrounds/novell/Clouds.jpeg').

test :-
send(new(P, picture('Test image scaling')), open),
send(P, display, new(BM, scaled_bitmap(resource(clouds)))),
send(BM, keep_aspect, @off),
send(P, resize_message, message(BM, size, @arg2)).
================================================================


Cheers --- Jan
.



Relevant Pages

  • Getting the functionality of -command with tk_optionMenu (longish)
    ... I am writing a Tcl/Tk program to display a small database. ... I have a tk_optionMenu to choose the table, a scale to pick the row to ... and a text window for the display. ... label .label ...
    (comp.lang.tcl)
  • Re: Getting the functionality of -command with tk_optionMenu (longish)
    ... > display, and a text window for the display. ... > made on the optionMenu I want the scale and text to update, ... the bind commands do not get called at all. ...
    (comp.lang.tcl)
  • Re: Mike: Restating your explanation
    ... and in software scale my data to fit the physical limits of the display ... then as soon as you change the size of the object your graph ... four quadrant graph of course you usually want the opposite of that. ...
    (microsoft.public.vb.general.discussion)
  • Re: Scaling of data into dc
    ... It should scale up and down, ... why you would set the mapping mode of the memory DC to be the mapping mode of the window ... you set the Viewport extent to be the dimensions of the bitmap. ... CRect; ...
    (microsoft.public.vc.mfc)
  • Re: The Heartbreak of Resolution Independence
    ... the one I cared about the most was Resolution Independent UI; ... Win32 will scale drawing, ... It would not scale window size and position data. ...
    (comp.sys.mac.advocacy)