Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing Avatar
#1
I get an idea in my head and I got to play with it...

Code: (Select All)
Option _Explicit
_Title "Changing Avatar" 'b+ need to keep total bytes below 1MB
Const xmax = 300 ' screen width
Const ymax = 300 ' screen height
Screen _NewImage(xmax, ymax, 32)
_Delay .25 ' wait for screen to load
_ScreenMove _Middle ' center in screen
ReDim As Long i1, i2, j1, j2, x, y
ReDim As _Unsigned Long c1, c2
ReDim f
i1 = _LoadImage("phoenix100.png") ' Wikimedia commons Public Domain
'  https://commons.wikimedia.org/w/index.php?search=Phoenix+art+images&title=Special:MediaSearch&go=Go&type=image
i2 = _LoadImage("qb64.png")
j1 = _NewImage(xmax, ymax, 32)
j2 = _NewImage(xmax, ymax, 32)
_PutImage , i1, j1
_PutImage , i2, j2
_FreeImage i1
_FreeImage i2
_PutImage , j1, 0
restart:
_PutImage , j1, 0
For f = 0 To 1.01 Step .01
    Cls
    For y = 0 To ymax
        For x = 0 To xmax
            _Source j1
            c1 = Point(x, y)
            _Source j2
            c2 = Point(x, y)
            PSet (x, y), Ink~&(c1, c2, f)
        Next
    Next
    _Display
    _Limit 20
Next
_PutImage , j2, 0
For f = 1 To 0 Step -.01
    Cls
    For y = 0 To ymax
        For x = 0 To xmax
            _Source j1
            c1 = Point(x, y)
            _Source j2
            c2 = Point(x, y)
            PSet (x, y), Ink~&(c1, c2, f)
        Next
    Next
    _Display
    _Limit 20
Next
GoTo restart

Function Ink~& (c1 As _Unsigned Long, c2 As _Unsigned Long, fr##)
    Dim R1, G1, B1, A1, R2, G2, B2, A2
    cAnalysis c1, R1, G1, B1, A1
    cAnalysis c2, R2, G2, B2, A2
    Ink~& = _RGB32(R1 + (R2 - R1) * fr##, G1 + (G2 - G1) * fr##, B1 + (B2 - B1) * fr##, A1 + (A2 - A1) * fr##)
End Function

Sub cAnalysis (c As _Unsigned Long, outRed, outGrn, outBlu, outAlp)
    outRed = _Red32(c): outGrn = _Green32(c): outBlu = _Blue32(c): outAlp = _Alpha32(c)
End Sub

zip contains 2 images, the source and a Windows compiled exe


Attached Files Image(s)
   

.zip   QB64+Phoenix.zip (Size: 757.94 KB / Downloads: 61)
b = b + ...
Reply
#2
Woah that is sweet! People could use that idea with game title pages. Or they could make it part of a game, like the old TV game shows where you choose a door. Smile  Good job.
Reply
#3
(04-26-2022, 01:12 AM)bplus Wrote: I get an idea in my head and I got to play with it...

Code: (Select All)
Option _Explicit
_Title "Changing Avatar" 'b+ need to keep total bytes below 1MB
Const xmax = 300 ' screen width
Const ymax = 300 ' screen height
Screen _NewImage(xmax, ymax, 32)
_Delay .25 ' wait for screen to load
_ScreenMove _Middle ' center in screen
ReDim As Long i1, i2, j1, j2, x, y
ReDim As _Unsigned Long c1, c2
ReDim f
i1 = _LoadImage("phoenix100.png") ' Wikimedia commons Public Domain
'  https://commons.wikimedia.org/w/index.php?search=Phoenix+art+images&title=Special:MediaSearch&go=Go&type=image
i2 = _LoadImage("qb64.png")
j1 = _NewImage(xmax, ymax, 32)
j2 = _NewImage(xmax, ymax, 32)
_PutImage , i1, j1
_PutImage , i2, j2
_FreeImage i1
_FreeImage i2
_PutImage , j1, 0
restart:
_PutImage , j1, 0
For f = 0 To 1.01 Step .01
    Cls
    For y = 0 To ymax
        For x = 0 To xmax
            _Source j1
            c1 = Point(x, y)
            _Source j2
            c2 = Point(x, y)
            PSet (x, y), Ink~&(c1, c2, f)
        Next
    Next
    _Display
    _Limit 20
Next
_PutImage , j2, 0
For f = 1 To 0 Step -.01
    Cls
    For y = 0 To ymax
        For x = 0 To xmax
            _Source j1
            c1 = Point(x, y)
            _Source j2
            c2 = Point(x, y)
            PSet (x, y), Ink~&(c1, c2, f)
        Next
    Next
    _Display
    _Limit 20
Next
GoTo restart

Function Ink~& (c1 As _Unsigned Long, c2 As _Unsigned Long, fr##)
    Dim R1, G1, B1, A1, R2, G2, B2, A2
    cAnalysis c1, R1, G1, B1, A1
    cAnalysis c2, R2, G2, B2, A2
    Ink~& = _RGB32(R1 + (R2 - R1) * fr##, G1 + (G2 - G1) * fr##, B1 + (B2 - B1) * fr##, A1 + (A2 - A1) * fr##)
End Function

Sub cAnalysis (c As _Unsigned Long, outRed, outGrn, outBlu, outAlp)
    outRed = _Red32(c): outGrn = _Green32(c): outBlu = _Blue32(c): outAlp = _Alpha32(c)
End Sub

zip contains 2 images, the source and a Windows compiled exe

@bplus @admin

100% LOVE IT. Is the phoenix image freely available for public use? The one Steve uses is.

Pete


I'm runnin outs ov signeechars, ya lop eared polecat!
Reply
#4
Thanks

Ken we can do it with your avatar, the animation would start with a full drink in your hand with a QB64 Logo and we would watch the cup empty as you peruse the forum posts.

@Pete I am not a lawyer with CR issues but I did make an effort to check and left reference notes commented in code where I loaded the images.

i1 = _LoadImage("phoenix100.png") ' Wikimedia commons Public Domain
' https://commons.wikimedia.org/w/index.ph...type=image

More links:

This when I click image of first link:
https://commons.wikimedia.org/wiki/File:...entino.svg

This is information on using image for above link:
https://commons.wikimedia.org/wiki/Commo..._Wikimedia

To me Public Domain means pretty much OK, nobody is wanting to make money and I think we would be glad to give credit if required.

I like how the fire in one image fits so well with the color of 64.
b = b + ...
Reply
#5
Definitely better than getting one from one of those "Royalty Free" sites. I refer to those as "Reality Free" but I digress.

Yes, I really like the look of your logo. I also like the "phoenix" concept. It really felt like the place was being burned down to the ground, but they rose from the ASCII's.

Pete


Every varmint's entitled to my opinion!
Reply
#6
(04-26-2022, 07:08 PM)Pete Wrote: Definitely better than getting one from one of those "Royalty Free" sites.

Yes, but I need those free sites to bring down megabytes Animated gifs.  For forums that permit animated avatars.
Reply
#7
(04-26-2022, 07:16 PM)doppler Wrote:
(04-26-2022, 07:08 PM)Pete Wrote: Definitely better than getting one from one of those "Royalty Free" sites.

Yes, but I need those free sites to bring down megabytes Animated gifs.  For forums that permit animated avatars.

Subtle joke I was making, in that a lot of people search for "Free" images, and Google ends up giving them Royalty free sites, which aren't free at all. You just don't have to pay a royalty to use them. I think I used istockphoto, back in the day, to just purchase artwork.

So curious, are you saying those "Royality Free" sites you use have more optimized, reduced size, animated gif's for avatars? I've never used one, but now I'm imagining Sam getting taller by blasting his six-shooters into the ground.

Pete
Fake News + Phony Politicians = Real Problems

Reply
#8
You know, the first attempt at this did use an image from a Google CopyRight search. After I got it working I went back to the site, and nah, this don't look right, not when they are charging people to be members or for use of materials? something they are asking money for.

So I tried again, this image is actually better than first with coloring and design.

@Pete you can give Sam a PAINT job in Windows to increase his size and change image format too, just not icon. There are free sites for that too. (At least I think they were free, maybe cost some cookies?) Or you can modernize ole Sam with some new weaponry here:
https://qb64phoenix.com/forum/showthread.php?tid=204

<"Every varmint's entitled to my opinion!"> LOL sure are :-))
b = b + ...
Reply
#9
Yeah, I remember that one, Sabres. LOL. I do have the software needed to add my Sam signature to the bottom of the Sam avatar. I've been considering doing just that. Seriously, my only reservation against using that saying as a signature in every post is chasing away a newbie. A newcomer to the forum who reads that in his reply might get the impression I'm some sort of cranky old red-neck ASCII kicker, when in all actuality, I really don't consider myself as all that old.

Pete
Fake News + Phony Politicians = Real Problems

Reply
#10
Comment Deleted
Reply




Users browsing this thread: 4 Guest(s)