On 17/06/2013 at 03:08, xxxxxxxx wrote:
I'm trying to partly copy 32 bit images.
Copying a part of an image to another images is working.
However, when I tried to set my own 32 bit pixel color information it goes wrong.
I do not know how to initialize the byteseq with 32 bit color information.
I tried this, but it comes out all black. No color information.
What I do:
- create a byteseq for 1 pixel. 32 bits x 3 colors = 96 bits = 12 bytes
- fill the byteseq with R=0xFFFFFFFF, G=0, B=0xFF
- write the pixel to the image, but no colors. Everything is black
b12 = storage.ByteSeq(None, 12) # size = 12 bytes = 1 pixel
b12[0:4] = chr(255)*4 # 0xFFFFFFFF
b12[4:8] = chr(0)*4 # 0x00000000
b12[8:12] = chr(0) + chr(0) + chr(0) + chr(255) # 0x000000FF
#copy to image
for row in range(100,400) :
for x in range (200,800) :
#offset = b12.GetOffset(0) #offset in byteseq
pixels2copy = 1
copy.SetPixelCnt(x, row, pixels2copy, b12, inc, c4d.COLORMODE_RGBf, c4d.PIXELCNT_0) # Set pixels in bitmap copy
bitmaps.ShowBitmap(copy) # Show copied image
On 17/06/2013 at 07:20, xxxxxxxx wrote:
This seems to work.
One thing that puzzles me, is the format of the value I can give.
0xffffffff, 0.9999, 1.0, it is all ok.
b12 = storage.ByteSeq(None, 12)
b12[0:4] = struct.pack("f", 0xffffffff) # R
b12[4:8] = struct.pack("f", 0.9999) # G
b12[8:12] = struct.pack("f", 1.0) # B