|
static QImage | constructImageWithTransparentBackground (const QImage &im_black_bgd, const QImage &image_white_bgd) |
|
static void | bwtorgba (unsigned char *b, unsigned char *l, int n) |
|
static void | latorgba (unsigned char *b, unsigned char *a, unsigned char *l, int n) |
|
static void | rgbtorgba (unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *l, int n) |
|
static void | rgbatorgba (unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a, unsigned char *l, int n) |
|
static void | ConvertLong (unsigned *array, long length) |
|
static ImageRec * | ImageOpen (const char *fileName) |
|
static void | ImageClose (ImageRec *image) |
|
static void | ImageGetRow (ImageRec *image, unsigned char *buf, int y, int z) |
|
static unsigned * | read_texture (const char *name, int *width, int *height, int *components) |
|
static void * | buffer_realloc (void *bufptr, size_t size) |
|
static QString | buffer_writeaction (SoNode *root) |
|
static void | buffer_vrmlwriteaction (SoNode *root, const QString &filename) |
|
Definition at line 60 of file VP1QtInventorUtils.cxx.
◆ ImageRec
◆ buffer_realloc()
void * VP1QtInventorUtils::Imp::buffer_realloc |
( |
void * |
bufptr, |
|
|
size_t |
size |
|
) |
| |
|
static |
◆ buffer_vrmlwriteaction()
void VP1QtInventorUtils::Imp::buffer_vrmlwriteaction |
( |
SoNode * |
root, |
|
|
const QString & |
filename |
|
) |
| |
|
static |
Definition at line 1397 of file VP1QtInventorUtils.cxx.
1399 SoToVRML2Action vwa;
1402 SoVRMLGroup * newroot = vwa.getVRML2SceneGraph();
1406 out.setHeaderString(
"#VRML V2.0 utf8");
1407 SoWriteAction wra(&
out);
◆ buffer_writeaction()
QString VP1QtInventorUtils::Imp::buffer_writeaction |
( |
SoNode * |
root | ) |
|
|
static |
◆ bwtorgba()
static void VP1QtInventorUtils::Imp::bwtorgba |
( |
unsigned char * |
b, |
|
|
unsigned char * |
l, |
|
|
int |
n |
|
) |
| |
|
inlinestatic |
◆ constructImageWithTransparentBackground()
QImage VP1QtInventorUtils::Imp::constructImageWithTransparentBackground |
( |
const QImage & |
im_black_bgd, |
|
|
const QImage & |
image_white_bgd |
|
) |
| |
|
static |
Definition at line 594 of file VP1QtInventorUtils.cxx.
596 if (im_black_bgd.isNull()||im_white_bgd.isNull()||im_black_bgd.size()!=im_white_bgd.size())
599 QImage
im(im_black_bgd.size(),QImage::Format_ARGB32);
602 int height =
im.height();
603 QRgb white = qRgba(255,255,255,255);
604 QRgb black = qRgba(0,0,0,255);
607 for (
int y = 0;
y < height; ++
y) {
608 if (im_black_bgd.pixel(
x,
y)==im_white_bgd.pixel(
x,
y)) {
609 im.setPixel(
x,
y,im_white_bgd.pixel(
x,
y));
610 }
else if (im_black_bgd.pixel(
x,
y)==black&&im_white_bgd.pixel(
x,
y)==white) {
611 im.setPixel(
x,
y,Qt::transparent);
614 QColor pix_b = QColor(im_black_bgd.pixel(
x,
y));
615 QColor pix_w = QColor(im_white_bgd.pixel(
x,
y));
616 qreal
alpha = 1.0 - pix_w.redF() + pix_b.redF();
618 im.setPixel(
x,
y,Qt::transparent);
620 im.setPixel(
x,
y,qRgba(
static_cast<int>(pix_b.redF()/
alpha*255+0.5),
621 static_cast<int>(pix_b.greenF()/
alpha*255+0.5),
622 static_cast<int>(pix_b.blueF()/
alpha*255+0.5),
623 static_cast<int>(
alpha*255+0.5)));
◆ ConvertLong()
static void VP1QtInventorUtils::Imp::ConvertLong |
( |
unsigned * |
array, |
|
|
long |
length |
|
) |
| |
|
inlinestatic |
◆ ImageClose()
static void VP1QtInventorUtils::Imp::ImageClose |
( |
ImageRec * |
image | ) |
|
|
inlinestatic |
◆ ImageGetRow()
static void VP1QtInventorUtils::Imp::ImageGetRow |
( |
ImageRec * |
image, |
|
|
unsigned char * |
buf, |
|
|
int |
y, |
|
|
int |
z |
|
) |
| |
|
inlinestatic |
Definition at line 235 of file VP1QtInventorUtils.cxx.
238 unsigned char *iPtr, *oPtr,
pixel;
242 if ((
image->type & 0xFF00) == 0x0100) {
244 int okseek = fseek(
image->file, (
long)
image->rowStart[
y+
z*
image->ysize], SEEK_SET);
245 int okread = fread(
image->tmp, 1, (
unsigned int)
image->rowSize[
y+
z*
image->ysize],
271 int okstatus = fseek(
image->file, 512
u+yDim+zDim, SEEK_SET);
274 size_t bytesRead = 0;
275 bytesRead = fread(buf, 1,
image->xsize,
image->file);
281 std::cout <<
"Warning! ImageGetRow() - no 'image'..." << std::endl;
◆ ImageOpen()
static ImageRec* VP1QtInventorUtils::Imp::ImageOpen |
( |
const char * |
fileName | ) |
|
|
inlinestatic |
if (image == NULL) { //image cannot be null here, it has been used! fprintf(stderr, "image == NULL!\n"); return (ImageRec *)malloc(sizeof(ImageRec)); }
Definition at line 135 of file VP1QtInventorUtils.cxx.
144 endianTest.testWord = 1;
145 if (endianTest.testByte[0] == 1) {
153 fprintf(
stderr,
"Out of memory!\n");
161 int bytesRead = fread(
image, 1, 12,
image->file);
164 fprintf(
stderr,
"fread failed!\n");
181 const unsigned int colourBuffSize=
image->xsize*256
u;
183 image->tmpR = ucharAddress(
malloc(colourBuffSize));
184 image->tmpG = ucharAddress(
malloc(colourBuffSize));
185 image->tmpB = ucharAddress(
malloc(colourBuffSize));
186 if (
image->tmp == NULL ||
image->tmpR == NULL ||
image->tmpG == NULL ||
187 image->tmpB == NULL) {
188 fprintf(
stderr,
"Out of memory!\n");
193 if ((
image->type & 0xFF00) == 0x0100) {
194 size_t x = ((size_t)
image->ysize * (
size_t)
image->zsize) *
sizeof(
unsigned);
197 if (
image->rowStart == NULL ||
image->rowSize == NULL) {
198 fprintf(
stderr,
"Out of memory!\n");
201 image->rleEnd = 512 + (2 *
x);
202 const int fseekRetVal= fseek(
image->file, 512, SEEK_SET);
203 if (fseekRetVal !=0){
204 fprintf(
stderr,
"Something very wrong with fseek near line 205 of VP1QtInventorUtils.cxx");
206 size_t bytesRead = 0;
207 bytesRead = fread(
image->rowStart, 1,
x,
image->file);
209 bytesRead = fread(
image->rowSize, 1,
x,
image->file);
217 image->rowStart = NULL;
218 image->rowSize = NULL;
◆ latorgba()
static void VP1QtInventorUtils::Imp::latorgba |
( |
unsigned char * |
b, |
|
|
unsigned char * |
a, |
|
|
unsigned char * |
l, |
|
|
int |
n |
|
) |
| |
|
inlinestatic |
◆ read_texture()
static unsigned* VP1QtInventorUtils::Imp::read_texture |
( |
const char * |
name, |
|
|
int * |
width, |
|
|
int * |
height, |
|
|
int * |
components |
|
) |
| |
|
inlinestatic |
Definition at line 285 of file VP1QtInventorUtils.cxx.
287 unsigned *
base, *lptr;
288 unsigned char *rbuf, *gbuf, *bbuf, *abuf;
297 (*width)=
image->xsize;
298 (*height)=
image->ysize;
299 (*components)=
image->zsize;
300 const unsigned int imageWidth =
image->xsize;
301 const unsigned int imageHeight =
image->ysize;
302 const unsigned int uintSize(
sizeof(
unsigned)), ucharSize(
sizeof(
unsigned char));
303 const unsigned int colourBufSize=imageWidth*ucharSize;
304 base =
reinterpret_cast<unsigned *
>(
malloc(imageWidth*imageHeight*uintSize));
305 rbuf = ucharAddress(
malloc(colourBufSize));
306 gbuf = ucharAddress(
malloc(colourBufSize));
307 bbuf = ucharAddress(
malloc(colourBufSize));
308 abuf = ucharAddress(
malloc(colourBufSize));
309 if(!
base || !rbuf || !gbuf || !bbuf) {
312 if (rbuf) free(rbuf);
313 if (gbuf) free(gbuf);
314 if (bbuf) free(bbuf);
315 if (abuf) free(abuf);
320 if (
image->zsize>=4) {
326 lptr +=
image->xsize;
327 }
else if(
image->zsize==3) {
332 lptr +=
image->xsize;
333 }
else if(
image->zsize==2) {
337 lptr +=
image->xsize;
341 lptr +=
image->xsize;
350 return (
unsigned *)
base;
◆ rgbatorgba()
static void VP1QtInventorUtils::Imp::rgbatorgba |
( |
unsigned char * |
r, |
|
|
unsigned char * |
g, |
|
|
unsigned char * |
b, |
|
|
unsigned char * |
a, |
|
|
unsigned char * |
l, |
|
|
int |
n |
|
) |
| |
|
inlinestatic |
◆ rgbtorgba()
static void VP1QtInventorUtils::Imp::rgbtorgba |
( |
unsigned char * |
r, |
|
|
unsigned char * |
g, |
|
|
unsigned char * |
b, |
|
|
unsigned char * |
l, |
|
|
int |
n |
|
) |
| |
|
inlinestatic |
◆ allowedLineWidthGranularity
double VP1QtInventorUtils::Imp::allowedLineWidthGranularity = -1.0 |
|
static |
◆ allowedLineWidthMax
double VP1QtInventorUtils::Imp::allowedLineWidthMax = -1.0 |
|
static |
◆ allowedLineWidthMin
double VP1QtInventorUtils::Imp::allowedLineWidthMin = -1.0 |
|
static |
◆ allowedPointSizeGranularity
double VP1QtInventorUtils::Imp::allowedPointSizeGranularity = -1.0 |
|
static |
◆ allowedPointSizeMax
double VP1QtInventorUtils::Imp::allowedPointSizeMax = -1.0 |
|
static |
◆ allowedPointSizeMin
double VP1QtInventorUtils::Imp::allowedPointSizeMin = -1.0 |
|
static |
◆ buffer
char * VP1QtInventorUtils::Imp::buffer = 0 |
|
static |
◆ buffer_size
size_t VP1QtInventorUtils::Imp::buffer_size = 0 |
|
static |
◆ lineWidthAndPointSizeNeedsInit
bool VP1QtInventorUtils::Imp::lineWidthAndPointSizeNeedsInit = true |
|
static |
The documentation for this class was generated from the following file: