Пример #1
0
IoCairoSurfacePattern *IoCairoSurfacePattern_rawClone(IoCairoSurfacePattern *proto)
{
	IoObject *self = IoObject_rawClonePrimitive(proto);
	if (PATTERN(proto))
		IoObject_setDataPointer_(self, cairo_pattern_reference(PATTERN(proto)));
	return self;
}
Пример #2
0
	value lime_cairo_pop_group (value handle) {
		
		cairo_pattern_t* pattern = cairo_pop_group ((cairo_t*)val_data (handle));
		cairo_pattern_reference (pattern);
		return CFFIPointer (pattern, gc_cairo_pattern);
		
	}
Пример #3
0
static cairo_pattern_t *
_cairo_film_pattern_create (void)
{
	static cairo_pattern_t *film_pattern = NULL;
	cairo_pattern_t        *pattern;
	static GMutex           mutex;

	g_mutex_lock (&mutex);
	if (film_pattern == NULL) {
		char            *filename;
		cairo_surface_t *surface;

		filename = g_build_filename (GTHUMB_ICON_DIR, "filmholes.png", NULL);
		surface = cairo_image_surface_create_from_png (filename);
		film_pattern = cairo_pattern_create_for_surface (surface);
		cairo_pattern_set_filter (film_pattern, CAIRO_FILTER_GOOD);
		cairo_pattern_set_extend (film_pattern, CAIRO_EXTEND_REPEAT);

		cairo_surface_destroy (surface);
		g_free (filename);

	}
	pattern = cairo_pattern_reference (film_pattern);
	g_mutex_unlock (&mutex);

	return pattern;
}
Пример #4
0
IoCairoLinearGradient *IoCairoLinearGradient_rawClone(IoCairoLinearGradient *proto)
{
    IoObject *self = IoObject_rawClonePrimitive(proto);
    if (PATTERN(proto))
        IoObject_setDataPointer_(self, cairo_pattern_reference(PATTERN(proto)));
    return self;
}
Пример #5
0
static int
cr_get_source (lua_State *L) {
    cairo_t **obj = luaL_checkudata(L, 1, OOCAIRO_MT_NAME_CONTEXT);
    cairo_pattern_t **pattern = create_pattern_userdata(L);
    *pattern = cairo_get_source(*obj);
    cairo_pattern_reference(*pattern);
    return 1;
}
Пример #6
0
/////////////////////////////////////////////////////////////////////////////
// Pattern
Pattern::Pattern( const Pattern &other )
{
	cairo_pattern_t *oldPattern = mCairoPattern;
	mCairoPattern = other.mCairoPattern;
	if( mCairoPattern )
		cairo_pattern_reference( mCairoPattern );
	if( oldPattern )
		cairo_pattern_destroy( oldPattern );
}
static PyObject *
pycairo_get_source (PycairoContext *o)
{
    cairo_pattern_t *pattern = cairo_get_source (o->ctx);
    cairo_pattern_reference (pattern);
    /* bug #2765 - "How do we identify surface (and pattern) types?"
     * should pass pattern type as arg2
     */
    return PycairoPattern_FromPattern (pattern, NULL);
}
Пример #8
0
Pattern& Pattern::operator=( const Pattern &other )
{
	cairo_pattern_t *oldPattern = mCairoPattern;
	mCairoPattern = other.mCairoPattern;
	if( mCairoPattern )
		cairo_pattern_reference( mCairoPattern );
	if( oldPattern )
		cairo_pattern_destroy( oldPattern );
	return *this;
}
Пример #9
0
CairoPattern*
ge_cairo_pattern_pattern(cairo_pattern_t *pattern)
{
	CairoPattern * result = g_new0(CairoPattern, 1);

	result->scale = GE_DIRECTION_NONE;
	result->translate = GE_DIRECTION_BOTH;
        result->handle = cairo_pattern_reference (pattern);
	result->operator = CAIRO_OPERATOR_SOURCE;

	return result;
}
Пример #10
0
static CachedSource*
cached_source_new (cairo_pattern_t *pattern,
                   gint              width,
                   gint             height)
{
    CachedSource *source;

    source = g_new (CachedSource, 1);
    source->pattern = cairo_pattern_reference (pattern);
    source->width = width;
    source->height = height;

    return source;
}
Пример #11
0
VALUE
rb_cairo_pattern_to_ruby_object (cairo_pattern_t *pattern)
{
  if (pattern)
    {
      VALUE klass;
      klass = cr_pattern_get_klass (pattern);
      cairo_pattern_reference (pattern);
      return Data_Wrap_Struct (klass, NULL, cr_pattern_free, pattern);
    }
  else
    {
      return Qnil;
    }
}
Пример #12
0
void
kplotccfg_init_palette(struct kplotccfg *c, size_t palette)
{

	switch (c->type) {
	case (KPLOTCTYPE_DEFAULT):
		c->type = KPLOTCTYPE_PALETTE;
		c->palette = palette;
		break;
	case (KPLOTCTYPE_PATTERN):
		assert(NULL != c->pattern);
		cairo_pattern_reference(c->pattern);
		break;
	default:
		break;
	}
}
Пример #13
0
void
panel_background_set_default_style (PanelBackground *background,
				    GdkRGBA         *color,
				    cairo_pattern_t *pattern)
{
	g_return_if_fail (color != NULL);

	background->default_color = *color;

	if (pattern)
		cairo_pattern_reference (pattern);

	if (background->default_pattern)
		cairo_pattern_destroy (background->default_pattern);

	background->default_pattern = pattern;
	if (background->type == PANEL_BACK_NONE)
		panel_background_prepare (background);
}
Пример #14
0
/**
 * gjs_cairo_pattern_construct:
 * @context: the context
 * @object: object to construct
 * @pattern: cairo_pattern to attach to the object
 *
 * Constructs a pattern wrapper giving an empty JSObject and a
 * cairo pattern. A reference to @pattern will be taken.
 *
 * This is mainly used for subclasses where object is already created.
 */
void
gjs_cairo_pattern_construct(JSContext       *context,
                            JSObject        *object,
                            cairo_pattern_t *pattern)
{
    GjsCairoPattern *priv;

    g_return_if_fail(context != NULL);
    g_return_if_fail(object != NULL);
    g_return_if_fail(pattern != NULL);

    priv = g_slice_new0(GjsCairoPattern);

    g_assert(priv_from_js(context, object) == NULL);
    JS_SetPrivate(object, priv);

    priv->context = context;
    priv->object = object;
    priv->pattern = cairo_pattern_reference(pattern);
}
Пример #15
0
IoObject *IoCairoContext_popGroup(IoCairoContext *self, IoObject *locals, IoMessage *m)
{
	cairo_pattern_t *pattern = cairo_pop_group(CONTEXT(self));
	return IoCairoPattern_newWithRawPattern_(IOSTATE, m, cairo_pattern_reference(pattern));
}
Пример #16
0
static PyObject *
pycairo_get_source (PycairoContext *o) {
  return PycairoPattern_FromPattern (
	       cairo_pattern_reference (cairo_get_source (o->ctx)), NULL);
}
Пример #17
0
JNIEXPORT void JNICALL Java_org_jclutter_cairo_CairoPattern_reference(JNIEnv *env, jobject obj){
cairo_pattern_reference();
}
Пример #18
0
/*
 * Implements
 *   org.freedesktop.cairo.Plumbing.createPattern(long pointer)
 */
JNIEXPORT jobject JNICALL
Java_org_freedesktop_cairo_Plumbing_createPattern
(
	JNIEnv* env,
	jclass cls,
	jlong _pointer
)
{
	cairo_pattern_t* pattern;
	jclass found;
	static jclass SolidPattern = NULL;
	static jclass SurfacePattern = NULL;	
	static jclass LinearPattern = NULL;	
	static jclass RadialPattern = NULL;	
	jclass type;
	jmethodID constructor;
	jobject proxy;
	
	// convert pointer
	pattern = (cairo_pattern_t*) _pointer;

	// increment reference count
	cairo_pattern_reference(pattern);

	// now figure out Proxy class and create
	switch (cairo_pattern_get_type(pattern)) {
	case CAIRO_PATTERN_TYPE_SOLID:
		if (SolidPattern == NULL) {
			found = (*env)->FindClass(env, "org/freedesktop/cairo/SolidPattern");
			SolidPattern = (*env)->NewGlobalRef(env, found);
		}
		type = SolidPattern;
		break;

	case CAIRO_PATTERN_TYPE_SURFACE:
		if (SurfacePattern == NULL) {
			found = (*env)->FindClass(env, "org/freedesktop/cairo/SurfacePattern");
			SurfacePattern = (*env)->NewGlobalRef(env, found);
		}
		type = SurfacePattern;
		break;

	case CAIRO_PATTERN_TYPE_LINEAR:
		if (LinearPattern == NULL) {
			found = (*env)->FindClass(env, "org/freedesktop/cairo/LinearPattern");
			LinearPattern = (*env)->NewGlobalRef(env, found);
		}
		type = LinearPattern;
		break;

	case CAIRO_PATTERN_TYPE_RADIAL:		
		if (RadialPattern == NULL) {
			found = (*env)->FindClass(env, "org/freedesktop/cairo/RadialPattern");
			RadialPattern = (*env)->NewGlobalRef(env, found);
		}
		type = RadialPattern;
		break;

	default:
		g_critical("Unimplemented pattern type");
		return NULL;
	}
	if (type == NULL) {
		bindings_java_throw(env, "FindClass() failed");
		return NULL;
	}

	constructor = (*env)->GetMethodID(env, type, "<init>", "(J)V");
	if (constructor == NULL) {
		g_error("Constructor methodID not found");
		return NULL;
	}
	
	proxy = (*env)->NewObject(env, type, constructor, _pointer);
	return proxy;
}
static PyObject *
_cairo_pattern_from_gvalue(const GValue *value)
{
    return PycairoPattern_FromPattern(cairo_pattern_reference((cairo_pattern_t *) g_value_get_boxed(value)));
}