Re: Working with images
- From: Jan Wielemaker <jan@xxxxxxxxxxxxxxxxxxx>
- Date: 14 May 2007 14:13:10 GMT
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
.
- References:
- Working with images
- From: angelraposo
- Re: Working with images
- From: Jan Wielemaker
- Re: Working with images
- From: angelraposo
- Working with images
- Prev by Date: Way Prolog
- Next by Date: Re: Way Prolog
- Previous by thread: Re: Working with images
- Next by thread: segv with xcpe
- Index(es):
Relevant Pages
|
|