Page 2 of 2

Posted: Fri Jul 03, 2009 9:16 am
by infratec
Hi,

works also with png.

BUT: I have to save the picture without transparency!

When I read the help to UsePNGImageDecoder() there is written that
it works, but the alpha channel is ignored.

In this case it works not.

Is this something for Fred?

Best regards,

Bernd

Posted: Fri Jul 03, 2009 10:15 am
by infratec
Since I noticed that my Icons were mixed up after my tests with openscreen(),
I updated the program to a window version.

So my Icons are save now :D


Bernd

Posted: Fri Jul 03, 2009 12:02 pm
by Kaeru Gaman
@infratec
did you use the flag #PB_Sprite_AlphaBlending for loading the texture?
and remember to resize it to 512x512 :!:

Posted: Fri Jul 03, 2009 12:10 pm
by infratec
Hi Kaeru,
So I reduced the sice to 512x512 and set the cornercolour to 255,0,255.
That was done by me :)

But I didn't use the flag #PB_Sprite_AlphaBlending.
That's right.

I'll test this.

Bernd

Posted: Fri Jul 03, 2009 12:20 pm
by infratec
Hi,

I don't know why, but now it works with a transparent png.
(It is loaded without an error)

The parameter #PB_Sprite_AlphaBlending was not helpful.
When I add this, I didn't see the sprite anymore.

But ok. that's not a problem for me, since I normally don't do any
graphic stuff.

Best regards,

Bernd

Posted: Fri Jul 03, 2009 1:17 pm
by +18
I change line 29 to:

Code: Select all

OpenLibrary(0, "C:\WINDOWS\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.0.0_x-ww_8d353f13\gdiplus.dll")
It's work now!

Posted: Fri Jul 03, 2009 1:33 pm
by Kaeru Gaman
but then it will work on this single computer only.

find another way of opening the DLL correctly instead of using an absolute path.

seems that "WINDOWS\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.0.0_x-ww_8d353f13\"
is no standard path that is searched by default.
(what the helluva path is this anyway?)

shift a copy of the DLL to C:\WINDOWS\ and it should wark without path.

Posted: Fri Jul 03, 2009 2:00 pm
by +18
You're right , I think this dll must putted in System32 in normally.
when i don't find it, i search in overall of win folder and find it in a unusual path :shock:

other problem:
when i execute this code only (before click "Spin!" button), my CPU usage is:
Image

it's logical?

Posted: Fri Jul 03, 2009 2:20 pm
by Kaeru Gaman
sure.

none of both codes had a timer and/or was giving time free.

netmaestro used WindowEvent() without a Delay,
infratec used FlipBuffers() without Delay or a timer

that means, the code will run as-fast-as-run-can and fry the CPU, just normal.

to set time free, you have to use WaitWindowEvent(timeout) or a Delay(ms), then it is possible to lower CPU usage.

Posted: Fri Jul 03, 2009 4:54 pm
by ricardo
Great!!

Thanks all of you for your advices! :)

Posted: Fri Jul 03, 2009 6:37 pm
by infratec
Hi together,

I modified my code from page 1.

I added a Delay(10), which reduce the CPU load from 100 to 10% without speed loss.
(sorry, it was a quick hack, copied from the help file).

Good luck with your program!

Bernd

Posted: Sat Jul 04, 2009 5:10 pm
by ricardo
infratec wrote: Good luck with your program!

Bernd
Thanks! :)

My kids are now playing !! (Its vacation here so i need something to keep them learning and bussy ;) )

PB does babysitting too :P

Re: Rotate image fast? (wheel of fortune like)

Posted: Tue Mar 02, 2010 10:24 am
by javabean
The code didn't work with PB 4.40 (x86, Windows; on Windows XP-SP3) until I changed the pseudotype of 'filename' from 'p-bstr' to 'p-unicode' :? :

Code: Select all

Prototype GdipCreateBitmapFromFile(filename.p-unicode, *image)

Re: Rotate image fast? (wheel of fortune like)

Posted: Sun Sep 16, 2012 5:41 pm
by chris319
Is there any way to save a rotated sprite to a file (and have it still be rotated)?