mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 11:51:27 +00:00
* 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:
parent
2bc0704e72
commit
5bebf3cb25
5 changed files with 61 additions and 236 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2006-09-29 Hans Baier <hansfbaier@googlemail.com>
|
||||
|
||||
* Source/cairo/CairoGState.m: Added hack to retrieve current rgb
|
||||
and alpha from cairos internal structures. Will be replaced by proper
|
||||
code when the cairo functions are available
|
||||
* Source/cairo/CairoGState.m:
|
||||
* Headers/cairo/CairoGState.h: refactored class as a subclass of
|
||||
GSGState. Removed all unimplemented methods implemented in the
|
||||
superclass.
|
||||
* Headers/cairo/CairoFaceInfo.h: fixed header file to include the
|
||||
needed freetype headers
|
||||
* Source/cairo/XGCairoGlitzSurface.m: fixed glitz api change
|
||||
glitz_glx_find_drawable_format ->
|
||||
glitz_glx_find_drawable_format_for_visual. Compiles now but doesnt
|
||||
work yet, because I don't know how to retrieve a proper VisualID.
|
||||
someone who knows, please fix it!
|
||||
|
||||
2006-09-28 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/win32/WIN32Server.m: Use GSBackHandlesWindowDecorations
|
||||
|
@ -17,6 +34,7 @@
|
|||
offsets. Wait for up to a second for visibility events in case
|
||||
XSync() does not work to ensure we receive them.
|
||||
|
||||
>>>>>>> .r23660
|
||||
2006-09-25 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/x11/XGGeneric.h: Extra fielkd to flag when style offsets
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#ifndef CAIROFACEINFO_H
|
||||
#define CAIROFACEINFO_H
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include <cairo-ft.h>
|
||||
|
||||
@interface CairoFaceInfo : NSObject
|
||||
|
|
|
@ -27,11 +27,13 @@
|
|||
#include <AppKit/NSGraphicsContext.h>
|
||||
#include <cairo.h>
|
||||
|
||||
#include "gsc/GSGState.h"
|
||||
|
||||
@class CairoContext;
|
||||
@class CairoFontInfo;
|
||||
@class CairoSurface;
|
||||
|
||||
@interface CairoGState : NSObject /* No need of overhead */
|
||||
@interface CairoGState : GSGState
|
||||
{
|
||||
@public
|
||||
cairo_t *_ct;
|
||||
|
@ -47,128 +49,5 @@
|
|||
|
||||
@end
|
||||
|
||||
@interface CairoGState (Ops)
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Color operations */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (void) DPScurrentalpha: (float*)a;
|
||||
- (void) DPScurrentcmykcolor: (float*)c : (float*)m : (float*)y : (float*)k;
|
||||
- (void) DPScurrentgray: (float*)gray;
|
||||
- (void) DPScurrenthsbcolor: (float*)h : (float*)s : (float*)b;
|
||||
- (void) DPScurrentrgbcolor: (float*)r : (float*)g : (float*)b;
|
||||
- (void) DPSsetalpha: (float)a;
|
||||
- (void) DPSsetcmykcolor: (float)c : (float)m : (float)y : (float)k;
|
||||
- (void) DPSsetgray: (float)gray;
|
||||
- (void) DPSsethsbcolor: (float)h : (float)s : (float)b;
|
||||
- (void) DPSsetrgbcolor: (float)r : (float)g : (float)b;
|
||||
|
||||
- (void) GSSetFillColorspace: (void *)spaceref;
|
||||
- (void) GSSetStrokeColorspace: (void *)spaceref;
|
||||
- (void) GSSetFillColor: (const float *)values;
|
||||
- (void) GSSetStrokeColor: (const float *)values;
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Text operations */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (void) DPSashow: (float)x : (float)y : (const char*)s;
|
||||
- (void) DPSawidthshow: (float)cx : (float)cy : (int)c : (float)ax : (float)ay
|
||||
: (const char*)s;
|
||||
- (void) DPScharpath: (const char*)s : (int)b;
|
||||
- (void) DPSshow: (const char*)s;
|
||||
- (void) DPSwidthshow: (float)x : (float)y : (int)c : (const char*)s;
|
||||
- (void) DPSxshow: (const char*)s : (const float*)numarray : (int)size;
|
||||
- (void) DPSxyshow: (const char*)s : (const float*)numarray : (int)size;
|
||||
- (void) DPSyshow: (const char*)s : (const float*)numarray : (int)size;
|
||||
|
||||
- (void) GSSetCharacterSpacing: (float)extra;
|
||||
- (void) GSSetFont: (GSFontInfo *)fontref;
|
||||
- (void) GSSetFontSize: (float)size;
|
||||
- (NSAffineTransform *) GSGetTextCTM;
|
||||
- (NSPoint) GSGetTextPosition;
|
||||
- (void) GSSetTextCTM: (NSAffineTransform *)ctm;
|
||||
- (void) GSSetTextDrawingMode: (GSTextDrawingMode)mode;
|
||||
- (void) GSSetTextPosition: (NSPoint)loc;
|
||||
- (void) GSShowText: (const char *)string : (size_t) length;
|
||||
- (void) GSShowGlyphs: (const NSGlyph *)glyphs : (size_t) length;
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Gstate operations */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (void) DPSinitgraphics;
|
||||
|
||||
- (void) DPScurrentflat: (float*)flatness;
|
||||
- (void) DPScurrentlinecap: (int*)linecap;
|
||||
- (void) DPScurrentlinejoin: (int*)linejoin;
|
||||
- (void) DPScurrentlinewidth: (float*)width;
|
||||
- (void) DPScurrentmiterlimit: (float*)limit;
|
||||
- (void) DPScurrentpoint: (float*)x : (float*)y;
|
||||
- (void) DPScurrentstrokeadjust: (int*)b;
|
||||
- (void) DPSsetdash: (const float*)pat : (int)size : (float)offset;
|
||||
- (void) DPSsetflat: (float)flatness;
|
||||
- (void) DPSsetlinecap: (int)linecap;
|
||||
- (void) DPSsetlinejoin: (int)linejoin;
|
||||
- (void) DPSsetlinewidth: (float)width;
|
||||
- (void) DPSsetmiterlimit: (float)limit;
|
||||
- (void) DPSsetstrokeadjust: (int)b;
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Matrix operations */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (void) DPSconcat: (const float*)m;
|
||||
- (void) DPSinitmatrix;
|
||||
- (void) DPSrotate: (float)angle;
|
||||
- (void) DPSscale: (float)x : (float)y;
|
||||
- (void) DPStranslate: (float)x : (float)y;
|
||||
|
||||
- (NSAffineTransform *) GSCurrentCTM;
|
||||
- (void) GSSetCTM: (NSAffineTransform *)ctm;
|
||||
- (void) GSConcatCTM: (NSAffineTransform *)ctm;
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Paint operations */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
- (NSPoint) currentPoint;
|
||||
|
||||
- (void) DPSarc: (float)x : (float)y : (float)r : (float)angle1
|
||||
: (float)angle2;
|
||||
- (void) DPSarcn: (float)x : (float)y : (float)r : (float)angle1
|
||||
: (float)angle2;
|
||||
- (void) DPSarct: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)r;
|
||||
- (void) DPSclip;
|
||||
- (void) DPSclosepath;
|
||||
- (void) DPScurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2
|
||||
: (float)x3 : (float)y3;
|
||||
- (void) DPSeoclip;
|
||||
- (void) DPSeofill;
|
||||
- (void) DPSfill;
|
||||
- (void) DPSflattenpath;
|
||||
- (void) DPSinitclip;
|
||||
- (void) DPSlineto: (float)x : (float)y;
|
||||
- (void) DPSmoveto: (float)x : (float)y;
|
||||
- (void) DPSnewpath;
|
||||
- (void) DPSpathbbox: (float*)llx : (float*)lly : (float*)urx : (float*)ury;
|
||||
- (void) DPSrcurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2
|
||||
: (float)x3 : (float)y3;
|
||||
- (void) DPSrectclip: (float)x : (float)y : (float)w : (float)h;
|
||||
- (void) DPSrectfill: (float)x : (float)y : (float)w : (float)h;
|
||||
- (void) DPSrectstroke: (float)x : (float)y : (float)w : (float)h;
|
||||
- (void) DPSreversepath;
|
||||
- (void) DPSrlineto: (float)x : (float)y;
|
||||
- (void) DPSrmoveto: (float)x : (float)y;
|
||||
- (void) DPSstroke;
|
||||
|
||||
- (void) GSSendBezierPath: (NSBezierPath *)path;
|
||||
- (void) GSRectClipList: (const NSRect *)rects : (int) count;
|
||||
- (void) GSRectFillList: (const NSRect *)rects : (int) count;
|
||||
|
||||
- (void)DPSimage: (NSAffineTransform*) matrix
|
||||
: (int) pixelsWide : (int) pixelsHigh
|
||||
: (int) bitsPerSample : (int) samplesPerPixel
|
||||
: (int) bitsPerPixel : (int) bytesPerRow : (BOOL) isPlanar
|
||||
: (BOOL) hasAlpha : (NSString *) colorSpaceName
|
||||
: (const unsigned char *const [5]) data;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue