| 1 |
/************************************************************************* |
| 2 |
* Copyright (c) 2011 AT&T Intellectual Property |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* https://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
| 8 |
* Contributors: Details at https://graphviz.org |
| 9 |
*************************************************************************/ |
| 10 |
|
| 11 |
#include "config.h" |
| 12 |
|
| 13 |
#include <glcomp/glcompfont.h> |
| 14 |
#include <glcomp/glcomptextpng.h> |
| 15 |
#include <gtk/gtk.h> |
| 16 |
#include <png.h> |
| 17 |
#include <stddef.h> |
| 18 |
|
| 19 |
unsigned char *glCompLoadPng(cairo_surface_t **surface, const char *filename, |
| 20 |
int *imageWidth, int *imageHeight) { |
| 21 |
*surface = cairo_image_surface_create_from_png(filename); |
| 22 |
if (*surface == NULL || |
| 23 |
cairo_surface_status(*surface) != CAIRO_STATUS_SUCCESS) { |
| 24 |
return NULL; |
| 25 |
} |
| 26 |
*imageWidth = cairo_image_surface_get_width(*surface); |
| 27 |
*imageHeight = cairo_image_surface_get_height(*surface); |
| 28 |
return cairo_image_surface_get_data(*surface); |
| 29 |
} |