Comments (6)
@noughtmare I'd try using the loadImage
function, if that still gives you problems I can look into it tonight. The example I have might be outdated.
from arrayfire-haskell.
@dmjio loadImage
loads an image from disk, I want to generate an image programmatically (and then show it in a window).
from arrayfire-haskell.
@noughtmare I think the type needs to be CBool
(b8
). Can confirm soon.
from arrayfire-haskell.
@dmjio If I use CBool
then I get the error:
free(): invalid size
Aborted
from arrayfire-haskell.
@noughtmare there's been some fixes (related to double free'ing of pointers) that are now in HEAD, am working on the Graphics module now with success. drawSurface
in particular.
As I inspect more with what the C++ is doing before it sends it to the C, we'll have better working visualization code, and examples !
main :: IO ()
main = do
window <- createWindow 800 600 "hey"
let x = iota [60,1] [1,60] / 29
y = iota [1,60] [60,1] / 29
go window (0 :: Array Float) x y
where
go window t x y = do
let z = 10*x*(-abs(y)) * cos(x*x*(y+t))+sin(y*(x+t))-1.5
drawSurface window x y z (Cell (-1) (-1) "there" ColorMapDefault)
closed <- isWindowClosed window
unless closed $ go window (t + 0.07) x y
from arrayfire-haskell.
@noughtmare, for drawImage
, try something like this:
main :: IO ()
main = render =<< createWindow 800 600 "hey"
where
render window = do
let x = iota [1,60] [60,1] / (30 :: Array Float)
cell = Cell (-1) (-1) "" ColorMapDefault
drawImage window x cell
closed <- isWindowClosed window
unless closed (render window)
I'll update the documentation to reflect this.
from arrayfire-haskell.
Related Issues (20)
- Remove unimplemented internal functions. HOT 4
- imag and real should have type Array (Complex a) -> Array a HOT 1
- Strong types for logical operators HOT 4
- Show instance transposed? HOT 7
- re-add quickcheck-classes tests HOT 1
- improve quickcheck generator for Array/add new ones
- update nixpkgs to use arrayfire 3.6.4 stable HOT 1
- Get doctests working
- Shields
- Three major releases in 24 hours. HOT 12
- Investigate Bits instance on Array CBool HOT 1
- Smart constructors are transposed HOT 5
- Most reductions in ArrayFire.Algorithms should return array, not scalar HOT 2
- ArrayFire benchmarks HOT 10
- Fix documentation to show column-major order. HOT 1
- Document linking Haskell wrapper when building from source
- Getting a failure on these tests that is very strange HOT 1
- How does transfer an image array to such array?
- How to generate an array according to the rules defined by oneself? HOT 1
- Windows not a supported platform? Installation errors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arrayfire-haskell.