 | | Wide Studio Object Reference
| |
Class Name
WSCvdrawingArea
Specification of methods
setForeColor method
- Form
- long setForeColor(char* cname)
- Function
- This method sets the foreground color
by the specified color name.
- Description
- This method gets the color from the fore color name, and
sets it to the internal graphic context.
- Parameters
-
(in)char* cname | the color name |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
- The color name is a format as following.
#RRGGBB
RR: 00 - ff: Brightness of red.
RR: 00 - ff: Brightness of green.
RR: 00 - ff: Brightness of blue.
- Samples
-
#include <WSCvdrawingArea.h>
void sample_proc(WSCbase* object){
WSCvdrawingArea* drawing_a =(WSCvdrawingArea*)object->cast("WSCvdrawingArea");
if (drawing_a == NULL){
return;
}
//draw a rectangle with color #ffff00 (yellow)
drawing_a->setForeColor("#ffff00");
drawing_a->drawRect(150,50,100,100);
//draw a filled rectangle with color #00ff00 (green)
drawing_a->setForeColor("#00ff00");
drawing_a->drawFillRect(20,100,50,50);
//draw an arc with color #0000ff (blue)
drawing_a->setForeColor("#0000ff");
drawing_a->drawArc(50,200,50,50,60*64,270*64);
//draw a filled pie with hatch pattern and color #ff00ff (magenta)
drawing_a->setForeColor("#ff00ff");
drawing_a->setHatchPattern(7);
drawing_a->drawFillArc(150,200,100,50,60*64,270*64, 0 /*PIE*/ );
//draw a filled chord with hatch pattern and color #ff00ff (magenta)
drawing_a->setForeColor("#ff00ff");
drawing_a->setHatchPattern(6);
drawing_a->drawFillArc(250,200,100,50,60*64,270*64, 1 /*CHORD*/ );
//draw a polygon
WSCpoint pt[3];
pt[0].x = 300;
pt[0].y = 300;
pt[1].x = 330;
pt[1].y = 330;
pt[2].x = 300;
pt[2].y = 330;
drawing_a->setForeColor("#00ffff");
drawing_a->setHatchPattern(0);
drawing_a->drawFillPoly(pt,3);
//draw a line.
drawing_a->setForeColor("#ff0000");
drawing_a->setLineWidth(2); //line width 2 dots.
drawing_a->setLineType(1); //
drawing_a->drawLine(50,50,100,100);
//draw a text.
drawing_a->setForeColor("#000000");
drawing_a->drawString(100,300,100,30,0,WS_CENTER,"ABCDE1234");
//draw a filled text
drawing_a->setBackColor("#808080");
drawing_a->drawFillString(100,330,100,30,0,WS_CENTER,"ABCDE1234");
//draw a line with region.
drawing_a->setRegion(70,70,80,80);
drawing_a->drawLine(50,50,100,100); //draw 70,70 - 80,80
}
setBackColor method
- Form
- long setBacKColor(char* cname)
- Function
- This method sets the background color
by the specified color name.
- Description
- This method gets the color from the fore color name, and
sets it to the internal graphic context.
- Parameters
-
(in)char* cname | the color name |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
- The color name is a format of the following.
#RRGGBB
RR: 00 - ff: Brightness of red.
RR: 00 - ff: Brightness of green.
RR: 00 - ff: Brightness of blue.
- Samples
- Refer to setForeColor()
setLineWidth method
- Form
- long setLineWidth(short linewidth)
- Function
- This method sets the line width.
- Description
- This method sets the line width that is used
by the drawLine method to draw it.
- Parameters
-
(in)short linewidth | the line width |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
- None.
- Samples
- Refer to setForeColor()
setLineDashType method
- Form
- long setLineDashType(char no)
- Function
- This method sets the dash type of the line.
- Description
- This method sets the dash type of the line that is used
by the drawLine method to draw it.
- Parameters
-
(in)char no | The dash type No. |
The following values are available.
The dash type No. | Description |
0 | Sound |
1 | Dashed |
2 | Double Dashed |
3 | Double Dashed2 |
4 | Double Dashed3 |
5 | Double Dashed4 |
6 | Double Dashed5 |
7 | Double Dashed6 |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
- Refer to setForeColor()
setHatchPattern method
- Form
- long setHatchPattern(char no)
- Function
- This method sets the hatch pattern which is used by
drawFillxxx method.
- Description
- This method sets the hatch pattern to the internal
graphic context.
- Parameters
-
(in)char no | The hatch pattern No. |
The following values are available.
The hatch pattern No. | Description |
0 | Plane |
1 | Oblique lines1 |
2 | Oblique lines2 |
3 | Vert. lines |
4 | Horiz. lines |
5 | Oblique closs |
6 | Lattice |
7 | Dots |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Samples
- Refer to setForeColor()
- Notice
-
setRegion method
- Form
- long setRegion(short x,short y,unsigned short w,unsigned short h);
- Function
- This method limits the area for painting.
- Description
- Drawing outside of the specified area has no effect.
- Parameters
-
(in)short x | x of the left top |
(in)short y | y of the left top |
(in)unsigned short w | the width |
(in)unsigned short h | the height |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
- Refer to setForeColor()
drawArc method
- Form
- long drawArc(short x,short y,unsigned short w,
unsigned short h,short a1,short a2);
- Function
- Draws an arc,circle,oval.
- Description
- Specify the width and heigth of the circle or oval,
and the left-handed start angle
from the horizontally right direction, and the stop angle.
It is important to set a value which is the number of degrees multipled by 64.
For example, to draw a circle, one would set 0 to the start angle, and
360*64 for the stop angle.
- Parameters
-
(in)short x | The X coordinate of the top left |
(in)short y | The Y coordinate of the top left |
(in)unsigned short w | The width |
(in)unsigned short h | The height |
(in)short a1 | The start angle |
(in)short a2 | The stop angle |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
- Refer to setForeColor()
drawFillArc method
- Form
- long drawFillArc(short x, short y, unsigned short w,
unsigned short h, short a1, short a2, char kind);
- Function
- Draws a filled arc (pie, chord), filled circle, filled oval.
- Description
- Specify the width and heigth of the circle or oval,
and the counterclockwise start angle
from the horizontally right direction and the stop angle.
It is important to set value which is the number of degrees multipled by 64.
For example, to draw a circle, you can set 0 as the start angle, and
360*64 as the stop angle.
- Parameters
-
(in)short x | The X coordinate of the top left |
(in)short y | The Y coordinate of the top left |
(in)unsigned short w | The width |
(in)unsigned short h | The height |
(in)short a1 | The start angle |
(in)short a2 | The stop angle |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
- Refer to setForeColor()
drawLine method
- Form
- long drawLine(short x1,short y1,short x2,short y2);
- Function
- Draws a line.
- Description
- Draws a line from (x1, y1) to (x2, y2).
- Parameters
-
(in)short x1 | The X coordinate of start point |
(in)short y1 | The Y coordinate of start point |
(in)short x2 | The X coordinate of end point |
(in)short y2 | The Y coordinate of end point |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
- Refer to setForeColor()
drawLines method
- Form
- long drawLines(WSCpoint* pt,long num);
- Function
- Draws a poly-line.
- Description
- Draws a poly-line from (x1, y1) to (Xn, Yn).
- Parameters
-
(in)WSCpoint* pt | The array of the point |
(in)long num | The number of points |
WSCpoint struct has two member:(x, y).
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
WSCpoint pt[3];
pt[0].x = 300;
pt[0].y = 300;
pt[1].x = 330;
pt[1].y = 330;
pt[2].x = 300;
pt[2].y = 330;
drawing_a->setForeColor("#00ffff");
drawing_a->drawLines(pt,3);
drawRect method
- Form
- long drawRect(short x, short y, unsigned short w, unsigned short h);
- Function
- Draws a rectangle.
- Description
- Draws a rectanble with the top-left point (x, y)
and the width: w, the height: h.
- Parameters
-
(in)short x | The X coordinate |
(in)short y | The Y coordinate |
(in)unsigned short x | The width |
(in)unsigned short y | The height |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
- Refer to setForeColor()
drawFillRect method
- Form
- long drawFillRect(short x,short y,unsigned short w,unsigned short h);
- Function
- Draws a filled rectangle.
- Description
- Draws a filled rectanble with the top-left point(x,y)
and the width: w, the height: h.
- Parameters
-
(in)short x | The X coordinate |
(in)short y | The Y coordinate |
(in)unsigned short x | The width |
(in)unsigned short y | The height |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
- Refer to setForeColor()
drawRects method
- Form
- long drawRects(WSCrect* pt,long num);
- Function
- Draws rectangles.
- Description
- Draws rectanbles with WSCrect array.
- Parameters
-
(in)WSCrect* rect | The array of WSCrect |
(in)long num | The number of rectangles |
WSCrect struct has four members: (x, y, width, height).
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
-
WSCrect rect[3];
rect[0].setRect(300,300,10,10);
rect[1].setRect(320,300,10,10);
rect[2].setRect(340,300,10,10);
drawing_a->setForeColor("#00ffff");
drawing_a->drawRects(rect,3);
drawFillRects method
- Form
- long drawFillRects(WSCrect* pt,long num);
- Function
- Draws filled rectangles.
- Description
- Draws filled rectanbles with WSCrect array.
- Parameters
-
(in)WSCrect* rect | The array of WSCrect |
(in)long num | The number of rectangles |
WSCrect struct has four members: (x, y, width, height).
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
-
WSCrect rect[3];
rect[0].setRect(300,300,10,10);
rect[1].setRect(320,300,10,10);
rect[2].setRect(340,300,10,10);
drawing_a->setForeColor("#00ffff");
drawing_a->drawFillRects(rect,3);
drawPoly method
- Form
- long drawPoly(WSCpoint* pt,long num);
- Function
- Draw a polygon.
- Description
- Draw a polygon with specified points.
- Parameters
-
(in)WSCpoint* pt | The points |
(in)long num | The number of the points |
WSCpoint struct has two member: (x, y).
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
-
WSCpoint pt[3];
pt[0].x = 300;
pt[0].y = 300;
pt[1].x = 330;
pt[1].y = 330;
pt[2].x = 300;
pt[2].y = 330;
drawing_a->setForeColor("#00ffff");
drawing_a->drawPoly(pt,3);
drawFillPoly method
- Form
- long drawFillPoly(WSCpoint* pt,long num);
- Function
- Draw a filled polygon.
- Description
- Draw a filled polygon with specified points.
- Parameters
-
(in)WSCpoint* pt | The points |
(in)long num | The number of points |
WSCpoint struct has two members: (x, y).
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
- Refer to setForeColor().
drawGradation method
- Form
- long drawGradation(long type, short col1, short col2,
short col3, short x, short y, WSCushort w, WSCushort h,
WSCuchar grad_margin);
- Function
- Draws a rectangle with gradated color.
- Description
- Draws a rectangle with gradated color from col1 to col2,
and from col2 to col3.
- Parameters
-
(in)long type | The type of gradation |
(in)short col1 | Color1 |
(in)short col2 | Color2 |
(in)short col3 | Color3 |
(in)short x | The X coordinate of top-left |
(in)short y | The Y coordinate of top-left |
(in)WSCushort w | The width |
(in)WSCushort h | The height |
(in)WSCuchar grad_margin | The width of pure color2 |
The following values are available
for the gradation type.
The gradation type | Description |
WS_GR_LT_RB | Left-top to Right-bottom |
WS_GR_RT_LB | Right-top to Left-bottom |
WS_GR_LB_RT | Left-bottom to Right-top |
WS_GR_RB_LT | Right-bottom to Left-top |
WS_GR_T_B | Top to Bottom |
WS_GR_B_T | Bottom to Top |
WS_GR_L_R | Left to Right |
WS_GR_R_L | Right to Left |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
-
short cno1 = WSGIappColorSet()->getColorNo("#888888");
short cno2 = WSGIappColorSet()->getColorNo("#aaaaaa");
short cno3 = WSGIappColorSet()->getColorNo("#000000");
drawing_a->drawGradation(WS_GR_T_B,cno1,cno2,cno3,10,10,100,50,10);
drawImage method
- Form
- long drawImage(short x,short y,WSCushort w,WSCushort h,
WSDimage* img,char align);
- Function
- Draws an image.
- Description
- Draws the specified image on the specified area.
- Parameters
-
(in)short x | The X coordinate |
(in)short y | The Y coordinate |
(in)WSCushort w | The width |
(in)WSCushort h | The height |
(in)WSDimage* img | The image |
(in)char align | The alignment of the image |
The following values are available
for the alignment.
The alignment | Description |
WS_LEFT | Left |
WS_RIGHT | Right |
WS_CENTER | Center |
WS_TOP | Top |
WS_BOTTOM | Bottom |
WS_LEFT_TOP | LeftTop |
WS_LEFT_BOTTOM | LeftBottom |
WS_RIGHT_BOTTOM | RightBottom |
WS_RIGHT_TOP | RightTop |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
-
WSCimage* image = WSGIappImageSet()->getImage("001.jpg");
drawing_a->drawImage(10,10,100,100,image,WS_CENTER);
drawStretchedImage method
- Form
- long drawStretchedImage(short x,short y,
WSCushort w,WSCushort h, WSDimage* img);
- Function
- Draws a stretched image.
- Description
- Draws the specified image
adjusted into the specified rectangle.
- Parameters
-
(in)short x | The X coordinate |
(in)short y | The Y coordinate |
(in)WSCushort w | The width |
(in)WSCushort h | The height |
(in)WSDimage* img | The image |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
-
WSCimage* image = WSGIappImageSet()->getImage("001.jpg");
drawing_a->drawStretchedImage(10,10,100,100,image);
drawString method
- Form
- long drawString(short x,short y,WSCushort w,WSCushort h,
char font_no,char align,char* string,
long encoding = WS_EN_DEFAULT);
- Function
- Draws the specified string in the specified area.
- Description
- Draws the specified string by the specified encoding
in the specified area.
- Parameters
-
(in)short x | The X coordinate |
(in)short x | The Y coordinate |
(in)WSCushort w | The width |
(in)WSCushort h | The height |
(in)char font_no | The font number |
(in)char align | The alignment |
(in)char* string | The string |
(in)long encoding | The encoding |
Specify the font number from 0 to 7.
The following values are available
for alignment.
The alignment | Description |
WS_LEFT | Left |
WS_RIGHT | Right |
WS_CENTER | Center |
WS_TOP | Top |
WS_BOTTOM | Bottom |
WS_LEFT_TOP | LeftTop |
WS_LEFT_BOTTOM | LeftBottom |
WS_RIGHT_BOTTOM | RightBottom |
WS_RIGHT_TOP | RightTop |
The following values are available
for encoding.
If it is omitted, it is treated as though
WS_EN_DEFAULT is specified.
The encoding | Description |
WS_EN_DEFAULT | Project defaults |
WS_EN_LOCALE | The LANG environment value |
WS_EN_NONE | None. |
WS_EN_ISO8859_1 | ISO8859(1) |
WS_EN_ISO8859_2 | ISO8859(2) |
WS_EN_ISO8859_3 | ISO8859(3) |
WS_EN_ISO8859_4 | ISO8859(4) |
WS_EN_ISO8859_5 | ISO8859(5) |
WS_EN_ISO8859_6 | ISO8859(6) |
WS_EN_ISO8859_7 | ISO8859(7) |
WS_EN_ISO8859_8 | ISO8859(8) |
WS_EN_ISO8859_9 | ISO8859(9) |
WS_EN_ISO8859_10 | ISO8859(10) |
WS_EN_ISO8859_11 | ISO8859(11) |
WS_EN_ISO8859_12 | ISO8859(12) |
WS_EN_ISO8859_13 | ISO8859(13) |
WS_EN_ISO8859_14 | ISO8859(14) |
WS_EN_ISO8859_15 | ISO8859(15) |
WS_EN_UTF8 | UNICODE(UTF8) |
WS_EN_KOI8R | KOI8R |
WS_EN_EUCJP | EUC(JAPANESE) |
WS_EN_SJIS | SJIS(JAPANESE) |
WS_EN_EUCKR | EUC(KOREAN) |
WS_EN_EUCCN | EUC(CHINESE) |
WS_EN_BIG5 | BIG5(CHINESE) |
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
- Refer to setForeColor().
drawFillString method
- Form
- long drawFillString(short x,short y,WSCushort w,WSCushort h,
char font_no,char align,char* string,
long encoding = WS_EN_DEFAULT);
- Function
- Draws the specified string in the specified filled rectangle.
- Description
- Draws the specified string by the specified encoding
in the specified filled rectangle.
- Parameters
-
(in)short x | The X coordinate |
(in)short x | The Y coordinate |
(in)WSCushort w | The width |
(in)WSCushort h | The height |
(in)char font_no | The font number |
(in)char align | The alignment |
(in)char* string | The string |
(in)long encoding | The encoding |
See drawString method.
- Return value
- Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
- Notice
-
- Samples
- Refer to setForeColor().
Document Release 3.20 For use with Wide Studio Release 3.20, Spring 2003 Wide Studio Home | Up to Copyright(C) T. Hirabayashi, 1999-2003 | | Last modified: February 3, 2003 | |