21 class SubdivisionLevel;
36 unsigned short m_bits;
37 void setBits(
unsigned short newbits) { m_bits = newbits; }
43 unsigned int x = *(
unsigned int *)&f;
44 unsigned int frac = (x >> 13) & 0x03ff;
45 int exp = (
int)((x >> 23) & 0xff) - 127;
47 m_bits = (x >> 16) & 0x8000;
52 }
else if (exp <= -15) {
57 m_bits |= ((exp + 15) << 10) | frac;
62 #define ExponentBiasDelta (127-15)
63 operator float ()
const
65 int exp = (m_bits >> 10) & 0x1f;
66 unsigned int f = (m_bits & 0x8000) << 16;
67 unsigned int frac = (m_bits & 0x03ff) << 13;
71 }
else if (exp == 0) {
127 operator float ()
const {
return m_data * (1.0f/255.0f); }
129 operator uInt16 ()
const {
return (m_data << 8) + m_data; }
130 operator uInt8 ()
const {
return m_data; }
169 operator float ()
const {
return m_data * (1.0f/65535.0f); }
171 operator uInt16 ()
const {
return m_data; }
192 *(
float *)
this = *(
float *)&d;
220 operator float ()
const {
return m_data; }
224 if (m_data < 0.0
f)
return 0;
225 if (m_data > 1.0
f)
return 65535;
226 return uInt16(m_data * 65535.0
f);
230 if (m_data < 0.0
f)
return 0;
231 if (m_data > 1.0
f)
return 255;
232 return uInt8(m_data * 255.0
f);
259 *(uInt16 *)
this = *(uInt16 *)&d;
281 operator float ()
const {
return float(m_data); }
282 operator half_ ()
const {
return m_data; }
285 {
float d = float(m_data);
286 if (d < 0.0
f)
return 0;
287 if (d > 1.0
f)
return 65535;
291 {
float d = float(m_data);
292 if (d < 0.0
f)
return 0;
293 if (d > 1.0
f)
return 255;
365 template <
class ChanType, const
unsigned char NumChans>
390 ChanType m_pixel[NumChans];
397 ChanType
t = m_pixel[0];
398 m_pixel[0] = m_pixel[2];
408 case 2: m_pixel[1] =
p.m_pixel[3];
409 case 1: m_pixel[0] = ChanType(
uInt16Channel((uInt8)
p.m_pixel[0]*77 +
410 (uInt8)
p.m_pixel[1]*150 +
411 (uInt8)
p.m_pixel[2]*28));
414 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
415 m_pixel[2] =
p.m_pixel[2];
417 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
418 m_pixel[2] =
p.m_pixel[2]; m_pixel[3] =
p.m_pixel[3];
428 case 1: m_pixel[0] = ChanType(
uInt16Channel((uInt8)
p.m_pixel[0]*77 +
429 (uInt8)
p.m_pixel[1]*150 +
430 (uInt8)
p.m_pixel[2]*28));
432 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
433 m_pixel[2] =
p.m_pixel[2];
435 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
436 m_pixel[2] =
p.m_pixel[2];
446 case 1: m_pixel[0] =
p.m_pixel[0];
448 case 2: m_pixel[0] =
p.m_pixel[0];
449 m_pixel[1] =
p.m_pixel[1];
451 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
452 m_pixel[2] =
p.m_pixel[0];
454 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
455 m_pixel[2] =
p.m_pixel[0];
456 m_pixel[3] =
p.m_pixel[1];
466 case 1: m_pixel[0] =
p.m_pixel[0];
468 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
469 m_pixel[2] =
p.m_pixel[0];
471 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
483 case 2: m_pixel[1] =
p.m_pixel[3];
484 case 1: m_pixel[0] = ChanType(
uInt16Channel((((uInt16)
p.m_pixel[0]*19660)>>16) +
485 (((uInt16)
p.m_pixel[1]*38666)>>16) +
486 (((uInt16)
p.m_pixel[2]*7209 )>>16)));
489 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
490 m_pixel[2] =
p.m_pixel[2];
492 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
493 m_pixel[2] =
p.m_pixel[2]; m_pixel[3] =
p.m_pixel[3];
503 case 1: m_pixel[0] = ChanType(
uInt16Channel((((uInt16)
p.m_pixel[0]*19660)>>16) +
504 (((uInt16)
p.m_pixel[1]*38666)>>16) +
505 (((uInt16)
p.m_pixel[2]*7209 )>>16)));
507 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
508 m_pixel[2] =
p.m_pixel[2];
510 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
511 m_pixel[2] =
p.m_pixel[2];
521 case 1: m_pixel[0] =
p.m_pixel[0];
523 case 2: m_pixel[0] =
p.m_pixel[0];
524 m_pixel[1] =
p.m_pixel[1];
526 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
527 m_pixel[2] =
p.m_pixel[0];
529 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
530 m_pixel[2] =
p.m_pixel[0];
531 m_pixel[3] =
p.m_pixel[1];
541 case 1: m_pixel[0] =
p.m_pixel[0];
543 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
544 m_pixel[2] =
p.m_pixel[0];
546 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
557 case 2: m_pixel[1] =
p.m_pixel[1];
558 case 1: m_pixel[0] = ChanType(
float32Channel(((
float)
p.m_pixel[0]*0.30f) +
559 ((
float)
p.m_pixel[1]*0.59f) +
560 ((
float)
p.m_pixel[2]*0.11f)));
562 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
563 m_pixel[2] =
p.m_pixel[2];
565 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
566 m_pixel[2] =
p.m_pixel[2]; m_pixel[3] =
p.m_pixel[3];
576 case 1: m_pixel[0] = ChanType(
float32Channel(((
float)
p.m_pixel[0]*0.30f) +
577 ((
float)
p.m_pixel[1]*0.59f) +
578 ((
float)
p.m_pixel[2]*0.11f)));
580 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
581 m_pixel[2] =
p.m_pixel[2];
583 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
584 m_pixel[2] =
p.m_pixel[2];
594 case 1: m_pixel[0] =
p.m_pixel[0];
596 case 2: m_pixel[0] =
p.m_pixel[0];
597 m_pixel[1] =
p.m_pixel[1];
599 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
600 m_pixel[2] =
p.m_pixel[0];
602 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
603 m_pixel[2] =
p.m_pixel[0];
604 m_pixel[3] =
p.m_pixel[1];
614 case 1: m_pixel[0] =
p.m_pixel[0];
616 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
617 m_pixel[2] =
p.m_pixel[0];
619 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
630 case 2: m_pixel[1] =
p.m_pixel[3];
631 case 1: m_pixel[0] = ChanType(
float32Channel(((
float)
p.m_pixel[0]*0.30f) +
632 ((
float)
p.m_pixel[1]*0.59f) +
633 ((
float)
p.m_pixel[2]*0.11f)));
635 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
636 m_pixel[2] =
p.m_pixel[2];
638 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
639 m_pixel[2] =
p.m_pixel[2]; m_pixel[3] =
p.m_pixel[3];
649 case 1: m_pixel[0] = ChanType(
float32Channel(((
float)
p.m_pixel[0]*0.30f) +
650 ((
float)
p.m_pixel[1]*0.59f) +
651 ((
float)
p.m_pixel[2]*0.11f)));
653 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
654 m_pixel[2] =
p.m_pixel[2];
656 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[1];
657 m_pixel[2] =
p.m_pixel[2];
667 case 1: m_pixel[0] =
p.m_pixel[0];
669 case 2: m_pixel[0] =
p.m_pixel[0];
670 m_pixel[1] =
p.m_pixel[1];
672 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
673 m_pixel[2] =
p.m_pixel[0];
675 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
676 m_pixel[2] =
p.m_pixel[0];
677 m_pixel[3] =
p.m_pixel[1];
687 case 1: m_pixel[0] =
p.m_pixel[0];
689 case 3: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
690 m_pixel[2] =
p.m_pixel[0];
692 case 4: m_pixel[0] =
p.m_pixel[0]; m_pixel[1] =
p.m_pixel[0];
702 m_pixel[0] = m_pixel[1] = m_pixel[2] =
703 m_pixel[3] = ChanType(
uInt16Channel(((uInt8)p.m_pixel[0]*77 +
704 (uInt8)p.m_pixel[1]*150 +
705 (uInt8)p.m_pixel[2]*28)));
713 m_pixel[0] = m_pixel[1] = m_pixel[2] =
714 m_pixel[3] = ChanType(
uInt16Channel(((uInt8)p.m_pixel[0]*77 +
715 (uInt8)p.m_pixel[1]*150 +
716 (uInt8)p.m_pixel[2]*28)));
724 m_pixel[0] = m_pixel[1] = m_pixel[2] =
725 m_pixel[3] = ChanType(
uInt16Channel(((((uInt16)p.m_pixel[0]*19660)>>16) +
726 (((uInt16)p.m_pixel[1]*38666)>>16) +
727 (((uInt16)p.m_pixel[2]*7209 )>>16))));
735 m_pixel[0] = m_pixel[1] = m_pixel[2] =
736 m_pixel[3] = ChanType(
uInt16Channel(((((uInt16)p.m_pixel[0]*19660)>>16) +
737 (((uInt16)p.m_pixel[1]*38666)>>16) +
738 (((uInt16)p.m_pixel[2]*7209 )>>16))));
747 m_pixel[0] = m_pixel[1] = m_pixel[2] =
748 m_pixel[3] = ChanType(
float32Channel((((
float)p.m_pixel[0]*0.30f) +
749 ((
float)p.m_pixel[1]*0.59f) +
750 ((
float)p.m_pixel[2]*0.11f))));
758 m_pixel[0] = m_pixel[1] = m_pixel[2] =
759 m_pixel[3] = ChanType(
float32Channel((((
float)p.m_pixel[0]*0.30f) +
760 ((
float)p.m_pixel[1]*0.59f) +
761 ((
float)p.m_pixel[2]*0.11f))));
769 m_pixel[0] = m_pixel[1] = m_pixel[2] =
770 m_pixel[3] = ChanType(
float32Channel((((
float)p.m_pixel[0]*0.30f) +
771 ((
float)p.m_pixel[1]*0.59f) +
772 ((
float)p.m_pixel[2]*0.11f))));
780 m_pixel[0] = m_pixel[1] = m_pixel[2] =
781 m_pixel[3] = ChanType(
float32Channel((((
float)p.m_pixel[0]*0.30f) +
782 ((
float)p.m_pixel[1]*0.59f) +
783 ((
float)p.m_pixel[2]*0.11f))));
791 m_pixel[0] = m_pixel[1] = m_pixel[2] =
800 m_pixel[0] = m_pixel[1] = m_pixel[2] =
809 m_pixel[0] = m_pixel[1] = m_pixel[2] =
810 m_pixel[3] = ChanType(
uInt16Channel(((uInt16)p.m_pixel[0])));
818 m_pixel[0] = m_pixel[1] = m_pixel[2] =
819 m_pixel[3] = ChanType(
uInt8Channel(((uInt8)p.m_pixel[0])));
828 m_pixel[0] = m_pixel[1] = m_pixel[2] =
830 ((uInt8)p.m_pixel[0]*77 +
831 (uInt8)p.m_pixel[1]*150 +
832 (uInt8)p.m_pixel[2]*28)));
840 m_pixel[0] = m_pixel[1] = m_pixel[2] =
842 ((uInt8)p.m_pixel[0]*77 +
843 (uInt8)p.m_pixel[1]*150 +
844 (uInt8)p.m_pixel[2]*28)));
852 m_pixel[0] = m_pixel[1] = m_pixel[2] =
854 ((((uInt16)p.m_pixel[0]*19660)>>16) +
855 (((uInt16)p.m_pixel[1]*38666)>>16) +
856 (((uInt16)p.m_pixel[2]*7209 )>>16))));
864 m_pixel[0] = m_pixel[1] = m_pixel[2] =
866 ((((uInt16)p.m_pixel[0]*19660)>>16) +
867 (((uInt16)p.m_pixel[1]*38666)>>16) +
868 (((uInt16)p.m_pixel[2]*7209 )>>16))));
877 m_pixel[0] = m_pixel[1] = m_pixel[2] =
879 (((
float)p.m_pixel[0]*0.30f) +
880 ((
float)p.m_pixel[1]*0.59f) +
881 ((
float)p.m_pixel[2]*0.11f))));
889 m_pixel[0] = m_pixel[1] = m_pixel[2] =
891 (((
float)p.m_pixel[0]*0.30f) +
892 ((
float)p.m_pixel[1]*0.59f) +
893 ((
float)p.m_pixel[2]*0.11f))));
901 m_pixel[0] = m_pixel[1] = m_pixel[2] =
903 (((
float)p.m_pixel[0]*0.30f) +
904 ((
float)p.m_pixel[1]*0.59f) +
905 ((
float)p.m_pixel[2]*0.11f))));
913 m_pixel[0] = m_pixel[1] = m_pixel[2] =
914 m_pixel[3] = ChanType(
float32Channel(1.0
f - (((
float)p.m_pixel[0]*0.30f) +
915 ((
float)p.m_pixel[1]*0.59f) +
916 ((
float)p.m_pixel[2]*0.11f))));
924 m_pixel[0] = m_pixel[1] = m_pixel[2] =
933 m_pixel[0] = m_pixel[1] = m_pixel[2] =
942 m_pixel[0] = m_pixel[1] = m_pixel[2] =
943 m_pixel[3] = ChanType(
uInt16Channel(65535 - ((uInt16)p.m_pixel[0])));
951 m_pixel[0] = m_pixel[1] = m_pixel[2] =
952 m_pixel[3] = ChanType(
uInt8Channel(255 - ((uInt8)p.m_pixel[0])));
969 inline ImgTile() : x(0), y(0), nx(0), ny(0) {}
978 inline ImgTile(
int X,
int Y,
int NX,
int NY) : x(X), y(Y), nx(NX), ny(NY) {}
981 #define MAX(a_, b_) (((a_) > (b_)) ? (a_) : (b_))
984 #define MIN(a_, b_) (((a_) < (b_)) ? (a_) : (b_))
998 if (nx <= 0 || ny <= 0) x = y = nx = ny = 0;
1002 {
return x == t.
x && y == t.
y && nx == t.
nx && ny == t.
ny; }
1005 {
return x == t.
x && y == t.
y && nx == t.
nx && ny == t.
ny; }
1008 {
return !(t == *
this); }
1011 inline bool isEmpty()
const {
return nx <= 0 || ny <= 0; }
1017 {
return x <= a.
x && a.
x+a.
nx <= x+nx &&
1018 y <= a.
y && a.
y+a.
ny <= y+
ny;
1023 {
return x <= x_ && x_ < x+nx && y <= y_ && y_ < y+
ny;
1031 if (nx < 0) x = y = nx = ny = 0;
1035 if (ny < 0) x = y = nx = ny = 0;
1043 x = x_; y = y_; nx = 1; ny = 1;
1045 if (x_ < x) { nx += (x - x_); x = x_; }
1046 if (y_ < y) { ny += (y - y_); y = y_; }
1048 if (x + nx < x_) nx = (x_ -
x) + 1;
1049 if (y + ny < y_) ny = (y_ -
y) + 1;
1056 x -= numPixels; y -= numPixels;
1058 nx += numPixels; ny += numPixels;
1067 #define MAX_DIRTY_REGION (8192+128) // same as max texture size...
1068 #define DIRTY_REGION_GRANULARITY 128 // make this a power of 2.
1069 #define DIRTY_REGION_MASK (DIRTY_REGION_GRANULARITY-1)
1070 #define DIRTY_REGION_SHIFT 7
1071 #define DIRTY_REGION_XY_SIZE ( MAX_DIRTY_REGION / DIRTY_REGION_GRANULARITY )
1091 void ComputeDirtyTiles();
1094 void ClearDirtyTiles()
1096 if (m_DirtyTiles)
delete [] m_DirtyTiles;
1097 m_NumTiles = 0; m_DirtyTiles = 0;
1101 char *Index(
int x,
int y)
1107 char Set(
int x,
int y) {
char c = *Index(x, y); *Index(x, y) = 1;
return c; }
1110 char Get(
int x,
int y) {
return *Index(x, y); }
1118 void AddToDirtyRegion(
const ImgTile &dirtyTile);
1133 if (!m_DirtyTiles) ComputeDirtyTiles();
1140 return m_DirtyTiles[i];
1146 return m_DirtyTotalChunks;
1166 int ax1, ax2, bx1, bx2;
1167 int ay1, ay2, by1, by2;
1173 ax1 (A.
x), ax2 (A.
x + A.
nx - 1),
1174 bx1 (B.
x), bx2 (B.
x + B.
nx - 1),
1175 ay1 (A.
y), ay2 (A.
y + A.
ny - 1),
1176 by1 (B.
y), by2 (B.
y + B.
ny - 1),
1178 ad (A.
nx <= 0 || A.
ny <= 0),
1179 bd (B.
nx <= 0 || B.
ny <= 0) {}
1181 virtual bool next();
1218 virtual bool next();
1241 virtual bool next();
1297 , m_channelType (channelType)
1298 , m_channelOrder (channelOrder)
1299 , m_PreMultiplied(PreMultiplied) {}
1303 static const unsigned char s_channelByteCount[] = {1, 2, 2, 4, 1, 2, 4, 4, 8};
1340 {
return (m_cCount == pd.
m_cCount &&
1384 bool premult =
true,
1387 m_Bounds(x, y, nx, ny),
1388 m_xResolution(100.0
f), m_yResolution(100.0
f),
1403 bool premult =
true,
1406 m_Bounds(0, 0, nx, ny) {}
1411 m_Bounds(0,0,0,0) {}
1460 m_xResolution = xRes; m_yResolution = yRes, m_ResolutionUnits = unit;
1476 #define MAX_PROXY_LEVEL 4
1536 virtual ~
Image(
void );
1542 unsigned char m_FillPixel[16];
1556 if (m_pProxyImages[i]) {
1557 delete m_pProxyImages[i]; m_pProxyImages[i] = 0;
1562 virtual bool regenerateProxy();
1564 {
return (m_ProxyLevel > 0) ? (m_pProxyImages[m_ProxyLevel] == 0) :
false; }
1578 virtual bool GenerateProxy(
Image *targetImg,
int level,
bool DownsampleTo8Bits =
true);
1587 virtual bool isAllocated()
const;
1591 static QString AllSupportedExtensions(
bool bRGBAOnly =
false,
1610 if (m_bDownsampleProxyTo8Bit != downsampleTo8Bit) {
1611 m_bDownsampleProxyTo8Bit = downsampleTo8Bit;
1625 { m_pProxyIntFcn = fcnPtr; }
1639 if ( xSize()>>newLevel == 0 || ySize()>>newLevel == 0 )
1642 if (newLevel != m_ProxyLevel) {
1643 m_ProxyLevel = newLevel;
1656 if (m_ProxyLevel == 0)
return this;
1658 if ( m_pProxyImages[m_ProxyLevel] )
return m_pProxyImages[m_ProxyLevel];
1660 bool generated = regenerateProxy();
1661 if (!generated && m_pProxyImages[m_ProxyLevel] != 0) {
1662 delete m_pProxyImages[m_ProxyLevel];
1663 m_pProxyImages[m_ProxyLevel] = 0;
1665 return m_pProxyImages[m_ProxyLevel];
1678 int curWidth()
const {
return Width() >> getProxyLevel(); }
1681 int curHeight()
const {
return Height() >> getProxyLevel(); }
1700 void getFillColor(
void *fillPixel,
const PixelDescriptor *pd = 0)
const;
1713 void setFillColor(
const void *fillPixel,
const PixelDescriptor *pd = 0);
1735 { getTile(
ImgTile(x, y, nx, ny), data, pd); }
1763 int dx,
int dy,
int dnx,
int dny,
1765 { getSubTile(
ImgTile(x, y, nx, ny), data,
ImgTile(dx, dy, dnx, dny), pd); }
1786 { getSubTile(srcTile, data, srcTile, pd); }
1807 virtual void getSubTile(
const ImgTile &srcTile,
void *
data,
1835 { setTile(
ImgTile(x, y, nx, ny), data, pd); }
1865 int dx,
int dy,
int dnx,
int dny,
1867 { setSubTile(
ImgTile(x, y, nx, ny), data,
ImgTile(dx, dy, dnx, dny), pd); }
1887 { setSubTile(dstTile, data, dstTile, pd); }
1908 virtual void setSubTile(
const ImgTile &dstTile,
const void *
data,
1939 { copyTile(
ImgTile(x, y, nx, ny), fromImg, ox, oy); }
1964 virtual void copyTile(
const ImgTile &dstTile,
Image &fromImg,
1984 copyTile(srcBounds, fromImg, srcBounds.x, srcBounds.y);
1988 virtual void Clear();
2018 { fillTile(
ImgTile(x, y, nx, ny), pixelData, pd, maskTile); }
2040 void fillTile(
const ImgTile &dstTile,
const void *pixelData,
2063 virtual void fillTile(
const ImgTile &dstTile,
2064 const void *pixelData,
2077 virtual void getPageSize(
int &
nx,
int &
ny);
2093 {
return getPageIterator(
ImgTile(x, y, nx, ny)); }
2125 {
return lockPageSet(
ImgTile(x, y, nx, ny), mode); }
2145 static void ConvertPixels(
void *
dst,
const void *
src,
int numPix,
2150 void CopyInverseLuminance(
const Image &srcImage);
2153 void CopyLuminance(
const Image &srcImage);
2156 virtual void PutInverseLuminance(
Image &targetImage)
const;
2159 virtual void PutLuminance(
Image &targetImage)
const;
2177 virtual QString SupportedExtensions(
bool bRGBAOnly =
false,
2181 QString sDelimiter =
";")
const;
2187 virtual void Create(
unsigned int iWidth,
unsigned int iHeight,
2188 unsigned int iChannelCount, Format eFormat = e8integer,
2195 virtual void Load(
const QString &sFileName,
int iLayerIndex = 0,
bool tiled =
false );
2197 virtual bool GetPSDLayerMeta (
void *pPSDFile,
int iLayerIndex,
2198 QString &layerName,
int &blendMode,
2199 float &opacity,
bool &locked,
2200 bool &visible,
bool &transLocked);
2209 virtual bool LoadPSDLayer (
void *pPSDFile,
2212 bool premult =
true );
2215 virtual Image *ComputeDifferenceMask(
Image *otherImg,
int expansionRadius,
2216 int AARadius,
bool &anyDiffs);
2226 virtual bool SavePSDLayerMeta (
void *pPSDFile,
2229 float opacity = 1.0
f,
2230 bool visible =
true,
2231 bool locked =
false,
2234 int blendMode = -1);
2245 virtual bool SavePSDLayer (
void *pPSDFile,
2248 float opacity = 1.0
f,
2249 bool visible =
true,
2250 bool locked =
false,
2251 bool needs_unpremult =
true,
2260 virtual void *OpenPSDFile(
const QString &pFileName,
bool writing =
false);
2264 virtual bool GetPSDFileInfo(
void *psdFile,
int *
width,
int *
height,
int *numChannels,
2265 int *bitDepth,
int *numLayers,
int *curLayer);
2269 virtual bool SetPSDFileInfo(
void *psdFile,
int width,
int height,
int numChannels,
2270 int bitDepth,
int numLayers,
int curLayer);
2273 virtual bool ClosePSDFile(
void *psdFile);
2283 virtual void Save(
const QString &sFileName,
bool bForce =
true,
2285 float uStart = 0.0
f,
float vStart = 0.0
f,
2286 bool force_1_Channel_To_4_Channel =
false);
2289 virtual unsigned int Width(
void )
const;
2292 virtual unsigned int Height(
void )
const;
2295 virtual Format Format(
void )
const;
2298 virtual unsigned int ChannelCount(
void )
const;
2301 virtual unsigned int BytesPerPixel(
void )
const;
2304 unsigned int curBytesPerPixel()
const {
return (getProxyLevel() != 0) ? ChannelCount() : BytesPerPixel(); }
2307 virtual unsigned int TotalBytes(
void )
const;
2310 unsigned int curTotalBytes(
void)
const {
return curWidth() * curHeight() * curBytesPerPixel(); }
2316 virtual void SetValueAt(
unsigned int iXPos,
unsigned int iYPos,
2317 unsigned int iChannel,
float fValue );
2322 virtual float ValueAt(
unsigned int iXPos,
unsigned int iYPos,
2323 unsigned int iChannel )
const;
2328 virtual float ValueAt(
float fXPos,
float fYPos,
unsigned int iChannel )
const;
2332 virtual void SetColorAt(
unsigned int iXPos,
unsigned int iYPos,
2333 const Color &cColor );
2336 virtual Color ColorAt(
unsigned int iXPos,
unsigned int iYPos )
const;
2339 virtual Color ColorAt(
float fXPos,
float fYPos )
const;
2344 virtual QImage *ConvertToQImage( );
2347 virtual void ConvertFromQImage(
QImage &qImg,
bool tiled =
false);
2352 virtual bool Fragmented()
const;
2355 virtual bool Tiled()
const;
2362 virtual bool NewVersion();
2367 virtual bool PrevVersion();
2372 virtual bool NextVersion();
2375 virtual int NumVersions();
2380 virtual bool MergeOldestVersions();
2386 virtual bool PurgeNewerVersions();
2390 virtual bool PurgeAllButCurrentVersion();
2397 virtual void *Data(
int iRow = -1,
bool writing =
true );
2398 virtual const void *Data(
int iRow = -1,
bool writing =
false )
const;
2406 virtual void DrawUVs(
Material *pMaterial,
2407 float uStart = 0.0
f,
float vStart = 0.0
f,
2408 bool baseLevel =
true);
2413 virtual void scaleTileBilinear_4Chan_uchar(
float x,
float y,
float nx,
float ny,
2415 int dx,
int dy,
int dnx,
int dny,
2416 float xScale,
float yScale)
const;
2426 virtual void GenerateUpscaled(
Image *targetImg,
int factor);
2431 static void MultiplyRGBByAlpha_uc4(
unsigned char *
buffer,
int numPixels);
2434 virtual bool isDirty()
const;
2439 virtual void setDirty();
2442 virtual void setClean();
2445 virtual void VerticalFlip();
2448 virtual void AdjustImageCacheSize();
2451 virtual void ConvertTo4Channel();
2457 AttributePointer<Image> *pImage );
2459 AttributeWidget *AttributePointer<Image>::CreateEditorWidget(
QWidget *pParent,
int iWidth )
2474 virtual bool Load(
const QString &sFileName );
2477 virtual unsigned int ConvertToOpenGLTexture(
void );
2485 #define cu_int const unsigned int
2486 #define u_int unsigned int
2487 #define u_short unsigned short
2488 #define u_char unsigned char
2490 #define inline __forceinline
2495 template <
class ChannelType, cu_
int nch>
2503 ChannelType *m_pData;
2508 m_Stride = parent->
Width();
2509 m_Height = parent->
Height();
2512 m_pData = (ChannelType *)parent->
Data();
2536 template <
class ChannelType, cu_
int nch>
2550 template <
class ChannelType>
2570 template <
class ChannelType>
2589 template <
class ChannelType>
2607 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) )]; }
2610 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) * 2)]; }
2613 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) * 3)]; }
2616 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) * 4)]; }
2620 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) )]; }
2623 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) * 2)]; }
2626 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) * 3)]; }
2629 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) * 4)]; }
2634 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) )]; }
2637 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) * 2)]; }
2640 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) * 3)]; }
2643 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) * 4)]; }
2647 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) )]; }
2650 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) * 2)]; }
2653 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) * 3)]; }
2656 {
return (
void *)&m_pData[Ch + ((X + m_Stride * Y) * 4)]; }
2661 { m_pData[Ch + ((X + m_Stride * Y) )] = (
u_char)(255.0
f * fVal); }
2664 { m_pData[Ch + ((X + m_Stride * Y) * 2)] = (
u_char)(255.0
f * fVal); }
2667 { m_pData[Ch + ((X + m_Stride * Y) * 3)] = (
u_char)(255.0
f * fVal); }
2670 { m_pData[Ch + ((X + m_Stride * Y) * 4)] = (
u_char)(255.0
f * fVal); }
2674 { m_pData[Ch + ((X + m_Stride * Y) )] = (
u_short)(65535.0
f * fVal); }
2677 { m_pData[Ch + ((X + m_Stride * Y) * 2)] = (
u_short)(65535.0
f * fVal); }
2680 { m_pData[Ch + ((X + m_Stride * Y) * 3)] = (
u_short)(65535.0
f * fVal); }
2683 { m_pData[Ch + ((X + m_Stride * Y) * 4)] = (
u_short)(65535.0
f * fVal); }
2688 { m_pData[Ch + ((X + m_Stride * Y) )] = (
u_int)(0xffffffff * fVal); }
2691 { m_pData[Ch + ((X + m_Stride * Y) * 2)] = (
u_int)(0xffffffff * fVal); }
2694 { m_pData[Ch + ((X + m_Stride * Y) * 3)] = (
u_int)(0xffffffff * fVal); }
2697 { m_pData[Ch + ((X + m_Stride * Y) * 4)] = (
u_int)(0xffffffff * fVal); }
2701 { m_pData[Ch + ((X + m_Stride * Y) )] = fVal; }
2704 { m_pData[Ch + ((X + m_Stride * Y) * 2)] = fVal; }
2707 { m_pData[Ch + ((X + m_Stride * Y) * 3)] = fVal; }
2710 { m_pData[Ch + ((X + m_Stride * Y) * 4)] = fVal; }
2714 {
return m_pData[Ch + ((X + m_Stride * Y) )] * (1.0f/255.0f); }
2717 {
return m_pData[Ch + ((X + m_Stride * Y) * 2)] * (1.0f/255.0f); }
2720 {
return m_pData[Ch + ((X + m_Stride * Y) * 3)] * (1.0f/255.0f); }
2723 {
return m_pData[Ch + ((X + m_Stride * Y) * 4)] * (1.0f/255.0f); }
2727 {
return m_pData[Ch + ((X + m_Stride * Y) )] * (1.0f/65535.0f); }
2730 {
return m_pData[Ch + ((X + m_Stride * Y) * 2)] * (1.0f/65535.0f); }
2733 {
return m_pData[Ch + ((X + m_Stride * Y) * 3)] * (1.0f/65535.0f); }
2736 {
return m_pData[Ch + ((X + m_Stride * Y) * 4)] * (1.0f/65535.0f); }
2740 {
return m_pData[Ch + ((X + m_Stride * Y) )] * (1.0f/float(0xffffffff)); }
2743 {
return m_pData[Ch + ((X + m_Stride * Y) * 2)] * (1.0f/float(0xffffffff)); }
2746 {
return m_pData[Ch + ((X + m_Stride * Y) * 3)] * (1.0f/float(0xffffffff)); }
2749 {
return m_pData[Ch + ((X + m_Stride * Y) * 4)] * (1.0f/float(0xffffffff)); }
2753 {
return m_pData[Ch + ((X + m_Stride * Y) )]; }
2756 {
return m_pData[Ch + ((X + m_Stride * Y) * 2)]; }
2759 {
return m_pData[Ch + ((X + m_Stride * Y) * 3)]; }
2762 {
return m_pData[Ch + ((X + m_Stride * Y) * 4)]; }
2770 return Color(ValueAt(X,Y,0), ValueAt(X,Y,1), ValueAt(X,Y,2), ValueAt(X,Y,3));
2777 return Color(ValueAt(X,Y,0), ValueAt(X,Y,1), ValueAt(X,Y,2), ValueAt(X,Y,3));
2784 return Color(ValueAt(X,Y,0), ValueAt(X,Y,1), ValueAt(X,Y,2), ValueAt(X,Y,3));
2791 return Color(ValueAt(X,Y,0), ValueAt(X,Y,1), ValueAt(X,Y,2), 1.0
f);
2798 return Color(ValueAt(X,Y,0), ValueAt(X,Y,1), ValueAt(X,Y,2), 1.0
f);
2805 return Color(ValueAt(X,Y,0), ValueAt(X,Y,1), ValueAt(X,Y,2), 1.0
f);
2811 {
return float(m_pData[Ch + ((X + m_Stride * Y) * 3)]); }
2816 {
return float(m_pData[Ch + ((X + m_Stride * Y) * 4)]); }
2821 { m_pData[Ch + ((X + m_Stride * Y) * 3)] = fVal; }
2826 { m_pData[Ch + ((X + m_Stride * Y) * 4)] = fVal; }
2833 return Color(ValueAt(X,Y,0), ValueAt(X,Y,1), ValueAt(X,Y,2), ValueAt(X,Y,3));
2840 return Color(ValueAt(X,Y,0), ValueAt(X,Y,1), ValueAt(X,Y,2), 1.0
f);
2848 SetValueAt(X, Y, 0, c.
r);
2849 SetValueAt(X, Y, 1, c.
g);
2850 SetValueAt(X, Y, 2, c.
b);
2851 SetValueAt(X, Y, 3, c.
a);
2858 SetValueAt(X, Y, 0, c.
r);
2859 SetValueAt(X, Y, 1, c.
g);
2860 SetValueAt(X, Y, 2, c.
b);
2867 SetValueAt(X, Y, 0, c.
r);
2868 SetValueAt(X, Y, 1, c.
g);
2869 SetValueAt(X, Y, 2, c.
b);
2870 SetValueAt(X, Y, 3, c.
a);
2877 SetValueAt(X, Y, 0, c.
r);
2878 SetValueAt(X, Y, 1, c.
g);
2879 SetValueAt(X, Y, 2, c.
b);
2886 SetValueAt(X, Y, 0, c.
r);
2887 SetValueAt(X, Y, 1, c.
g);
2888 SetValueAt(X, Y, 2, c.
b);
2889 SetValueAt(X, Y, 3, c.
a);
2896 SetValueAt(X, Y, 0, c.
r);
2897 SetValueAt(X, Y, 1, c.
g);
2898 SetValueAt(X, Y, 2, c.
b);
2905 SetValueAt(X, Y, 0, c.
r);
2906 SetValueAt(X, Y, 1, c.
g);
2907 SetValueAt(X, Y, 2, c.
b);
2908 SetValueAt(X, Y, 3, c.
a);
2915 SetValueAt(X, Y, 0, c.
r);
2916 SetValueAt(X, Y, 1, c.
g);
2917 SetValueAt(X, Y, 2, c.
b);
2926 static const int TILE_SNAP = (128-1);
2927 t.
nx += t.
x - 1; t.
ny += t.
y - 1;
2928 t.
x &= ~TILE_SNAP; t.
y &= ~TILE_SNAP;
2929 t.
nx += TILE_SNAP; t.
ny += TILE_SNAP;
2930 t.
nx &= ~TILE_SNAP; t.
ny &= ~TILE_SNAP;
2931 t.
nx -= t.
x; t.
ny -= t.
y;
void SetLuminance(const PixelType< uInt16Channel, 4 > &p)
RGBA = Luminance of input.
ImageDescriptor(int x, int y, int nx, int ny, MemoryChannelOrder order=orderRGBA, bool premult=true, char nc=4, ChannelType ct=uChar)
Constructor – make a descriptor...
void SetInvLuminance(const PixelType< float16Channel, 3 > &p)
RGBA = 1 - Luminance of input.
Describe an image pixel; how to interpret a piece of pixel data.
PixelDescriptor(char cCount, ChannelType channelType, MemoryChannelOrder channelOrder, bool PreMultiplied)
virtual unsigned int Height(void) const
Return the height of the image in pixels.
ImageDescriptor()
default constructor – RGBA, premult, 4 channel uChar, size 0 x 0 pixels.
unsigned int(APIENTRYP PFNGLXGETAGPOFFSETMESAPROC)(const void *pointer)
void SetLuminance(const PixelType< uInt8Channel, 3 > &p)
RGBA = Luminance of input.
void setChannelCount(int c)
set the number of channels – 1, 2, 3, or 4
bool contains(int x_, int y_) const
return true if this tile includes the specified point
int channelCount() const
return the number of channels – 1, 2, 3, or 4
Color ColorAt(u_int X, u_int Y) const
Get the value at a given coordinate.
IEEE754 single precision.
Color ColorAt(u_int X, u_int Y) const
Get the value at a given coordinate.
uInt8Channel(const uInt8Channel &d)
Base class for unit test objects.
#define MBDLL_TEMPLATE_DECL
u_int ChannelCount() const
void copyTile(int x, int y, int nx, int ny, Image &fromImg, int ox, int oy)
Copies a rectangular region of pixels from a source image to this image.
void fillTile(int x, int y, int nx, int ny, void *pixelData, const PixelDescriptor *pd=0, const ImgTile *maskTile=0)
Fills a rectangular region of pixels in the image with a constant color.
bool isEqualTile(const ImgTile &t) const
int nx
x size of the tile (width)
void SetProxyInterruptFunction(ProxyInterruptFunction fcnPtr=0)
When generating proxy images, periodically, the interrupt function will be polled.
Color ColorAt(u_int X, u_int Y) const
Get the value at a given coordinate.
Color ColorAt(u_int X, u_int Y) const
Get the value at a given coordinate.
virtual void * Data(int iRow=-1, bool writing=true)
Get a pointer to the raw data of a row of the image.
float16Channel(const uInt8Channel &d)
S10E5 half precision floating point.
void SetInvLuminance(const PixelType< uInt8Channel, 3 > &p)
RGBA = 1 - Luminance of input.
void SetInvLuminance(const PixelType< uInt8Channel, 1 > &p)
RGBA = 1 - Luminance of input.
ProxyInterruptFunction m_pProxyIntFcn
bool getProxyDownsampleTo8Bit() const
void SetLuminance(const PixelType< uInt16Channel, 3 > &p)
RGBA = Luminance of input.
bool m_PreMultiplied
true if RGB is premultiplied by A
ImageDescriptor m_Descriptor
Format
Image channel datatype type.
int ySize() const
return the y Size of the image
virtual unsigned int Width(void) const
Return the width of the image in pixels.
int cSize() const
Get the channel count of the image.
ImgTile(const ImgTile &a, const ImgTile &b)
Construct a tile by computing the intersection fo the two input tiles.
Describe an image, specifically how to interpret pixel data.
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
Iterate over a specified region of an image in optimal order, and locking it in CPU memory...
ImageDescriptor::MemoryChannelOrder channelOrder() const
Get the channel ordering of the image.
unsigned char m_ProxyLevel
Half precision (16 bit) float class.
int pixelBitSize() const
return the size of a pixel in bits
ImageAccessor(Image *parent)
int numBytes() const
return the number of bytes the raw image pixels will occupy – not necessarily accurate for VirtualIm...
bool isProxyDirty() const
This is the base class for most classes in the Mudbox SDK.
ImageAccessor(Image *parent)
float16Channel(const half_ &d)
float32Channel(const float32Channel &d)
ImageAccessor(Image *parent)
ImageAccessor(Image *parent)
Implement a somewhat smarter image region that a simple rectangle.
const ImgTile & getBounds() const
returns the bounds of the image – the origin of this rect may not be at 0,0
int cSize() const
return the channel count of the image
The data type for a 16 bit float image channel.
float32Channel & operator=(const float32Channel &d)
int ySize() const
Get the y size of the image.
bool m_bDownsampleProxyTo8Bit
void getResolutionInfo(float &xRes, float &yRes, ResUnit &unit) const
return the horizontal and vertical resolution of the image
int xSize() const
Get the x size of the image.
void * AddrAt(u_int X, u_int Y, u_int Ch)
void SetLuminance(const PixelType< float16Channel, 3 > &p)
RGBA = Luminance of input.
IEEE754 double precision (not currently supported)
float32Channel(const uInt8Channel &d)
physically contiguous image or striped
bool operator==(const Attribute &cA, const AttributeInstance< type > &cB)
This operator compares the two attributes and NOT their values.
MBDLL_DECL AttributeWidget * CreateNewImageWidget(QWidget *pParent, int iWidth, AttributePointer< Image > *pImage)
bool contains(const ImgTile &a) const
return true if this tile includes the specified tile
Represents a color with four components: red, green, blue, alpha.
float16Channel & operator=(const float32Channel &d)
ResUnit
Resolution units (mainly used so resolution is preserved in PSD & TIFF files)
int y
y origin of the tile
void SetLuminance(const PixelType< float16Channel, 1 > &p)
RGBA = Luminance of input.
GLsizei GLsizei GLenum GLenum const GLvoid * data
void SetLuminance(const PixelType< uInt16Channel, 1 > &p)
RGBA = Luminance of input.
void getTile(const ImgTile &srcTile, void *data, const PixelDescriptor *pd=0)
Reads a rectangular region of pixels from the image into a buffer.
void SetValueAt(u_int X, u_int Y, u_int Ch, float fVal)
Set value for a specified texel.
void ExpandToInclude(int x_, int y_)
Expand this tile to include the specified point.
unsigned 32 bit int (not currently supported)
MemoryChannelOrder
Describe channel ordering for 4 channel images – these are the order of the channels in memory...
void SetInvLuminance(const PixelType< uInt8Channel, 4 > &p)
RGBA = 1 - Luminance of input.
bool setProxyLevel(unsigned char newLevel)
set the current proxy level
GLenum GLsizei GLsizei height
void ClearDirtyRegion()
clear the dirty region – resets it completely.
float32Channel(const uInt16Channel &d)
void setSubTile(int x, int y, int nx, int ny, const void *data, int dx, int dy, int dnx, int dny, const PixelDescriptor *pd=0)
Writes a rectangular region of pixels from the image into a buffer.
int channelBitSize() const
return the size of a pixel channel in bits
#define DIRTY_REGION_XY_SIZE
PixelType< ChanType, NumChans > & swapRB()
Swap the red and blue channels – converts RGBA to BGRA and back.
static void SnapOutTile(ImgTile &t)
Snaps a tile out to 128 pixel aligned boundaries.
void SetInvLuminance(const PixelType< uInt16Channel, 3 > &p)
RGBA = 1 - Luminance of input.
signed 32 bit int (not currently supported)
bool premultiplied() const
returns true if the RGB values are premultiplied by the A values, false otherwise.
float ValueAt(u_int X, u_int Y, u_int Ch) const
Get the value at a given coordinate.
bool isEmpty() const
return true if the region is empty
char m_cCount
number of channels in the image – 1, 3, or 4
Iterates over a specified region of an image in optimal order.
void SetInvLuminance(const PixelType< float32Channel, 4 > &p)
RGBA = 1 - Luminance of input.
Reverse of RGB for 3 channel images.
void setProxyDownsampleTo8Bit(bool downsampleTo8Bit=true)
The default when generating proxys is to downsample them to 8 bit/channel this can make them signific...
Image * getProxyImage()
get the proxy image.
void setTile(const ImgTile &dstTile, const void *data, const PixelDescriptor *pd=0)
Writes a rectangular region of pixels to the image from a buffer.
int x
x origin of the tile
ChannelType m_channelType
Channel type.
int curWidth() const
get the width of the current proxy level of the image
ImgTile GetTotalBounds() const
return the total bounds of the dirty region as one rectangle.
The ImageAccessorBase class gives you very fast access to pixels when the data type and channel count...
void SetLuminance(const PixelType< uInt8Channel, 4 > &p)
RGBA = Luminance of input.
void getSubTile(int x, int y, int nx, int ny, void *data, int dx, int dy, int dnx, int dny, const PixelDescriptor *pd=0)
Reads a rectangular region of pixels from the image into a buffer.
GLfloat GLfloat GLfloat GLfloat nx
The data type for a 16 bit image channel. 0-65535 maps to 0.0 to 1.0.
ResUnit m_ResolutionUnits
units – 1 == inch, 2 == centimeter (same as in PSD files)
const ImgTile & getBounds() const
return the bounds of the image
bool operator!=(const QByteArray &a1, const QByteArray &a2)
virtual unsigned int ChannelCount(void) const
Return the number of channels in the image.
uInt16Channel(const uInt8Channel &d)
void Expand(int numPixels=1)
Grow the tile by the specified number of pixels on all 4 sides.
A promise that the data in this page will not be modified.
float m_xResolution
horizontal resolution in pixels per unit
int numTiles()
get the number of tiles in the region
void setSize(int nx, int ny)
Set the size of the image in pixels.
The data type for a 8 bit image channel.
unsigned int curTotalBytes(void) const
Return the number of bytes used by the whole image (current proxy level)
ChannelType channelType() const
Get the channel type of the image/pixel.
ImgTile()
Create a default empty tile.
ImgLockPageIterator * lockPageSet(int x, int y, int nx, int ny, ImgLockPageIterator::AccessMode mode)
Returns a tile iterator that will iterate over the pages of this image in an optimal order...
float16Channel(const uInt16Channel &d)
void SetInvLuminance(const PixelType< uInt16Channel, 1 > &p)
RGBA = 1 - Luminance of input.
MemoryChannelOrder channelOrder() const
Get the channel ordering of the image/pixel.
ImageDescriptor(int nx, int ny, MemoryChannelOrder order=orderRGBA, bool premult=true, char nc=4, ChannelType ct=uChar)
Constructor – make a descriptor...
Class: ConvolutionKernel.
void SetInvLuminance(const PixelType< float32Channel, 3 > &p)
RGBA = 1 - Luminance of input.
bool(* ProxyInterruptFunction)(void)
Proxy generation is interruptible.
MemoryChannelOrder m_channelOrder
channel ordering
ImgPageIterator * getPageIterator(int x, int y, int nx, int ny)
Returns a tile iterator that will iterate over the pages of this image in an optimal order...
ImgTile(int X, int Y, int NX, int NY)
Create a tile as specified in the parameters.
void getTile(int x, int y, int nx, int ny, void *data, const PixelDescriptor *pd=0)
Reads a rectangular region of pixels from the image into a buffer.
float m_yResolution
vertical resolution in pixels per unit
GLubyte GLubyte GLubyte a
void SetLuminance(const PixelType< float32Channel, 4 > &p)
RGBA = Luminance of input.
uInt16Channel(const uInt16Channel &d)
ChannelType
Describe the data type of a single channel of a pixel.
int numPixels() const
return the number of pixels contained in this tile
ImgTile m_Bounds
Bounds of the image – some images may not have a 0,0 origin.
#define ExponentBiasDelta
Describes a material of a geometry including its surface colors, transparency and texture information...
Represents a rectangle. Used to specify rectangular regions of an image.
void setTile(int x, int y, int nx, int ny, void *data, const PixelDescriptor *pd=0)
Writes a rectangular region of pixels to the image from a buffer.
void clearProxyImages()
clear and deallocate any proxy images.
bool Versioned() const
returns true if this is a tiled and versioned image
unsigned int curBytesPerPixel() const
Return the number of bytes used by a pixel at the current proxy level.
void SetLuminance(const PixelType< float32Channel, 1 > &p)
RGBA = Luminance of input.
#define DECLARE_CLASS
This macro should be used in declaration of classes which are inherited from the Node class (or any d...
ImgTile Tile(int i)
return the i'th tile in the region (no bounds checking performed)
RGB – for 3 channel images.
void clipPositive()
Clip the tile so it will not extend into the negative quadrants.
virtual void copyAll(Image &fromImg)
Copies all of the pixels from a source image to this image.
void SetInvLuminance(const PixelType< float32Channel, 1 > &p)
RGBA = 1 - Luminance of input.
const ImageDescriptor & getDescriptor() const
get the full descriptor for the image
int curHeight() const
get the height of the current proxy level of the image
int xSize() const
return the x Size of the image
void SetLuminance(const PixelType< uInt8Channel, 1 > &p)
RGBA = Luminance of input.
ImgTile_AoutB_Iter(const ImgTile &A, const ImgTile &B)
uInt16Channel & operator=(const float32Channel &d)
void SetInvLuminance(const PixelType< float16Channel, 4 > &p)
RGBA = 1 - Luminance of input.
bool isEmpty() const
return true of this tile is empty
int ny
y size of the tile (height)
float16Channel(const float16Channel &d)
void SetColorAt(u_int X, u_int Y, const Color &cColor)
Set value for a specified texel.
Optimal ordering on windows & Mac.
This is the base image type defining the interface to images.
bool operator==(const PixelDescriptor &pd) const
returns true if the pixel descriptors are equal
ImageType
used to identify what type of image any particular instance is.
int channelSize() const
return the size of a pixel channel in bytes
unsigned char getProxyLevel() const
get the Proxy level of the image – 0 = no proxying.
A templated pixel type class, where the channel type and number of channels are arguments.
int pixelSize() const
return the size of a pixel in bytes
This is invalid for 4 channel images – used for 1 channel.
bool sizeEqual(const ImageDescriptor &o) const
return true if the x and y dimensions are equal
void SetInvLuminance(const PixelType< float16Channel, 1 > &p)
RGBA = 1 - Luminance of input.
void SetLuminance(const PixelType< float32Channel, 3 > &p)
RGBA = Luminance of input.
signed 16 bit short (not currently supported)
signed 8 bit char (not currently supported)
ImageAccessorBase(Image *parent)
Iterates over a the region of tile A that is outside tile B.
float16Channel(const float32Channel &d)
uInt8Channel & operator=(const float32Channel &d)
ImageType getType() const
return the image type.
void SetLuminance(const PixelType< float16Channel, 4 > &p)
RGBA = Luminance of input.
int strideBytes() const
return the number of bytes wide that the image is
void setResolutionInfo(float xRes, float yRes, ResUnit unit)
set the horizontal and vertical resolution of the image
void SetInvLuminance(const PixelType< uInt16Channel, 4 > &p)
RGBA = 1 - Luminance of input.