Re: GDI Plus library

new topic     » goto parent     » topic index » view thread      » older message » newer message
LewisTownsend said...

Ok, so I thought I might get more responses if I posted some code:

	count = length(points)-- count is the number of x and y values 
	p_points = allocate( count*2 )-- allocate 4 bytes per pair 
	bytesAll = "" 
 
	for i = 1 to count-1 by 2 do 
		status = allocate(8) -- the pointer for a pair 
		bytesPair = ( int_to_bytes( points[i] ) ) 
		bytesPair &= ( int_to_bytes( points[i+1] ) ) 
		poke( status, (bytesPair)) --reverse 
		bytesAll &=  status  --& bytes 
	end for 
	poke( p_points, ( bytesAll ) ) 

If it is an array of pointers to 8-byte points (which I doubt), you would need to use poke4(p_points,bytesAll).

Have you tried allocating len*4 and a plain poke4(p_points,points)?

Or if it really is 2 bytes per integer, this may help:

procedure poke2(atom addr, object x) 
atom xi 
    if atom(x) then 
        poke(addr, and_bits(x,#FF)) 
        poke(addr+1, floor(and_bits(x,#FF00)/256)) 
    else -- sequence 
        for i = 1 to length(x) do 
            xi = x[i]   -- (helps speedwise, also ensures we don't  
                        --  blindly poke nested sequences...) 
            poke(addr, and_bits(xi,#FF)) 
            addr += 1 
            poke(addr, floor(and_bits(xi,#FF00)/256)) 
            addr += 1 
        end for 
    end if 
end procedure 
 

A quick search also landed me at
http://msdn.microsoft.com/en-us/library/system.drawing.pointf.pointf.aspx
which suggests it may be expecting a (flat) array of 32-bit floats?

Regards and hello again, Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu