Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
trouble filling in a closed vector shape
#11
Oooh, I'd been thinking about rotation, but you've achieved it! 
Will give this a try when I get back to the computer. 
Thanks!
Reply
#12
@bplus

Thanks bplus. I'm glad my idea inspired you. Have you tried adding transparency to the plasma color calculation? Maybe that would improve the effect. Also - is it intentional that all three channels of the plasma color are calculated the same? Wouldn't it be better if each color had a slightly different SIN factor, so its value would fall and rise differently?


Reply
#13
(11-09-2025, 04:53 PM)Petr Wrote: @bplus

Thanks bplus. I'm glad my idea inspired you. Have you tried adding transparency to the plasma color calculation? Maybe that would improve the effect. Also - is it intentional that all three channels of the plasma color are calculated the same? Wouldn't it be better if each color had a slightly different SIN factor, so its value would fall and rise differently?

In ResetPlasma you will see a separate randomly selected value for each primary hue: Red = PR, Green = PG and Blue = PB, they are Dim Shared variables.
Code: (Select All)
Sub resetPlasma ()
    ''Dim Shared cN, pR, pG, pB
    pR = Rnd ^ 2: pG = Rnd ^ 2: pB = Rnd ^ 2: cN = 0
End Sub

That creates a unique color pallet. CN allows the pattern to be sequenced so that it repeats cyclically after so many calls depending on the unique pR, pG, pB set.

Code: (Select All)
Function Plasma~& ()
    cN = cN + 1 ''Dim Shared cN, pR, pG, pB
    Plasma~& = _RGB32(127 + 127 * Sin(pR * cN), 127 + 127 * Sin(pG * cN), 127 + 127 * Sin(pB * cN))
End Function

The Plasma calc looks the same with the 127 + 127 * Sin (...
but that just allows full expression of the range between 0 and 255 for each hue depending on the expression inside of the Sin() calc. You could alter and deaden the drama by changing the 127's but for most general purposes the full range is nice effect.

Transparencies might be interesting in coloring where overlap becomes interesting. I will look for an opportunity to test that, thanks!
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#14
Some cool ideas guys - unfortunately this is a busy weekend so my computer time is limited, but I look forward to playing with your code when I can!
Reply
#15
(11-08-2025, 07:44 PM)bplus Wrote: A little mod of numbers:
Okay @bplus, I was playing with your code, and saw some strange behavior. 
Download the attached files and give them a run. 

2 questions:

Q1:
For FreeImage, I use a simple routine that checks to make sure the image is initialized before it does _FreeImage, so it doesn't blow up: 

Code: (Select All)
Sub FreeImage (ThisImage&)
    If ThisImage& < -1 Or ThisImage& > 0 Then _FreeImage ThisImage&
End Sub ' FreeImage
however, for some reason it in your program it fails with an illegal function call error.
I reverted back to the regular _FreeImage and did a check of the image handle value, and it doesn't change before or after the _FreeImage.
Shouldn't the value of the image handle go to 0 after it is freed? 

Q2:
I don't know why, but for some reason in my version, the colors are these subdued pastels, and not the vibrant colors you had. What happened? 

Anyway, I like your proggie, I'm just a little baffled by these 2 things...


Attached Files Thumbnail(s)
   

.bas   VH logo SwapColor test 10.bas (Size: 7.06 KB / Downloads: 11)
Reply
#16
Wait you rewrite my code into your sub and want me to debug it for you?

off the top of my scan of what you have...
Quote:    ' *****************************************************************************
    ' *** DEBUG: THIS RETURNS AN ILLEGAL FUNCTION CALL ERROR:
    FreeImage image1
    FreeImage image2

Why are you freeing both images? I saved the original to recall over and over and swapped colors with the original Black color that the .png used for the image we want to duplicate in different colors. Just free the changed color image and save original to reswap colors.

so thats maybe where the on error is coming from.

dang why cant you put everything in a single zip for easy download and extract, instead of making me work to download the png then download your code and then connect the 2 in a folder. I did that for you please return the favor specially if you want me to debug your mistakes.

Sorry feel'n lazy today. I say study my code that works more carefully.

If btest = _True where did you define _True? no where that I can see so it = 0 which is false.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#17
(11-08-2025, 07:30 PM)bplus Wrote: @Petr you inspired me!
I have another question BPlus. My prog (see attached) uses Sub RotoLine (which uses Sub RotoZoom23d , or now Sub RotoZoom23d3  which I based on the updated RotoZoom in your vh logo program). 

Anyway, either way, I'm wondering how we might modify RotoLine and/or RotoZoom to get the stripes to extend all the way off the screen, so you don't see those corners at the end? 

I have tried messing with the variables but haven't found anything that worked. 

[Image: Roto-Line-question.png]

Any help or guidance much appreciated!


Attached Files
.bas   VanHalenizer2-06-02b.bas (Size: 214.91 KB / Downloads: 13)
Reply
#18
(11-10-2025, 06:43 PM)bplus Wrote: Wait you rewrite my code into your sub and want me to debug it for you?

Didn't really rewrite it, just renamed vars and minor tweaks to match my program.

(11-10-2025, 06:43 PM)bplus Wrote:
Quote:    ' *****************************************************************************
    ' *** DEBUG: THIS RETURNS AN ILLEGAL FUNCTION CALL ERROR:
    FreeImage image1
    FreeImage image2
Why are you freeing both images?

At the end, don't we want to free up our objects, images, etc.?
That's just standard housekeeping, right??

Per the wiki:
Quote:
  • Invalid image handle values of -1 or 0 cannot be freed or an "Illegal Function" error will occur. Check the handle value first.

Which is why I do 
    If t& < -1 Or t& > 0 Then _FreeImage t&

However, reading the wiki, they also say this:
  • Note that calling _FREEIMAGE only frees the handle. It does NOT reset the variable used to store the handle back to 0.

so that explains why the value didn't change to 0 after doing a _FreeImage.
So my code
    If t& < -1 Or t& > 0 Then _FreeImage t&
doesn't really guarantee that the image handle is valid or hasn't already been freed.
So that answers my question (why was it blowing up?) and leads to a followup question:
is there any graceful way to check first if an image handle is valid or has already been freed before calling _FreeImage?
I'm not expecting you to answer it, just telling you where I'm at.

(11-10-2025, 06:43 PM)bplus Wrote: I saved the original to recall over and over and swapped colors with the original Black color that the .png used for the image we want to duplicate in different colors. Just free the changed color image and save original to reswap colors.
so thats maybe where the on error is coming from.

Yes but none of your logic changed, I was just not sure why my FreeImage wasn't working. I thought that maybe the swap color routine (which uses mem) did something funny with the image handle that I don't understand. But reading the wiki more carefully, I see why it failed.

(11-10-2025, 06:43 PM)bplus Wrote: dang why cant you put everything in a single zip for easy download and extract
...
I did that for you please return the favor specially if you want me to debug your mistakes.

Wow, I really annoyed you today... Sorry!

My question was specifically, why is the FreeImage blowing up. Your code still worked otherwise (apart from the colors now looking kinda pastel). I wasn't asking you to debug a non-working program, just wondering what is up with the FreeImage.

(11-10-2025, 06:43 PM)bplus Wrote: If btest = _True where did you define _True?

You know _TRUE and _FALSE are now native to QB64PE now, right? No need to define them anymore.  Smile
Reply
#19
Quote:You know _TRUE and _FALSE are now native to QB64PE now, right? No need to define them anymore.  

No in one ear out the other eye Wink  I haven't updated since 4.0 , so now tell me _True is -1 in 4.0 LOL
   
oops sorry.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#20
Quote:My question was specifically, why is the FreeImage blowing up.

Are you saying freeimage is blowing up from my code? I ran it for some time, no sign of leaks???

Quote:
bplus Wrote: Wrote:
Quote: Wrote:    ' *****************************************************************************
    ' *** DEBUG: THIS RETURNS AN ILLEGAL FUNCTION CALL ERROR:
    FreeImage image1
    FreeImage image2
Why are you freeing both images?

At the end, don't we want to free up our objects, images, etc.?
That's just standard housekeeping, right??

Yeah I realised this later.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  simple 3d starfield & wireframe or vector graphics revisited madscijr 5 263 01-31-2026, 09:41 PM
Last Post: Pete
  trouble building ansiprint by a740g hsiangch_ong 2 578 01-09-2025, 12:57 AM
Last Post: hsiangch_ong
  Having trouble Windows command line SORT via SHELL GTC 19 4,367 08-26-2023, 04:19 AM
Last Post: GTC
  How do I paint a shape? PhilOfPerth 21 3,921 06-28-2023, 10:09 PM
Last Post: TempodiBasic
Photo Ellipse trouble james2464 14 2,998 08-25-2022, 10:52 PM
Last Post: james2464

Forum Jump:


Users browsing this thread: