#define _ARRAY_DEFINE
#include "shArrayBase.h"
+#ifndef SH_NO_IMAGE
/*-----------------------------------------------------------
* Prepares the proper pixel pack/unpack info for the given
if (f->rmask == 0x0) { c->r = 1.0f; c->g = 1.0f; c->b = 1.0f; }
}
+#endif // SH_NO_IMAGE
/*----------------------------------------------
* Color and Image constructors and destructors
i->data = NULL;
i->width = 0;
i->height = 0;
+
+#ifdef SH_NO_IMAGE
+ printf("ShivaVG: images not supported!");
+#else
glGenTextures(1, &i->texture);
+#endif
}
void SHImage_dtor(SHImage *i)
{
if (i->data != NULL)
free(i->data);
-
+
+#ifdef SH_NO_IMAGE
+ printf("ShivaVG: images not supported!");
+#else
if (glIsTexture(i->texture))
glDeleteTextures(1, &i->texture);
+#endif
}
+#ifndef SH_NO_IMAGE
/*--------------------------------------------------------
* Finds appropriate OpenGL texture size for the size of
* the given image
i->texwidth, i->texheight, 0,
i->fd.glformat, i->fd.gltype, i->data);
}
+#endif // SH_NO_IMAGE
/*----------------------------------------------------------
* Creates a new image object and returns the handle to it
VGint width, VGint height,
VGbitfield allowedQuality)
{
+#ifdef SH_NO_IMAGE
+ printf("ShivaVG: images not supported!");
+ return VG_INVALID_HANDLE;
+#else
SHImage *i = NULL;
SHImageFormatDesc fd;
VG_GETCONTEXT(VG_INVALID_HANDLE);
/* Add to resource list */
shImageArrayPushBack(&context->images, i);
-
+
VG_RETURN((VGImage)i);
+#endif // SH_NO_IMAGE
}
VG_API_CALL void vgDestroyImage(VGImage image)
{
+#ifdef SH_NO_IMAGE
+ printf("ShivaVG: images not supported!");
+#else
SHint index;
VG_GETCONTEXT(VG_NO_RETVAL);
/* Delete object and remove resource */
SH_DELETEOBJ(SHImage, (SHImage*)image);
shImageArrayRemoveAt(&context->images, index);
-
+
VG_RETURN(VG_NO_RETVAL);
+#endif // SH_NO_IMAGE
}
/*---------------------------------------------------
VG_API_CALL void vgClearImage(VGImage image,
VGint x, VGint y, VGint width, VGint height)
{
+#ifdef SH_NO_IMAGE
+ printf("ShivaVG: images not supported!");
+#else
SHImage *i;
SHColor clear;
SHuint8 *data;
}}
shUpdateImageTexture(i, context);
+
VG_RETURN(VG_NO_RETVAL);
+#endif // SH_NO_IMAGE
}
+#ifndef SH_NO_IMAGE
+
/*------------------------------------------------------------
* Generic function for copying a rectangle area of pixels
* of size (width,height) among two data buffers. The size of
}
}
+#endif // SH_NO_IMAGE
+
/*---------------------------------------------------------
* Copies a rectangle area of pixels of size (width,height)
* from given data buffer to image surface at destination
VGImageFormat dataFormat,
VGint x, VGint y, VGint width, VGint height)
{
+#ifdef SH_NO_IMAGE
+ printf("ShivaVG: images not supported!");
+#else
SHImage *i;
VG_GETCONTEXT(VG_NO_RETVAL);
x, y, 0, 0, width, height);
shUpdateImageTexture(i, context);
+
VG_RETURN(VG_NO_RETVAL);
+#endif // SH_NO_IMAGE
}
/*---------------------------------------------------------
VGint x, VGint y,
VGint width, VGint height)
{
+#ifdef SH_NO_IMAGE
+ printf("ShivaVG: images not supported!");
+#else
SHImage *i;
VG_GETCONTEXT(VG_NO_RETVAL);
i->data, i->fd.vgformat, i->texwidth * i->fd.bytes,
width, height, i->width, i->height,
0,0,x,x,width,height);
-
+
VG_RETURN(VG_NO_RETVAL);
+#endif // SH_NO_IMAGE
}
/*----------------------------------------------------------
VGint width, VGint height,
VGboolean dither)
{
+#ifdef SH_NO_IMAGE
+ printf("ShivaVG: images not supported!");
+#else
SHImage *s, *d;
SHuint8 *pixels;
free(pixels);
shUpdateImageTexture(d, context);
+
VG_RETURN(VG_NO_RETVAL);
+#endif // SH_NO_IMAGE
}
/*---------------------------------------------------------
VGImage src, VGint sx, VGint sy,
VGint width, VGint height)
{
+#ifdef SH_NO_IMAGE
+ printf("ShivaVG: images not supported!");
+#else
SHImage *i;
SHuint8 *pixels;
SHImageFormatDesc winfd;
free(pixels);
VG_RETURN(VG_NO_RETVAL);
+#endif // SH_NO_IMAGE
}
/*---------------------------------------------------------
VGint dx, VGint dy,
VGint width, VGint height)
{
+#ifdef SH_NO_IMAGE
+ printf("ShivaVG: images not supported!");
+#else
SHuint8 *pixels;
SHImageFormatDesc winfd;
free(pixels);
- VG_RETURN(VG_NO_RETVAL);
+ VG_RETURN(VG_NO_RETVAL);
+#endif // SH_NO_IMAGE
}
/*-----------------------------------------------------------
VGint sx, VGint sy,
VGint width, VGint height)
{
+#ifdef SH_NO_IMAGE
+ printf("ShivaVG: images not supported!");
+#else
SHImage *i;
SHuint8 *pixels;
SHImageFormatDesc winfd;
free(pixels);
shUpdateImageTexture(i, context);
+
VG_RETURN(VG_NO_RETVAL);
+#endif // SH_NO_IMAGE
}
/*-----------------------------------------------------------
VGint sx, VGint sy,
VGint width, VGint height)
{
+#ifdef SH_NO_IMAGE
+ printf("ShivaVG: images not supported!");
+#else
SHuint8 *pixels;
SHImageFormatDesc winfd;
VG_GETCONTEXT(VG_NO_RETVAL);
0, 0, 0, 0, width, height);
free(pixels);
-
+
VG_RETURN(VG_NO_RETVAL);
+#endif // SH_NO_IMAGE
}
/*----------------------------------------------------------
VGint sx, VGint sy,
VGint width, VGint height)
{
+#ifdef SH_NO_IMAGE
+ printf("ShivaVG: images not supported!");
+#else
VG_GETCONTEXT(VG_NO_RETVAL);
VG_RETURN_ERR_IF(width <= 0 || height <= 0,
glRasterPos2i(dx, dy);
glCopyPixels(sx, sy, width, height, GL_COLOR);
glRasterPos2i(0, 0);
-
+
VG_RETURN(VG_NO_RETVAL);
+#endif // SH_NO_IMAGE
}
VG_API_CALL VGImage vgChildImage(VGImage parent,