Re: GDI Plus library

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

EDITED

Thanks ssallen,

I'm actually trying to edit the wrapper to make it easier to use. like making it do all the allocating and peeking and poking for you I've been able to figure out quite a bit and simplified it for my purposes but I'm still stuck on this points thing.

I think most Euphoria programmers like Euphoria because of it's simplicity. I think those same (most) probably couldn't use GDI+ because it returns the complexity of C

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

global procedure WrongDrawLinePolygon(atom p_graphics,atom p_pen, sequence points ) --,atom count) 
	-- points is a 1-dimensional sequence in the form of {x1,y1,x2,y2,x3,y3...} 
	atom status, p_points 
	integer count 
	sequence bytesAll,bytesPair 
	count = length(points)-- count is the number of x and y values 
	p_points = allocate( count*2 )-- allocate 4 bytes per pair which is just going to be another pointer 
	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] ) ) 
		--bytesPair = bytesPair[1..2]&bytesPair[5..6] -- this is for if only using 2 bytes per integer 
 
		poke( status, (bytesPair)) --reverse 
 
		bytesAll &=  status  --& bytes 
 
	end for 
	poke( p_points, ( bytesAll ) ) 
 
	--(GpGraphics *graphics,GpPen *pen,GDIPCONST GpPointF *points,INT count) 
	if gdiplus>0 then 
		status = c_func(xGdipDrawPolygon,{p_graphics,p_pen,p_points,count/2}) 
	--else    status = 0 
	end if 
 
	puts(1, GetErrorString(status) & " " ) 
	--bytes = "" 
	for i = 1 to length( bytesAll ) do 
		status = peek4u( bytesAll[i]) 
		puts(1, "{"&sprint(status)&"," ) 
		status = peek4u( bytesAll[i]+4) 
		puts(1, sprint(status)&"}\t" ) 
		free( bytesAll[i] ) 
	end for 
	--print(1, bytes) 
	puts(1, '\n' ) 
	free( p_points ) 
end procedure 
 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu