Native bitmap: image stored in graphics card format, fast to display.
More...
#include "Imagine/Graphics.h"
|
| NativeBitmap () |
| Empty constructor.
|
|
| NativeBitmap (int w, int h) |
| Constructor with dimensions. More...
|
|
| NativeBitmap (const NativeBitmap &I) |
| Copy constructor.
|
|
| ~NativeBitmap () |
| Destructor.
|
|
const NativeBitmap & | operator= (const NativeBitmap &I) |
| Assignment.
|
|
void | setColorImage (int x, int y, const byte *r, const byte *g, const byte *b, int w, int h) |
| Set color image. More...
|
|
void | setColorImage (const IntPoint2 &p, const byte *r, const byte *g, const byte *b, int w, int h) |
| Set color image. More...
|
|
void | setColorImage (int x, int y, const Color *cols, int w, int h) |
| Set color image. More...
|
|
void | setColorImage (const IntPoint2 &p, const Color *cols, int w, int h) |
| Set color image. More...
|
|
void | setColorImage (int x, int y, const byte *rgb, int w, int h) |
| Set color image. More...
|
|
void | setColorImage (const IntPoint2 &p, const byte *rgb, int w, int h) |
| Set color image. More...
|
|
void | setGreyImage (int x, int y, const byte *g, int w, int h) |
| Set grey image. More...
|
|
void | setGreyImage (const IntPoint2 &p, const byte *g, int w, int h) |
| Set grey image. More...
|
|
void | setPoint (int x, int y, Color col) |
| Set point. More...
|
|
void | setPoint (const IntPoint2 &p, Color col) |
| Set point. More...
|
|
Use it if you want to display the image many times (for example in an animation).
- Examples:
- Graphics/test/example.cpp, and Graphics/test/test.cpp.
◆ NativeBitmap()
Imagine::NativeBitmap::NativeBitmap |
( |
int |
w, |
|
|
int |
h |
|
) |
| |
Contructs a native bitmap of dimensions (w,h)
- Parameters
-
◆ setColorImage() [1/6]
void Imagine::NativeBitmap::setColorImage |
( |
int |
x, |
|
|
int |
y, |
|
|
const byte * |
r, |
|
|
const byte * |
g, |
|
|
const byte * |
b, |
|
|
int |
w, |
|
|
int |
h |
|
) |
| |
Fills part of a native bitmap with a bitmap.
- Parameters
-
x,y | top left position in native bitmap |
r,g,b | source to be copied into native bitmap |
w,h | dimensions |
byte r2[sz*sz],g2[sz*sz],b2[sz*sz];
for (int y=0;y<sz;y++) {
for (int x=0;x<sz;x++) {
r2[x+sz*y]=x;
g2[x+sz*y]=y;
b2[x+sz*y]=(x+y);
}
}
bm.setColorImage(0,0,r2,g2,b2,sz,sz);
bm.setColorImage(
IntPoint2(0,0),r2,g2,b2,sz,sz);
- Examples:
- Graphics/test/example.cpp, and Graphics/test/test.cpp.
◆ setColorImage() [2/6]
void Imagine::NativeBitmap::setColorImage |
( |
const IntPoint2 & |
p, |
|
|
const byte * |
r, |
|
|
const byte * |
g, |
|
|
const byte * |
b, |
|
|
int |
w, |
|
|
int |
h |
|
) |
| |
|
inline |
Fills part of a native bitmap with a bitmap.
- Parameters
-
p | top left position in native bitmap |
r,g,b | source to be copied into native bitmap |
w,h | dimensions |
byte r2[sz*sz],g2[sz*sz],b2[sz*sz];
for (int y=0;y<sz;y++) {
for (int x=0;x<sz;x++) {
r2[x+sz*y]=x;
g2[x+sz*y]=y;
b2[x+sz*y]=(x+y);
}
}
bm.setColorImage(0,0,r2,g2,b2,sz,sz);
bm.setColorImage(
IntPoint2(0,0),r2,g2,b2,sz,sz);
◆ setColorImage() [3/6]
void Imagine::NativeBitmap::setColorImage |
( |
int |
x, |
|
|
int |
y, |
|
|
const Color * |
cols, |
|
|
int |
w, |
|
|
int |
h |
|
) |
| |
Fills part of a native bitmap with a bitmap.
- Parameters
-
x,y | top left position in native bitmap |
cols | source to be copied into native bitmap |
w,h | dimensions |
for (int y=0;y<64;y++)
for (int x=0;x<64;x++)
cols2[x+64*y]=
Color((x+y)%256,0,0);
bm.setColorImage(32,32,cols2,64,64);
bm.setColorImage(
IntPoint2(32,32),cols2,64,64);
◆ setColorImage() [4/6]
void Imagine::NativeBitmap::setColorImage |
( |
const IntPoint2 & |
p, |
|
|
const Color * |
cols, |
|
|
int |
w, |
|
|
int |
h |
|
) |
| |
|
inline |
Fills part of a native bitmap with a bitmap.
- Parameters
-
p | top left position in native bitmap |
cols | source to be copied into native bitmap |
w,h | dimensions |
for (int y=0;y<64;y++)
for (int x=0;x<64;x++)
cols2[x+64*y]=
Color((x+y)%256,0,0);
bm.setColorImage(32,32,cols2,64,64);
bm.setColorImage(
IntPoint2(32,32),cols2,64,64);
◆ setColorImage() [5/6]
void Imagine::NativeBitmap::setColorImage |
( |
int |
x, |
|
|
int |
y, |
|
|
const byte * |
rgb, |
|
|
int |
w, |
|
|
int |
h |
|
) |
| |
|
inline |
Fills part of a native bitmap with a bitmap.
- Parameters
-
x,y | top left position in native bitmap |
rgb | source to be copied into native bitmap |
w,h | dimensions |
byte rgb2[3*64*64];
for (int y=0;y<64;y++)
for (int x=0;x<64;x++) {
rgb2[3*(x+64*y)]=x;
rgb2[3*(x+64*y)+1]=y;
rgb2[3*(x+64*y)+2]=x+y;
}
bm.setColorImage(64,0,rgb2,64,64);
bm.setColorImage(
IntPoint2(64,0),rgb2,64,64);
◆ setColorImage() [6/6]
void Imagine::NativeBitmap::setColorImage |
( |
const IntPoint2 & |
p, |
|
|
const byte * |
rgb, |
|
|
int |
w, |
|
|
int |
h |
|
) |
| |
|
inline |
Fills part of a native bitmap with a bitmap.
- Parameters
-
p | top left position in native bitmap |
rgb | source to be copied into native bitmap |
w,h | dimensions |
byte rgb2[3*64*64];
for (int y=0;y<64;y++)
for (int x=0;x<64;x++) {
rgb2[3*(x+64*y)]=x;
rgb2[3*(x+64*y)+1]=y;
rgb2[3*(x+64*y)+2]=x+y;
}
bm.setColorImage(64,0,rgb2,64,64);
bm.setColorImage(
IntPoint2(64,0),rgb2,64,64);
◆ setGreyImage() [1/2]
void Imagine::NativeBitmap::setGreyImage |
( |
int |
x, |
|
|
int |
y, |
|
|
const byte * |
g, |
|
|
int |
w, |
|
|
int |
h |
|
) |
| |
Fills part of a native bitmap with a grey bitmap.
- Parameters
-
x,y | top left position in native bitmap |
g | source to be copied into native bitmap |
w,h | dimensions |
byte grey2[64*64];
for (int y=0;y<64;y++)
for (int x=0;x<64;x++)
grey2[(x+64*y)]=x+2*y;
bm.setGreyImage(0,64,grey2,64,64);
bm.setGreyImage(
IntPoint2(0,64),grey2,64,64);
- Examples:
- Graphics/test/test.cpp.
◆ setGreyImage() [2/2]
void Imagine::NativeBitmap::setGreyImage |
( |
const IntPoint2 & |
p, |
|
|
const byte * |
g, |
|
|
int |
w, |
|
|
int |
h |
|
) |
| |
|
inline |
Fills part of a native bitmap with a grey bitmap.
- Parameters
-
p | top left position in native bitmap |
g | source to be copied into native bitmap |
w,h | dimensions |
byte grey2[64*64];
for (int y=0;y<64;y++)
for (int x=0;x<64;x++)
grey2[(x+64*y)]=x+2*y;
bm.setGreyImage(0,64,grey2,64,64);
bm.setGreyImage(
IntPoint2(0,64),grey2,64,64);
◆ setPoint() [1/2]
void Imagine::NativeBitmap::setPoint |
( |
int |
x, |
|
|
int |
y, |
|
|
Color |
col |
|
) |
| |
◆ setPoint() [2/2]
void Imagine::NativeBitmap::setPoint |
( |
const IntPoint2 & |
p, |
|
|
Color |
col |
|
) |
| |
|
inline |
Set color of one point in a native bitmap.
- Parameters
-
p | position |
col | Color to be copied into native bitmap |
for (int x=0;x<sz;x++) {
}
◆ putNativeBitmap [1/2]
void putNativeBitmap |
( |
int |
x, |
|
|
int |
y, |
|
|
const NativeBitmap & |
bm, |
|
|
bool |
xorMode, |
|
|
double |
fact |
|
) |
| |
|
friend |
Displays native bitmap into active window
- Parameters
-
x,y | drawing position (top left in window) |
bm | the native bitmap to display |
xorMode | XOR drawing (default=off). Used twice, recovers the original content |
fact | scaling factor (default=1.) |
for (int i=0;i<1024;i+=8) {
}
◆ putNativeBitmap [2/2]
void putNativeBitmap |
( |
const IntPoint2 & |
p, |
|
|
const NativeBitmap & |
bm, |
|
|
bool |
xorMode = false , |
|
|
double |
fact = 1. |
|
) |
| |
|
friend |
Displays native bitmap into active window
- Parameters
-
p | drawing position (top left in window) |
bm | the native bitmap to display |
xorMode | XOR drawing (default=off). Used twice, recovers the original content |
fact | scaling factor (default=1.) |
for (int i=0;i<1024;i+=8) {
}
The documentation for this class was generated from the following file:
- /home/pascal/Ponts/svn/ImagineQt/Imagine/Graphics/src/Imagine/Graphics/ImageIO.h