VMTK
Loading...
Searching...
No Matches
vtkvmtkPNGWriter.cxx File Reference
#include "vtkvmtkPNGWriter.h"
#include "vtkUnsignedCharArray.h"
#include "vtkImageData.h"
#include "vtkPointData.h"
#include "vtkErrorCode.h"
#include "vtkObjectFactory.h"
#include "vtkVersion.h"
#include "vtkInformation.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include <math.h>
#include <string.h>
Include dependency graph for vtkvmtkPNGWriter.cxx:

Go to the source code of this file.

Functions

long base64_encode (char *to, char *from, unsigned int len)
 vtkStandardNewMacro (vtkvmtkPNGWriter)

Variables

char b64string []

Function Documentation

◆ base64_encode()

long base64_encode ( char * to,
char * from,
unsigned int len )

Definition at line 41 of file vtkvmtkPNGWriter.cxx.

42{
43 char *fromp = from;
44 char *top = to;
45 unsigned char cbyte;
46 unsigned char obyte;
47 char end[3];
48
49 for (; len >= 3; len -= 3) {
50 cbyte = *fromp++;
51 *top++ = b64string[(int)(cbyte >> 2)];
52 obyte = (cbyte << 4) & 0x30; /* 0011 0000 */
53
54 cbyte = *fromp++;
55 obyte |= (cbyte >> 4); /* 0000 1111 */
56 *top++ = b64string[(int)obyte];
57 obyte = (cbyte << 2) & 0x3C; /* 0011 1100 */
58
59 cbyte = *fromp++;
60 obyte |= (cbyte >> 6); /* 0000 0011 */
61 *top++ = b64string[(int)obyte];
62 *top++ = b64string[(int)(cbyte & 0x3F)];/* 0011 1111 */
63 }
64
65 if (len) {
66 end[0] = *fromp++;
67 if (--len) end[1] = *fromp++; else end[1] = 0;
68 end[2] = 0;
69
70 cbyte = end[0];
71 *top++ = b64string[(int)(cbyte >> 2)];
72 obyte = (cbyte << 4) & 0x30; /* 0011 0000 */
73
74 cbyte = end[1];
75 obyte |= (cbyte >> 4);
76 *top++ = b64string[(int)obyte];
77 obyte = (cbyte << 2) & 0x3C; /* 0011 1100 */
78
79 if (len) *top++ = b64string[(int)obyte];
80 else *top++ = '=';
81 *top++ = '=';
82 }
83 *top = 0;
84 return top - to;
85}
char b64string[]

◆ vtkStandardNewMacro()

vtkStandardNewMacro ( vtkvmtkPNGWriter )

Variable Documentation

◆ b64string

char b64string[]
Initial value:
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

Definition at line 38 of file vtkvmtkPNGWriter.cxx.