![]() | 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 #---------------------------------------------------------- import mwt def drawep(object): object.setForeColor("#ff0000"); #(A) object.drawLine(0,0,100,100); #(B) return mwt.WSGFfunctionRegister("drawep",drawep)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 #---------------------------------------------------------- import mwt def drawep(object): w = object.getProperty("width"); h = object.getProperty("height"); object.drawStretchedImage(0,0,w.getLong(),h.getLong(),"001.jpg"); #(A) return mwt.WSGFfunctionRegister("drawep",drawep)At (A), draws the image by size as same as the drawing area.
Copyright(C) WideStudio Development Team, 1999-2005 | Last modified: Jan 05, 2005 |