示例#1
0
/*
  call-seq: drawLine(x1, y1, x2, y2, col1, col2 = nil)

  Draws a line on the buffer.
*/
VALUE Painter_drawLine(int argc, VALUE *argv, VALUE self) {
   Painter &ref = getRef<Painter>(self);
   
   VALUE x1, y1, x2, y2, col1, col2;
   rb_scan_args(argc, argv, "51", &x1, &y1, &x2, &y2, &col1, &col2);
   
   if (NIL_P(col2))
      col2 = col1;

   ref.drawLine(FIX2INT(x1), FIX2INT(y1), FIX2INT(x2), FIX2INT(y2),
		hash2col(col1), hash2col(col2));
   return Qnil;
}
示例#2
0
/*
  call-seq: drawLine(x1, y1, x2, y2, color)

  Draws a line on the screen.
*/
VALUE Graphics_drawLine(VALUE self, VALUE x1, VALUE y1, VALUE x2,
                        VALUE y2, VALUE color)
{
    OSL_COLOR c = hash2col(color);
    oslDrawLine(FIX2INT(x1), FIX2INT(y1), FIX2INT(x2), FIX2INT(y2), c);
    return Qnil;
}
示例#3
0
/*
  call-seq: borderColor=(val)

  Sets the border's color.
*/
VALUE MsgConfig_setBorderColor(VALUE self, VALUE val)
{
   MsgConfig &ref = getRef<MsgConfig>(self);
   ref.borderColor = hash2col(val);

   return val;
}
示例#4
0
/*
  call-seq: setTextBackground(color)

  Sets the color in which the text's background is drawn.
*/
VALUE setTextBackground(VALUE self, VALUE color)
{
    OSL_COLOR c = hash2col(color);
    oslSetBkColor(c);

    return Qnil;
}
示例#5
0
/*
  call-seq: titleColor=(val)

  Sets the title's color.
*/
VALUE MsgConfig_setTitleColor(VALUE self, VALUE val)
{
   MsgConfig &ref = getRef<MsgConfig>(self);
   ref.titleColor = hash2col(val);

   return val;
}
示例#6
0
/*
  call-seq: drawTriangle(x1, y1, x2, y2, x3, y3, col1, col2, col3)

  Draws a triangle on the screen.
*/
VALUE Graphics_drawTriangle(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2,
                            VALUE x3, VALUE y3, VALUE col1, VALUE col2,
                            VALUE col3)
{
    int _x1 = FIX2INT(x1);
    int _x2 = FIX2INT(x2);
    int _x3 = FIX2INT(x3);

    int _y1 = FIX2INT(y1);
    int _y2 = FIX2INT(y2);
    int _y3 = FIX2INT(y3);

    OSL_COLOR _col1 = hash2col(col1);
    OSL_COLOR _col2 = hash2col(col2);
    OSL_COLOR _col3 = hash2col(col3);

    oslDrawGradientTriangle(_x1, _y1, _x2, _y2, _x3, _y3, _col1, _col2, _col3);
    return Qnil;
}
示例#7
0
/*
  call-seq: drawTriangle(x1, y1, x2, y2, x3, y3, col1, col2 = nil, col3 = nil)

  Draws a tiangle on the buffer.
*/
VALUE Painter_drawTriangle(int argc, VALUE *argv, VALUE self) {
   Painter &ref = getRef<Painter>(self);
   
   VALUE x1, y1, x2, y2, x3, y3, col1, col2, col3;
   rb_scan_args(argc, argv, "72", &x1, &y1, &x2, &y2, &x3, &y3, 
		&col1, &col2, &col3);
   
   if (NIL_P(col2))
      col2 = col1;
   if (NIL_P(col3))
      col3 = col2;

   ref.drawTriangle(FIX2INT(x1), FIX2INT(y1),
		    FIX2INT(x2), FIX2INT(y2),
		    FIX2INT(x3), FIX2INT(y3),
		    hash2col(col1), hash2col(col2), hash2col(col3));

   return Qnil;
}
示例#8
0
/*
  call-seq: drawRect(x1, y1, x2, y2, col1, col2 = nil, col3 = nil, col4 = nil)

  Draws a rect on the buffer.
*/
VALUE Painter_drawRect(int argc, VALUE *argv, VALUE self) {
   Painter &ref = getRef<Painter>(self);
   
   VALUE x1, y1, x2, y2, col;
   rb_scan_args(argc, argv, "5", &x1, &y1, &x2, &y2, &col);

   ref.drawRect(FIX2INT(x1), FIX2INT(y1), FIX2INT(x2), FIX2INT(y2),
		hash2col(col));
   return Qnil;
}
示例#9
0
/*
  call-seq: drawLine(x1, y1, x2, y2, col1, col2 = nil, col3 = nil, col4 = nil)

  Draws a filled rect on the buffer.
*/
VALUE Painter_drawFillRect(int argc, VALUE *argv, VALUE self) {
   Painter &ref = getRef<Painter>(self);
   
   VALUE x1, y1, x2, y2, col1, col2, col3, col4;
   rb_scan_args(argc, argv, "53", &x1, &y1, &x2, &y2, 
		&col1, &col2, &col3, &col4);
   
   if (NIL_P(col2))
      col2 = col1;
   if (NIL_P(col3))
      col3 = col2;
   if (NIL_P(col4))
      col4 = col3;

   ref.drawFillRect(FIX2INT(x1), FIX2INT(y1), FIX2INT(x2), FIX2INT(y2),
		    hash2col(col1), hash2col(col2), 
		    hash2col(col3), hash2col(col4));
   return Qnil;
}
示例#10
0
/*
  call-seq: drawFillCircle(x, y, radius, color)

  Draws a filled circle on the screen.
*/
VALUE Graphics_drawFillCircle(VALUE self, VALUE x, VALUE y, VALUE radius,
                              VALUE col)
{
    OSL_COLOR c = hash2col(col);
    int _x = FIX2INT(x);
    int _y = FIX2INT(y);
    int _radius = FIX2INT(radius);

    oslDrawFillCircle(_x, _y, _radius, c);
    return Qnil;
}
示例#11
0
文件: Shape.cpp 项目: Epictetus/Joyau
/*
  call-seq: setGraident(colors)

  Take an array as argument.
*/
VALUE Shape_setGradient(VALUE self, VALUE col)
{
   Shape &ref = getRef<Shape>(self);
   int size = ref.getColorsNumber();

   OSL_COLOR *args = new OSL_COLOR[size];
   for(int i = 0; i < size; ++i)
      args[i] = hash2col(rb_ary_entry(col, i));

   ref.setGradient(args);
   return col;
}
示例#12
0
文件: Shape.cpp 项目: Epictetus/Joyau
/*
  call-seq: setColor(r, g, b, a = 255)
            setColor(col)

  Sets the sahpe's color. If it has more than one color, all are set to the
  same value.
*/
VALUE Shape_setColor(int argc, VALUE *argv, VALUE self)
{
   Shape &ref = getRef<Shape>(self);
   OSL_COLOR _col = 0;
   if (argc >= 3)
   {
      int alpha = 255;
      if (argc > 3)
	 alpha = FIX2INT(argv[3]);
      _col = RGBA(FIX2INT(argv[0]), FIX2INT(argv[1]), FIX2INT(argv[2]), alpha);
   }
   else if (argc == 1)
      _col = hash2col(argv[0]);

   ref.setColor(_col);
   return Qnil;
}
示例#13
0
/*
  call-seq: [x, y] = col
    
  Sets the color of a pixel.
*/
VALUE Buffer_setPixel(VALUE self, VALUE x, VALUE y, VALUE col) {
   Buffer &ref = getRef<Buffer>(self);
   ref.setPixel(FIX2INT(x), FIX2INT(y), hash2col(col));

   return col;
}
示例#14
0
/*
  call-seq: clear(color)

  Clears the buffer in a color.
*/
VALUE Painter_clear(VALUE self, VALUE col) {
   Painter &ref = getRef<Painter>(self);
   
   ref.clear(hash2col(col));
   return Qnil;
}
示例#15
0
/*
  call-seq: drawCircle(x, y, radius, col)

  Draws a circle on the buffer.
*/
VALUE Painter_drawCircle(VALUE self, VALUE x, VALUE y, VALUE r, VALUE col) {
   Painter &ref = getRef<Painter>(self);
   
   ref.drawCircle(FIX2INT(x), FIX2INT(y), FIX2INT(r), hash2col(col));
   return Qnil;
}
示例#16
0
/*
  call-seq: setTextColor(color)

  Sets the color in which the text's color.
*/
VALUE setTextColor(VALUE self, VALUE color)
{
    OSL_COLOR c = hash2col(color);
    oslSetTextColor(c);
    return Qnil;
}
示例#17
0
/*
  call-seq: clear(color)

  Clears the buffer in a given color.
 */
VALUE Buffer_clear(VALUE self, VALUE color) {
   Buffer &ref = getRef<Buffer>(self);
   ref.clear(hash2col(color));

   return Qnil;
}