* refactores CairoGState as a subclass of GSGState

* header fixes to include freetype
* fixed glitz api change (but does not work, because I don't know how to
  retrieve a proper VisualID for the display)

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@23681 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Hans Baier 2006-09-30 12:21:13 +00:00
parent 2bc0704e72
commit 5bebf3cb25
5 changed files with 61 additions and 236 deletions

View file

@ -1,3 +1,4 @@
/*
* CairoGState.m
@ -172,11 +173,7 @@ _flipCairoSurfaceMatrix(cairo_t *ct, CairoSurface *surface)
[self DPSinitgraphics];
}
@end
@implementation CairoGState (Ops)
// FIXME: Hack to be able to set alpha
// FIXME: This is for the color getters on non solid type patterns
static float last_r, last_g, last_b;
/*
@ -184,9 +181,19 @@ static float last_r, last_g, last_b;
*/
- (void) DPScurrentalpha: (float *)a
{
//FIXME
*a = 1.0;
cairo_pattern_t *pattern;
//cairo removed this function
//*a = cairo_current_alpha(_ct);
pattern = cairo_get_source(_ct);
if (cairo_pattern_get_type(pattern) == CAIRO_PATTERN_TYPE_SOLID)
{
void *colors = (((void *)pattern) + 68);
*a = *((double *) colors + 3);
}
else
*a = 1.0;
}
- (void) DPScurrentcmykcolor: (float *)c : (float *)m : (float *)y :(float *)k
@ -227,21 +234,31 @@ static float last_r, last_g, last_b;
- (void) DPScurrentrgbcolor: (float *)r : (float *)g : (float *)b
{
//FIXME: cairo removed this function
cairo_pattern_t *pattern;
//cairo removed this function
//cairo_current_rgb_color(_ct, &dr, &dg, &db);
*r = last_r;
*g = last_g;
*b = last_b;
pattern = cairo_get_source(_ct);
if (cairo_pattern_get_type(pattern) == CAIRO_PATTERN_TYPE_SOLID)
{
void *colors = (((void *)pattern) + 68);
*r = *((double *) colors + 0);
*g = *(((double *) colors + 1));
*b = *(((double *) colors + 2));
}
else
{
*r = last_r;
*g = last_g;
*b = last_b;
}
}
- (void) DPSsetalpha: (float)a
{
float r, g, b;
// FIXME: Hack to be able to set alpha
r = last_r;
g = last_g;
b = last_b;
[self DPScurrentrgbcolor: &r: &g: &b];
cairo_set_source_rgba(_ct, r, g, b, a);
}
@ -278,48 +295,16 @@ static float last_r, last_g, last_b;
- (void) DPSsetrgbcolor: (float)r : (float)g: (float)b
{
// FIXME: Hack to be able to set alpha
last_r = r;
last_g = g;
last_b = b;
cairo_set_source_rgb(_ct, r, g, b);
}
- (void) GSSetFillColorspace: (void *)spaceref
{
FIXME();
}
- (void) GSSetStrokeColorspace: (void *)spaceref
{
FIXME();
}
- (void) GSSetFillColor: (const float *)values
{
FIXME();
}
- (void) GSSetStrokeColor: (const float *)values
{
FIXME();
}
/*
* Text operations
*/
- (void) DPSashow: (float)x : (float)y : (const char *)s
{
FIXME();
}
- (void) DPSawidthshow: (float)cx : (float)cy : (int)c : (float)ax
: (float)ay : (const char *)s
{
FIXME();
}
- (void) DPScharpath: (const char *)s : (int)b
{
char *c = malloc(b + 1);
@ -336,31 +321,6 @@ static float last_r, last_g, last_b;
cairo_show_text(_ct, s);
}
- (void) DPSwidthshow: (float)x : (float)y : (int)c : (const char *)s
{
FIXME();
}
- (void) DPSxshow: (const char *)s : (const float *)numarray : (int)size
{
FIXME();
}
- (void) DPSxyshow: (const char *)s : (const float *)numarray : (int)size
{
FIXME();
}
- (void) DPSyshow: (const char *)s : (const float *)numarray : (int)size
{
FIXME();
}
- (void) GSSetCharacterSpacing: (float)extra
{
FIXME();
}
- (void) GSSetFont: (GSFontInfo *)fontref
{
if (_font == fontref)
@ -396,16 +356,6 @@ static float last_r, last_g, last_b;
[self GSSetCTM: ctm];
}
- (void) GSSetTextDrawingMode: (GSTextDrawingMode)mode
{
FIXME();
}
- (void) GSSetTextPosition: (NSPoint)loc
{
FIXME();
}
- (void) GSShowText: (const char *)string : (size_t)length
{
FIXME();
@ -710,30 +660,6 @@ static float last_r, last_g, last_b;
cairo_arc_negative(_ct, x, y, r, angle1 * M_PI / 180, angle2 * M_PI / 180);
}
- (void) DPSarct: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)r
{
FIXME();
/*
cairo_arc_to(_ct, x1, y1, x2, y2, r);
*/
/*
NSBezierPath *newPath;
newPath = [[NSBezierPath alloc] init];
if ((path != nil) && ([path elementCount] != 0))
{
[newPath lineToPoint: [self currentPoint]];
}
[newPath appendBezierPathWithArcFromPoint: NSMakePoint(x1, y1)
toPoint: NSMakePoint(x2, y2)
radius: r];
[newPath transformUsingAffineTransform: ctm];
CHECK_PATH;
[path appendBezierPath: newPath];
RELEASE(newPath);
*/
}
- (void) DPSclip
{
cairo_clip(_ct);

View file

@ -49,11 +49,11 @@
*/
templ.doublebuffer = 0;
dformat = glitz_glx_find_drawable_format(GSWINDEVICE->display,
GSWINDEVICE->screen,
GLITZ_FORMAT_DOUBLEBUFFER_MASK,
&templ,
0);
dformat = glitz_glx_find_drawable_format_for_visual(GSWINDEVICE->display,
GSWINDEVICE->screen,
// GLITZ_FORMAT_DOUBLEBUFFER_MASK,
// &templ,
DefaultVisual(GSWINDEVICE->display, GSWINDEVICE->screen)); //FIXME: this does not work
if (!dformat)
{
@ -90,7 +90,7 @@
exit(1);
}
glitz_surface_attach(surface, drawable, GLITZ_DRAWABLE_BUFFER_FRONT_COLOR, 0, 0);
glitz_surface_attach(surface, drawable, GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
_surface = cairo_glitz_surface_create(surface);
return self;