MultiPut V2.0 :-)

Post your FreeBASIC tips and tricks here. Please don’t post your code without including an explanation.
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: MultiPut V2.0 :-)

Postby leopardpm » May 17, 2016 3:00

for the rotation, will you use the full 0 to 360 degrees, or just steps like 0,45,90,135,180,225,etc....?
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: MultiPut V2.0 :-)

Postby leopardpm » May 17, 2016 3:09

bcohio2001 wrote:Trying to just save memory. ... I have a MINUMUM of 53 images, 52 'cards' and at least one 'back'. Maybe the two Jokers.
About the only thing that I could think of at the moment would be create another temp image, Put the 'ShowThis' in it using the PReset.
Then use Multiput to rotate and put it on screen.

that ain't alot of memory usage at all.. I would say to definitely do it with a second ShowThis...

Code: Select all

'Rot value (Rotate) not used at the moment
Sub Card.DrawImg(ByVal XLoc As Integer, ByVal YLoc As Integer, GetCard As Integer, Selected As Integer, Rot As Single=0)
   Dim As Any Ptr ShowThis(1)
   ShowThis(0)  = 0
   '
   Select Case GetCard
      Case -1
         ShowThis(0) = Backs(CurBackGr)
      Case 0 To 51
         ShowThis(0) = Deck52(GetCard)
      Case 52
         If Jokers Then ShowThis(0) = JokerBlack
      Case 53
         If Jokers Then ShowThis(0) = JokerRed
      Case Else
         '54+
         'special image
         'As Integer Special
         'As Any Ptr SpecialRC(Any)
         If Special > GetCard - 54 Then ShowThis(0) = SpecialRC(GetCard - 54)
   End Select
   'If Rot > 0 Then
   '   'insert rotation code or call a sub/function
   'EndIf
   ......put ShowThis(0) into ShowThis(1) using PRESET here
   if ShowThis(0) then MultiPut ,xloc,yloc,ShowThis(Selected),1,1,rotation,transparent
End Sub
bcohio2001
Posts: 553
Joined: Mar 10, 2007 15:44
Location: Ohio, USA
Contact:

Re: MultiPut V2.0 :-)

Postby bcohio2001 » May 25, 2016 1:13

Is there a way via the parameters sent to change the point of rotation?
As I see it, it is like putting a "pin" in the center of a picture and to be able to spin it.
I would like the "pin" to be somewhere else, for my use, in the upper left corner.
Muttonhead
Posts: 130
Joined: May 28, 2009 20:07

Re: MultiPut V2.0 :-)

Postby Muttonhead » May 25, 2016 5:45

@bcohio2001:
I have always tried to discover the secret of Multiput, there I have never succeeded ... :(
So the following snippet is more a homage to dj... great work!
but it contains exactly the feature you are looking for:
https://www.freebasic-portal.de/porticula/rotput5-bi-1827.html

Mutton
D.J.Peters
Posts: 8132
Joined: May 28, 2005 3:28
Contact:

Re: MultiPut V2.0 :-)

Postby D.J.Peters » May 25, 2016 6:02

I open only the the door for you
but you must self going thru it :-)

Joshy
Dr_D
Posts: 2398
Joined: May 27, 2005 4:59
Contact:

Re: MultiPut V2.0 :-)

Postby Dr_D » May 25, 2016 14:08

Here is a tip... translate, rotate, translate back. :)
bcohio2001
Posts: 553
Joined: Mar 10, 2007 15:44
Location: Ohio, USA
Contact:

Re: MultiPut V2.0 :-)

Postby bcohio2001 » May 26, 2016 16:23

@Mutton
Thanks.
And FYI received error:
RotPut.bas(14) error 14: Expected identifier, found 'Image' in 'dim as Image ptr Src_Header,Dest_Header 'Zeiger um an die Daten im ImageHeader zu kommen'
Assuming that you included 'fbgfx.bi' somewhere else in a larger project.
Will just use ImageInfo in my copy.

*Edit*
I guess I ASSuMEd wrong, notice the emphasis on 'me'.
Is not in 'fbgfx.bi'!
Much more to it than just getting ImageInfo and like you is beyond me.
Last edited by bcohio2001 on May 26, 2016 17:17, edited 1 time in total.
Dr_D
Posts: 2398
Joined: May 27, 2005 4:59
Contact:

Re: MultiPut V2.0 :-)

Postby Dr_D » May 26, 2016 16:44

Alas, Rotozoom has the capability as well, but it has fallen by the wayside. :p
bcohio2001
Posts: 553
Joined: Mar 10, 2007 15:44
Location: Ohio, USA
Contact:

Re: MultiPut V2.0 :-)

Postby bcohio2001 » Sep 25, 2019 20:36

@D.J. Peters

Please specify in either the code or in the first post text that rotating an image with an odd width or height can result in loss of an edge of the image.
All your tests are with images with even dimensions.
angros47
Posts: 1671
Joined: Jun 21, 2005 19:04

Re: MultiPut V2.0 :-)

Postby angros47 » Sep 25, 2019 23:21

Personally I think MultiPut should be added to the GFX library. Along with some collision detection routine, perhaps, too

Return to “Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 7 guests