|
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 | ConvertShort (unsigned short *array, long length) |
|
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 53 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 1405 of file VP1QtInventorUtils.cxx.
1407 SoToVRML2Action vwa;
1410 SoVRMLGroup * newroot = vwa.getVRML2SceneGraph();
1414 out.setHeaderString(
"#VRML V2.0 utf8");
1415 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 602 of file VP1QtInventorUtils.cxx.
604 if (im_black_bgd.isNull()||im_white_bgd.isNull()||im_black_bgd.size()!=im_white_bgd.size())
607 QImage
im(im_black_bgd.size(),QImage::Format_ARGB32);
610 int height =
im.height();
611 QRgb white = qRgba(255,255,255,255);
612 QRgb black = qRgba(0,0,0,255);
615 for (
int y = 0;
y < height; ++
y) {
616 if (im_black_bgd.pixel(
x,
y)==im_white_bgd.pixel(
x,
y)) {
617 im.setPixel(
x,
y,im_white_bgd.pixel(
x,
y));
618 }
else if (im_black_bgd.pixel(
x,
y)==black&&im_white_bgd.pixel(
x,
y)==white) {
619 im.setPixel(
x,
y,Qt::transparent);
622 QColor pix_b = QColor(im_black_bgd.pixel(
x,
y));
623 QColor pix_w = QColor(im_white_bgd.pixel(
x,
y));
624 qreal alpha = 1.0 - pix_w.redF() + pix_b.redF();
626 im.setPixel(
x,
y,Qt::transparent);
628 im.setPixel(
x,
y,qRgba(
static_cast<int>(pix_b.redF()/alpha*255+0.5),
629 static_cast<int>(pix_b.greenF()/alpha*255+0.5),
630 static_cast<int>(pix_b.blueF()/alpha*255+0.5),
631 static_cast<int>(alpha*255+0.5)));
◆ ConvertLong()
static void VP1QtInventorUtils::Imp::ConvertLong |
( |
unsigned * |
array, |
|
|
long |
length |
|
) |
| |
|
inlinestatic |
◆ ConvertShort()
static void VP1QtInventorUtils::Imp::ConvertShort |
( |
unsigned short * |
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 243 of file VP1QtInventorUtils.cxx.
246 unsigned char *iPtr, *oPtr,
pixel;
250 if ((
image->type & 0xFF00) == 0x0100) {
252 int okseek = fseek(
image->file, (
long)
image->rowStart[
y+
z*
image->ysize], SEEK_SET);
253 int okread = fread(
image->tmp, 1, (
unsigned int)
image->rowSize[
y+
z*
image->ysize],
279 int okstatus = fseek(
image->file, 512
u+yDim+zDim, SEEK_SET);
282 size_t bytesRead = 0;
283 bytesRead = fread(buf, 1,
image->xsize,
image->file);
289 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 148 of file VP1QtInventorUtils.cxx.
157 endianTest.testWord = 1;
158 if (endianTest.testByte[0] == 1) {
166 fprintf(
stderr,
"Out of memory!\n");
174 int bytesRead = fread(
image, 1, 12,
image->file);
177 fprintf(
stderr,
"fread failed!\n");
189 const unsigned int colourBuffSize=
image->xsize*256
u;
190 image->tmp = (
unsigned char *)
malloc(colourBuffSize);
191 image->tmpR = (
unsigned char *)
malloc(colourBuffSize);
192 image->tmpG = (
unsigned char *)
malloc(colourBuffSize);
193 image->tmpB = (
unsigned char *)
malloc(colourBuffSize);
194 if (
image->tmp == NULL ||
image->tmpR == NULL ||
image->tmpG == NULL ||
195 image->tmpB == NULL) {
196 fprintf(
stderr,
"Out of memory!\n");
201 if ((
image->type & 0xFF00) == 0x0100) {
202 size_t x = ((size_t)
image->ysize * (
size_t)
image->zsize) *
sizeof(
unsigned);
205 if (
image->rowStart == NULL ||
image->rowSize == NULL) {
206 fprintf(
stderr,
"Out of memory!\n");
209 image->rleEnd = 512 + (2 *
x);
210 const int fseekRetVal= fseek(
image->file, 512, SEEK_SET);
211 if (fseekRetVal !=0){
212 fprintf(
stderr,
"Something very wrong with fseek near line 205 of VP1QtInventorUtils.cxx");
214 size_t bytesRead = 0;
215 bytesRead = fread(
image->rowStart, 1,
x,
image->file);
217 bytesRead = fread(
image->rowSize, 1,
x,
image->file);
225 image->rowStart = NULL;
226 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 293 of file VP1QtInventorUtils.cxx.
295 unsigned *
base, *lptr;
296 unsigned char *rbuf, *gbuf, *bbuf, *abuf;
305 (*width)=
image->xsize;
306 (*height)=
image->ysize;
307 (*components)=
image->zsize;
308 const unsigned int imageWidth =
image->xsize;
309 const unsigned int imageHeight =
image->ysize;
310 const unsigned int uintSize(
sizeof(
unsigned)), ucharSize(
sizeof(
unsigned char));
311 const unsigned int colourBufSize=imageWidth*ucharSize;
312 base = (
unsigned *)
malloc(imageWidth*imageHeight*uintSize);
313 rbuf = (
unsigned char *)
malloc(colourBufSize);
314 gbuf = (
unsigned char *)
malloc(colourBufSize);
315 bbuf = (
unsigned char *)
malloc(colourBufSize);
316 abuf = (
unsigned char *)
malloc(colourBufSize);
317 if(!
base || !rbuf || !gbuf || !bbuf) {
320 if (rbuf) free(rbuf);
321 if (gbuf) free(gbuf);
322 if (bbuf) free(bbuf);
323 if (abuf) free(abuf);
328 if (
image->zsize>=4) {
334 lptr +=
image->xsize;
335 }
else if(
image->zsize==3) {
340 lptr +=
image->xsize;
341 }
else if(
image->zsize==2) {
345 lptr +=
image->xsize;
349 lptr +=
image->xsize;
358 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: