sp-cursor.cpp revision e7d73dd30dcef4b963d5c0c5c7cb3a9f9e520062
/*
* Some convenience stuff
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Jasper van de Gronde <th.v.d.gronde@hccnet.nl>
* Jon A. Cruz <jon@joncruz.org>
* Kris De Gussem <Kris.DeGussem@gmail.com>
*
* Copyright (C) 1999-2002 authors
* Copyright (C) 2001-2002 Ximian, Inc.
* Copyright (C) 2010 Jasper van de Gronde
* Copyright (C) 2010 Jon A. Cruz
* Copyright (C) 2012 Kris De Gussem
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <cstring>
#include <map>
#include <sstream>
#include "color.h"
#include "sp-cursor.h"
void sp_cursor_bitmap_and_mask_from_xpm(GdkBitmap **bitmap, GdkBitmap **mask, gchar const *const *xpm)
{
int height = 0;
int width = 0;
int colors = 0;
int pix = 0;
int transparent_color = ' ';
for (int i = 0; i < colors; i++) {
char const *p = xpm[1 + i];
char const ccode = *p;
p++;
while (isspace(*p)) {
p++;
}
p++;
while (isspace(*p)) {
p++;
}
if (strcmp(p, "None") == 0) {
}
if (strcmp(p, "Stroke") == 0) {
}
if (strcmp(p, "#000000") == 0) {
}
}
for (int y = 0; y < 32; y++) {
for (int x = 0; x < 32; ) {
char value = 0;
char maskv = 0;
}
}
}
}
}
}
}
struct RGBA {
guchar v[4];
RGBA() {
v[0] = 0;
v[1] = 0;
v[2] = 0;
v[3] = 0;
}
v[0] = r;
v[1] = g;
v[2] = b;
v[3] = a;
}
operator guint32() const {
return result;
}
};
GdkPixbuf *sp_cursor_pixbuf_from_xpm(gchar const *const *xpm, GdkColor const& black, GdkColor const& white, guint32 fill, guint32 stroke)
{
int height = 0;
int width = 0;
int colors = 0;
int pix = 0;
for (int i = 0; i < colors; i++) {
char const *p = xpm[1 + i];
char const ccode = *p;
p++;
while (isspace(*p)) {
p++;
}
p++;
while (isspace(*p)) {
p++;
}
if (strcmp(p, "None") == 0) {
} else if (strcmp(p, "Fill") == 0) {
colorMap[ccode] = RGBA(SP_RGBA32_R_U(fill), SP_RGBA32_G_U(fill), SP_RGBA32_B_U(fill), SP_RGBA32_A_U(fill));
} else if (strcmp(p, "Stroke") == 0) {
colorMap[ccode] = RGBA(SP_RGBA32_R_U(stroke), SP_RGBA32_G_U(stroke), SP_RGBA32_B_U(stroke), SP_RGBA32_A_U(stroke));
} else if (strcmp(p, "#000000") == 0) {
} else if (strcmp(p, "#FFFFFF") == 0) {
} else {
}
}
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
}
}
return gdk_pixbuf_new_from_data(reinterpret_cast<guchar*>(pixmap_buffer), GDK_COLORSPACE_RGB, TRUE, 8, width, height, width * sizeof(guint32), free_cursor_data, NULL);
}
{
}
return cursor;
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :