static void quartzgen_end_job(GVJ_t * job)
{
- CGContextRef context = (CGContextRef) job->context;
+ CGContextRef context = job->context;
#ifdef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 20000
color_space, /* color space: device RGB */
kCGImageAlphaPremultipliedFirst /* bitmap info: premul ARGB has best support in OS X */
);
- job->imagedata =
- CGBitmapContextGetData((CGContextRef) job->context);
+ job->imagedata = CGBitmapContextGetData(job->context);
/* clean up */
CGColorSpaceRelease(color_space);
}
/* start the page (if this is a paged context) and graphics state */
- CGContextRef context = (CGContextRef) job->context;
+ CGContextRef context = job->context;
CGContextBeginPage(context, &bounds);
CGContextSaveGState(context);
/* CGContextSetMiterLimit(context, 1.0); */
static void quartzgen_end_page(GVJ_t * job)
{
/* end the page (if this is a paged context) and graphics state */
- CGContextRef context = (CGContextRef) job->context;
+ CGContextRef context = job->context;
CGContextRestoreGState(context);
CGContextEndPage(context);
}
pointf *url_map = job->obj->url_map_p;
if (url && url_map) {
/* set up the hyperlink to the given url */
- CGContextRef context = (CGContextRef) job->context;
+ CGContextRef context = job->context;
CFURLRef uri =
CFURLCreateWithBytes(kCFAllocatorDefault, (const UInt8 *) url,
strlen(url), kCFStringEncodingUTF8, NULL);
static void quartzgen_path(GVJ_t * job, int filled)
{
- CGContextRef context = (CGContextRef) job->context;
+ CGContextRef context = job->context;
/* set up colors */
if (filled)
void quartzgen_textspan(GVJ_t * job, pointf p, textspan_t * span)
{
- CGContextRef context = (CGContextRef) job->context;
+ CGContextRef context = job->context;
/* adjust text position */
switch (span->just) {
static void quartzgen_ellipse(GVJ_t * job, pointf * A, int filled)
{
/* convert ellipse into the current path */
- CGContextRef context = (CGContextRef) job->context;
+ CGContextRef context = job->context;
double dx = A[1].x - A[0].x;
double dy = A[1].y - A[0].y;
CGContextAddEllipseInRect(context,
static void quartzgen_polygon(GVJ_t * job, pointf * A, int n, int filled)
{
/* convert polygon into the current path */
- CGContextRef context = (CGContextRef) job->context;
+ CGContextRef context = job->context;
CGContextMoveToPoint(context, A[0].x, A[0].y);
int i;
for (i = 1; i < n; ++i)
int arrow_at_end, int filled)
{
/* convert bezier into the current path */
- CGContextRef context = (CGContextRef) job->context;
+ CGContextRef context = job->context;
CGContextMoveToPoint(context, A[0].x, A[0].y);
int i;
for (i = 1; i < n; i += 3)
static void quartzgen_polyline(GVJ_t * job, pointf * A, int n)
{
/* convert polyline into the current path */
- CGContextRef context = (CGContextRef) job->context;
+ CGContextRef context = job->context;
CGContextMoveToPoint(context, A[0].x, A[0].y);
int i;
for (i = 1; i < n; ++i)
CGFloat descent = 0.0;
CGFloat leading = 0.0;
- *width = CTLineGetTypographicBounds((CTLineRef)layout, &ascent, &descent, &leading);
+ *width = CTLineGetTypographicBounds(layout, &ascent, &descent, &leading);
*height = ascent + descent + leading;
*yoffset_layout = ascent;
}
void quartz_draw_layout(void *layout, CGContextRef context, CGPoint position)
{
CGContextSetTextPosition(context, position.x, position.y);
- CTLineDraw((CTLineRef)layout, context);
+ CTLineDraw(layout, context);
}
void quartz_free_layout(void *layout)
{
if (layout)
- CFRelease((CTLineRef)layout);
+ CFRelease(layout);
};
#endif
if (line)
{
/* report the layout */
- para->layout = (void*)line;
+ para->layout = line;
para->free_layout = &quartz_free_layout;
- quartz_size_layout((void*)line, ¶->size.x, ¶->size.y, ¶->yoffset_layout);
+ quartz_size_layout(line, ¶->size.x, ¶->size.y, ¶->yoffset_layout);
para->yoffset_centerline = 0.2 * para->font->size;
return true;
}