|
|
| Author |
Message |
|
| viovanov |
Posted: Fri Apr 25, 2008 6:14 pm |
|
|
|
Joined: 25 Apr 2008
Posts: 3
Location: Arad, Romania
|
I am developing some code that will plot a function that has complex arguments and results. So i reprezent the result by using colors:
http://www.kfunigraz.ac.at/imawww/vqm/pages/colormap.html
Somthing like that.
The code works perfectly, but I'm drawing the dots on the plot using 2x2 rectangles (the gs module).
This is obviously EXTREMELY slow (i only wrote that code for testing purposes).
Now I'd like to finish the project and plot the fucntion as it should be plotted (fast ).
So I was wondering if any of you guys know of a way to mimic what SetPixel or BitBlt do.
I tried using esdl, but the thing won't work (I'm using the eclipse IDE and the code is filled with errors).
Any thoughts are appreciated. |
|
|
| Back to top |
|
| viovanov |
Posted: Fri Apr 25, 2008 6:30 pm |
|
|
|
Joined: 25 Apr 2008
Posts: 3
Location: Arad, Romania
|
|
| Back to top |
|
| viovanov |
Posted: Tue Apr 29, 2008 7:58 pm |
|
|
|
Joined: 25 Apr 2008
Posts: 3
Location: Arad, Romania
|
So...
After no replies I tried searching for altenate solutions and I came up with this: i'm generating PNG files using the EGD library:
Code:
Values = zeta:getZetaValues(X_Min, X_Max, Y_Min, Y_Max, Increment, false),
Im = egd:create(round((X_Max - X_Min) / Increment),
round((Y_Max - Y_Min) / Increment)),
lists:map(
fun({{X, Y},{A, B}}) ->
egd:rectangle(Im,
{round((X - X_Min)/Increment), round((Y - Y_Min)/Increment)},
{round((X - X_Min)/Increment), round((Y - Y_Min)/Increment)},
egd:color(fn:color_c({A, B})))
end, Values),
egd:save(egd:render(Im, png), string:concat(string:concat("test", integer_to_list(Index)), ".png"))
This is really fast, plus I'll be able to export the plots with no extra code. There is a problem though: I need to load the PNG(s) in the window generated using GS.
Any ideeas on how to do that?
Thanks,Vlad |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|