WideStudio Programming Guide

| WideStudio Programming Guide | WideStudio Index Table of contents

> ## The drawing area

> ### How to draw pictures on the drawing area

> It it possible to draw pictures freely by the drawing area. It has the methods to draw various pictures which can be used on the event procedure with exposure event WSEV_EXPOSE. The following program shows a basic method to draw pictures by the drawing area.

>     #----------------------------------------------------------
>     #Function for the event procedure
>     #----------------------------------------------------------
>     use mpfc;

>     sub drawep {
>       my ($object) = @_
>       $object->setForeColor("#ff0000"); #(A)
>       $object->drawLine(0,0,100,100);   #(B)
>       return;
>     }
>     1;

> It is the sample to set the color to the drawing area which is used to the other methods for drawing pictures (A). At (B),draws the line from (0,0) to (100,100).
> The drawing area class has the following methods.
> - The rectangle and the filled rectangle
> - The circle,filled circle,arc,chord,oval.
> - The polygon,filled polygon.
> - The string.
> - The image of JPG,BMP.

> ### How to draw images(JPG,BMP) on the drawing area

> It is possible to draw images of JPG,BMP by the method: drawImage(), drawStretchedImage(). The method: drawImage() draws the image as is, and the method: drawStretchedImage() draws the image as specified size.

>     #----------------------------------------------------------
>     #Function for the event procedure
>     #----------------------------------------------------------
>     use mpfc;

>     sub drawep {
>       my ($object) = @_;
>       $w = $object->getProperty("width");
>       $h = $object->getProperty("height");
>       $object->drawStretchedImage(0,0,$w->getLong(),$h->getLong(),"001.jpg");  #(A)
>       return;
>     }
>     1;

> At (A), draws the image by size as same as the drawing area.

Document Release 3.70 for WideStudio ver 3.70, Feb 2004

WideStudio documents index | Table of contents

Copyright(C) T. Hirabayashi, 2000-2004 | Last modified: Feb 25, 2004