Author Topic: New GdiPlus Dll  (Read 4082 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
New GdiPlus Dll
« on: January 29, 2016, 04:26:49 AM »
Hello,

GdiPlus in new clothes.

Demo1:

Code: [Select]
include "gdip.inc"
window 800,600,1

double x1=400, y0=300, x2=400, f, z
for z=0 to 200000
    f  =  f + 3.14
    x1 = x1 + cos(f*f)
    x2 = x2 - cos(f*f)
    y0 = y0 + sin(f*f)
    color3B mod(z,255),mod(z,255),mod(z,255)
    setpixel(x1, y0 + 200)
    setpixel(x2, y0 + 200)
next
color3B 255,255,255
text 340,0,20,"SCARAB"
waitkey
winEnd

Demo2

Code: [Select]
include "gdip.inc"
window 800,600,1

float x1=400, y0=300, x2=400, f, z, a

for z=0 to 300000
    f  =  f + 4.0
    x1 = x1 + cos(z*f)
    x2 = x2 - cos(z*f)
    y0 = y0 + sin(z*f)
    color3B mod(z,255),mod(z,255),mod(z,255)
    setpixel(x1, y0-150)
    setpixel(x2, y0-150)
next

color3B 255,255,255
text 80,16,20,"SCARAB SISTER"

waitkey
winEnd

Demo3

Code: [Select]
include "gdip.inc"
window 320,240,1
setframes 100

single r[256]
single g[256]
single b[256]
single s1,c1,c2,c3,f,x,y

for x=0 to 256
    r[x] = 255 -((sin(3.14 * 2 * x / 255) + 1) * 127)
    g[x] = ((sin(3.14 * 2 * x / 127) + 1) * 64)
    b[x] = 255 - r[x]
next

while key(27)=0
for y=0 to 240
for x=0 to 320
    c1 = sin(x / 10 + f + y / 10)
    c2 = sqr((sin(0.8*f)*160-x+160) * (sin(0.8*f)*160-x+160) + (cos(1.2*f)*100-y+100) * (cos(1.2*f)*100-y+100))
    c2 = sin(c2 / 10)
    c3 = (c1 + c2) / .5
    s1 = ((c3 + 1) * 127)
    color3B r[s1], g[s1], b[s1]
    setpixel x, y
next
next
f +=.1
sync()
wend
winEnd

« Last Edit: March 31, 2016, 12:17:01 AM by Peter »

Arnold

  • Guest
Re: New GdiPlus Dll
« Reply #1 on: February 01, 2016, 07:42:35 AM »
Hallo Peter,

your demos work fine with me using Windows Vista 32bit. I suggest to add an error routine for LoadImage and LoadTiles to exit gracefully in case the bitmap files cannot be found. (I had to use task manager to kill the sprite demo).

I am curious about some details:
most of the time you use type sys. Does this mean it is not necessary to differentiate between int, long, dword, bool in general, or is this a special feature of gdip.inc?
With some functions you used type wstring. Is this required for those special cases or could type string be used also?
Is any * the same as sys * ?
Last but least: in function Line and Box the identifier width is used twice (sys and single). It seems that such combinations will work without any problems too.

Anyway: these constructions are very interesting.

Roland

Peter

  • Guest
Re: New GdiPlus Dll
« Reply #2 on: February 01, 2016, 03:54:13 PM »
Hi Arnold,

In Windows7 there's no hanging around in the Task Manager.
The program continues to run, your image will just not displayed.

Anyway, thank you for your report.

Improved:  now, the program terminates if no image was loaded.

1. sys is a 32Bit type, better you ask Charles, he knows it more exact.  ???

2. wstring is wide string, I could use string, but wouldn't work in GdiPlus.

3. any* isn't sys* : any* any type.
   for example: sys *red, *green, *blue are pointers to the three variables. 
   another way would be: ByRef red as sys .....

4. is okay, different types. (sys) (single) 

Charles is the ruler of oxygen dll, the only one of its kind who knows what it is.  ;D       

Charles Pegge

  • Guest
Re: New GdiPlus Dll
« Reply #3 on: February 02, 2016, 12:18:17 PM »

sys is a 32 bit signed integer on 32 bit systems but stretches out to 64 bits when compiling 64 bit binaries. This is useful for handles and pointers, and generic integers but beware ints within UDTS / typedefs, which must retain their 32 bit length.

Peter

  • Guest
Re: New GdiPlus Dll
« Reply #4 on: February 02, 2016, 12:43:12 PM »
Thanks Charles for the clarification.

In other words,  TYPE'S and TYPEDEF's should have always the correct types.
Especially Api definition!