Search found 3635 matches
- Wed Sep 20, 2006 6:24 am
- Forum: Coding Questions
- Topic: SetClipboardImage with alphachannel ?
- Replies: 1
- Views: 441
SetClipboardImage with alphachannel ?
Is it possible to place an image into the clipboard and preserve it's alpha channel ? When I use the built in command, the alpha channel is lost.
- Wed Sep 13, 2006 6:13 pm
- Forum: Coding Questions
- Topic: Loading an image into main memory ?
- Replies: 6
- Views: 742
- Wed Sep 13, 2006 5:27 pm
- Forum: Coding Questions
- Topic: Loading an image into main memory ?
- Replies: 6
- Views: 742
- Wed Sep 13, 2006 4:53 pm
- Forum: Coding Questions
- Topic: Loading an image into main memory ?
- Replies: 6
- Views: 742
No, I mean to memory. I need an ARGB pixel buffer of a transparent PNG image but I don't have to display the image. If the image is a 256 color palette based image it should be converted automatically. Using the compiler directives to compile for a specific platform I could use GetDiBits_ to solve i...
- Wed Sep 13, 2006 8:58 am
- Forum: Coding Questions
- Topic: Loading an image into main memory ?
- Replies: 6
- Views: 742
Loading an image into main memory ?
Is there an easy (preferably linux/windows cross platform) way to load and decode an image into memory ? I looked at the image library but couldn't find such an option. Maybe an alternative could be to use one of the imagePlugin libraries. I noticed viewing the SampleImagePlugin code they have a dec...
- Sat Sep 02, 2006 9:31 am
- Forum: Tricks 'n' Tips
- Topic: Using ImagePluginPNG to (un)compress a memorybuffer
- Replies: 17
- Views: 7169
Linux version ; purebasic 3.94 linux source UsePNGImageEncoder() Global zf.l Structure zstream next_in.l avail_in.l total_in.l next_out.l avail_out.l total_out.l msg.l state.l zalloc.l zfree.l opaque.l data_type.l adler.l reserved.l EndStructure Procedure.l Z_Compress(dest,destLen,source,sourceLen) ...
- Sat Sep 02, 2006 8:57 am
- Forum: Tricks 'n' Tips
- Topic: Using ImagePluginPNG to (un)compress a memorybuffer
- Replies: 17
- Views: 7169
Using ImagePluginPNG to (un)compress a memorybuffer
After some experimenting I was able to use the PNG plugin to (un)compress a memory buffer using zlib compression. ; purebasic 4.0 windows source UsePNGImageEncoder() Structure zstream next_in.l avail_in.l total_in.l next_out.l avail_out.l total_out.l msg.l state.l zalloc.l zfree.l opaque.l data_type...
- Fri Sep 01, 2006 4:19 pm
- Forum: Linux
- Topic: Zlib compression of a memorybuffer [Resolved]
- Replies: 0
- Views: 981
Zlib compression of a memorybuffer [Resolved]
How can I compress a memorybuffer using zlib compression on Linux ? I tried LoadLibrary("libz.so") but if I use the purebasic functions to examine the library I get zero library functions. Edit: I found a way to do it using the PNGImagePlugin. The solution is posted in the Tips 'n' Tricks ...
- Sat Aug 26, 2006 7:11 am
- Forum: PureFORM & JaPBe
- Topic: PureZIP library : ZIP / UNZIP files
- Replies: 599
- Views: 288430
- Sat Aug 12, 2006 8:10 pm
- Forum: Coding Questions
- Topic: Bits into array?
- Replies: 14
- Views: 1839
If you don't mind a little asm, try this Procedure BitSplit(value.q, arrayptr.l) !push ebx !mov eax,dword [esp+8] !mov ebx,dword [esp+12] !mov edx,dword [esp+16] !mov ecx,dword [edx-8] !add edx,ecx !bitsplit_loop: !dec edx !push eax !and al,1 !mov byte [edx],al !pop eax !rcr ebx,1 !rcr eax,1 !loop b...
- Sat Aug 12, 2006 7:16 pm
- Forum: Coding Questions
- Topic: Random quad?
- Replies: 11
- Views: 1592
Actually I am using very large numbers, but I don't think it will matter that much anyways. I guess you are right. For a 56 bit limit value, the difference in chance still should be less then 1%. To detect a significant difference for even bigger values your computer would have to make more then a ...
- Sat Aug 12, 2006 6:58 pm
- Forum: Coding Questions
- Topic: Random quad?
- Replies: 11
- Views: 1592
Are you sure that not all numbers will have the same chance to appear? I don't know how the normal random routine is written; if the chance is equal there. In this case the logic is simple. If a generated number has a maximum value of 16 and you limit the result between 0 and 10 using a modulo inst...
- Sat Aug 12, 2006 6:03 pm
- Forum: Coding Questions
- Topic: Random quad?
- Replies: 11
- Views: 1592
This seems to work but since it uses a modulo not all numbers will have the same chance to appear
Code: Select all
Procedure.q RandomQ(max.q)
ProcedureReturn ((Random($7fffffff) << 16 | Random($ffff)) << 16 | Random($ffff)) % (max + 1)
EndProcedure
- Tue Feb 28, 2006 5:19 pm
- Forum: Coding Questions
- Topic: PB4B4 : Change in internal 2DDrawing definitions ?
- Replies: 5
- Views: 2221
Thanks. That really helped :D Do you know if there's also a way to get the DC of the current Window without the need of creating a gadgetlist like El Choni suggested ? I tried if there was a similar way like _PB_Window_GlobalStructure but that didn't work. By the way, where did you find that informa...
- Tue Feb 28, 2006 12:32 pm
- Forum: Coding Questions
- Topic: PB4B4 : Change in internal 2DDrawing definitions ?
- Replies: 5
- Views: 2221
Unfortunately that doesn't solve my problem. My lib has some custom drawing functions. In order for them to work the same way as the normal PB drawing functions I need a way for the lib to find the currentDC so it doesn't have to be specified each time a function is used. Using PB 3.9x it wasn't a p...