Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
TCHATGPT — An Artificial ...
by
Weiss
[
Today
at 07:00:13 am]
You can embed Windows Con...
by
Ozz_Nixon
[
Today
at 03:39:13 am]
[New Component] ExtTabCtr...
by
jianwt
[
Today
at 02:48:15 am]
Implementing an Elo ratin...
by
mas steindorff
[
Today
at 12:55:07 am]
FPC Unleashed (inline var...
by
440bx
[June 16, 2026, 11:53:51 pm]
Codepage issue in console...
by
ASerge
[June 16, 2026, 11:37:57 pm]
RFC: Separation of MCU an...
by
ackarwow
[June 16, 2026, 11:06:14 pm]
Error with last fixes_3.2...
by
patyit
[June 16, 2026, 09:49:02 pm]
RunFormula: math expressi...
by
stormray
[June 16, 2026, 06:20:13 pm]
Mundo Medieval 3D MMORPG ...
by
Rodrigo Robles
[June 16, 2026, 06:06:17 pm]
Which Control should I us...
by
wp
[June 16, 2026, 05:08:55 pm]
Just Question App paramet...
by
eldonfsr
[June 16, 2026, 04:50:19 pm]
Pdf Viewer in Pascal
by
Handoko
[June 16, 2026, 03:55:42 pm]
Content is distorting / w...
by
Handoko
[June 16, 2026, 03:53:02 pm]
ZxTune chiptunes player
by
Guva
[June 16, 2026, 12:41:14 pm]
Onscroll event for Tscrol...
by
laz_one_or2
[June 16, 2026, 11:16:39 am]
Fpcupdeluxe
by
CharlyTango
[June 16, 2026, 10:35:33 am]
Compiling Qt6 project on ...
by
wp
[June 16, 2026, 10:14:53 am]
What am I missing here? [...
by
loaded
[June 16, 2026, 08:11:06 am]
IDE Editor (OS: Windows11...
by
keith
[June 16, 2026, 07:36:18 am]
Single and Double, Conver...
by
avk
[June 16, 2026, 06:55:03 am]
AI Assist Python - to - P...
by
kirtu
[June 16, 2026, 12:57:01 am]
Instruction-level paralle...
by
LeP
[June 16, 2026, 12:23:51 am]
Lazarus syntax helpers
by
Edson
[June 15, 2026, 10:34:34 pm]
Can /my/ AI help me with ...
by
microxa
[June 15, 2026, 08:25:36 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Peter de Jong Attractor: Bgrabmp Colouring Help Needed ? (Read 747 times)
Boleeman
Hero Member
Posts: 1158
Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
«
on:
April 16, 2025, 10:19:59 am »
I made a Lazarus program that creates Peter de Jong Attractors.
I am trying to get a
smooth high coloured rainbow effect
like at
https://richardrosenman.com/shop/peter-de-jong-attractor/
I used a TBgrabmap for the rendering but have been struggling to get a high coloured rendering."
Up to version 4, after making a basic rendering and then extending it.
Logged
Thaddy
Hero Member
Posts: 19273
Glad to be alive.
Re: Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
«
Reply #1 on:
April 16, 2025, 02:14:43 pm »
Wow. Made me think to apply it to audio:
Code: Pascal
[Select]
[+]
[-]
unit
PeterDeJongAttractor
;
{$mode objfpc}
interface
uses
Math
,
Types
;
type
TDoublePoint
=
record
X
,
Y
:
Double
;
constructor
Create
(
AX
,
AY
:
Double
)
;
end
;
constructor
TDoublePoint
.
Create
(
AX
,
AY
:
Double
)
;
begin
X
:
=
AX
;
Y
:
=
AY
;
end
;
TPDJAttractor
=
class
private
Fx
,
Fy
:
Double
;
FParamA
,
FParamB
,
FParamC
,
FParamD
:
Double
;
public
constructor
Create
(
a
,
b
,
c
,
d
:
Double
)
;
/// Returns the next point in the attractor sequence
function
Iterate
:
TDoublePoint
;
inline
;
/// Reset to initial state (optional)
procedure
Reset
;
inline
;
end
;
implementation
constructor
TPDJAttractor
.
Create
(
a
,
b
,
c
,
d
:
Double
)
;
begin
FParamA
:
=
a
;
FParamB
:
=
b
;
FParamC
:
=
c
;
FParamD
:
=
d
;
Fx
:
=
0
;
Fy
:
=
0
;
end
;
function
TPDJAttractor
.
Iterate
:
TDoublePoint
;
var
newX
,
newY
:
Double
;
begin
newX
:
=
Sin
(
FParamA
*
Fy
)
-
Cos
(
FParamB
*
Fx
)
;
newY
:
=
Sin
(
FParamC
*
Fx
)
-
Cos
(
FParamD
*
Fy
)
;
Fx
:
=
newX
;
Fy
:
=
newY
;
Result
:
=
TDoublePoint
.
Create
(
newX
,
newY
)
;
end
;
procedure
TPDJAttractor
.
Reset
;
begin
Fx
:
=
0
;
Fy
:
=
0
;
end
;
end
.
Then:
Code: Pascal
[Select]
[+]
[-]
procedure
TMyVSTModule
.
ProcessAudioBlock
(
Buffer
:
PSingle
;
SampleCount
:
Integer
)
;
var
i
:
Integer
;
AttractorPoint
:
TDoublePoint
;
ModulationValue
:
Single
;
begin
for
i
:
=
0
to
SampleCount
-
1
do
begin
// Retrieve the current attractor values (could be at a slower modulation rate)
AttractorPoint
:
=
FMyAttractor
.
Iterate
;
// Map the output to a useful modulation range. For example, normalize and scale:
ModulationValue
:
=
(
CSng
(
AttractorPoint
.
X
)
+
2
)
/
4
;
// maps from [-2,2] to [0,1]
// Use ModulationValue to influence a parameter in your DSP code:
// For example, adjust oscillator frequency, filter cutoff, etc.
ApplyModulationToYourDSP
(
ModulationValue
)
;
// Continue processing audio...
Buffer
[
i
]
:
=
ProcessSample
(
Buffer
[
i
]
)
;
end
;
end
;
I think I have a VST to write....This is just a scetch.
You can probably also use this simple unit for your graphics purpose.
«
Last Edit: April 16, 2025, 02:55:37 pm by Thaddy
»
Logged
objects are fine constructs. You can even initialize them with constructors.
Boleeman
Hero Member
Posts: 1158
Re: Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
«
Reply #2 on:
April 17, 2025, 01:44:08 am »
Wondered how that audio version would sound ?
There are lots of graphic versions about , written in other languages but never thought of audio versions.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
TinyPortal
© 2005-2018