Rotate image fast? (wheel of fortune like)

Just starting out? Need help? Post your questions and find answers here.
infratec
Always Here
Always Here
Posts: 7619
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Post 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
infratec
Always Here
Always Here
Posts: 7619
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Post 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
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

@infratec
did you use the flag #PB_Sprite_AlphaBlending for loading the texture?
and remember to resize it to 512x512 :!:
oh... and have a nice day.
infratec
Always Here
Always Here
Posts: 7619
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Post 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
infratec
Always Here
Always Here
Posts: 7619
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Post 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
+18
Enthusiast
Enthusiast
Posts: 228
Joined: Fri Oct 24, 2008 2:07 pm

Post 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!
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
+18
Enthusiast
Enthusiast
Posts: 228
Joined: Fri Oct 24, 2008 2:07 pm

Post 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?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

Great!!

Thanks all of you for your advices! :)
ARGENTINA WORLD CHAMPION
infratec
Always Here
Always Here
Posts: 7619
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Post 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
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post 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
ARGENTINA WORLD CHAMPION
javabean
User
User
Posts: 60
Joined: Sat Nov 08, 2003 10:29 am
Location: Austria

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

Post 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)
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

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

Post by chris319 »

Is there any way to save a rotated sprite to a file (and have it still be rotated)?
Post Reply