Ejemplo n.º 1
0
static gboolean
gtk_css_image_gradient_draw_circle (GtkCssImageGradient *image,
                                    cairo_t              *cr,
                                    double               width,
                                    double               height)
{
  cairo_pattern_t *pattern = image->pattern;
  double x0, y0, x1, y1, r0, r1;
  GdkRGBA color0, color1;
  double offset0, offset1;
  int n_stops;

  if (cairo_pattern_get_type (pattern) != CAIRO_PATTERN_TYPE_RADIAL)
    return FALSE;
  if (cairo_pattern_get_extend (pattern) != CAIRO_EXTEND_PAD)
    return FALSE;

  cairo_pattern_get_radial_circles (pattern, &x0, &y0, &r0, &x1, &y1, &r1);

  if (x0 != x1 ||
      y0 != y1 ||
      r0 != 0.0)
    return FALSE;

  cairo_pattern_get_color_stop_count (pattern, &n_stops);
  if (n_stops != 2)
    return FALSE;

  cairo_pattern_get_color_stop_rgba (pattern, 0, &offset0, &color0.red, &color0.green, &color0.blue, &color0.alpha);
  cairo_pattern_get_color_stop_rgba (pattern, 1, &offset1, &color1.red, &color1.green, &color1.blue, &color1.alpha);
  if (offset0 != offset1)
    return FALSE;

  cairo_scale (cr, width, height);

  cairo_rectangle (cr, 0, 0, 1, 1);
  cairo_clip (cr);

  gdk_cairo_set_source_rgba (cr, &color1);
  cairo_paint (cr);

  gdk_cairo_set_source_rgba (cr, &color0);
  cairo_arc (cr, x1, y1, r1 * offset1, 0, 2 * G_PI);
  cairo_fill (cr);

  return TRUE;
}
Ejemplo n.º 2
0
static JSBool
getExtend_func(JSContext *context,
               unsigned   argc,
               jsval     *vp)
{
    JSObject *obj = JS_THIS_OBJECT(context, vp);
    cairo_extend_t extend;
    cairo_pattern_t *pattern;

    if (argc > 0) {
        gjs_throw(context, "SurfacePattern.getExtend() requires no arguments");
        return JS_FALSE;
    }

    pattern = gjs_cairo_pattern_get_pattern(context, obj);
    extend = cairo_pattern_get_extend(pattern);

    if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern"))
        return JS_FALSE;

    JS_SET_RVAL(context, vp, INT_TO_JSVAL(extend));

    return JS_TRUE;
}
Ejemplo n.º 3
0
	int lime_cairo_pattern_get_extend (value handle) {
		
		return cairo_pattern_get_extend ((cairo_pattern_t*)val_data (handle));
		
	}
Ejemplo n.º 4
0
	int lime_cairo_pattern_get_extend (double handle) {
		
		return cairo_pattern_get_extend ((cairo_pattern_t*)(intptr_t)handle);
		
	}
Ejemplo n.º 5
0
static VALUE
cr_pattern_get_extend (VALUE self)
{
  return INT2NUM (cairo_pattern_get_extend (_SELF (self)));
}
Ejemplo n.º 6
0
int Pattern::getExtend() const
{
	return static_cast<int>( cairo_pattern_get_extend( mCairoPattern ) );
}
Ejemplo n.º 7
0
IoObject *IoCairoSurfacePattern_getExtend(IoCairoSurfacePattern *self, IoObject *locals, IoMessage *m)
{
	return IONUMBER(cairo_pattern_get_extend(PATTERN(self)));
}
Ejemplo n.º 8
0
static int cairo_pattern_get_extend_l( lua_State* L ) {
  lua_cairo_pattern_t* lcp = lua_cairo_pattern_check( L, 1 );
  lua_pushstring( L, cairo_pattern_extend_lst[cairo_pattern_get_extend(lcp->pattern)] );
  return 1;
}
Ejemplo n.º 9
0
static PyObject *
pattern_get_extend (PycairoPattern *o) {
  return PyInt_FromLong (cairo_pattern_get_extend (o->pattern));
}
Ejemplo n.º 10
0
JNIEXPORT jint JNICALL Java_org_jclutter_cairo_CairoPattern_getExtend(JNIEnv *env, jobject obj){
return (jint)cairo_pattern_get_extend();
}