CO538 Anonymous Questions and Answers Keyword Index |
This page provides a keyword index to questions and answers. Clicking on a keyword will take you to a page containing all questions and answers for that keyword, grouped by year.
To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.
Keyword reference for graphics
2010 |
Submission reference: IN1914
I am wanting to use the various raster graphics libraries to do my dining philosophers with, but the problem I am having is that the SDL raster interface (http://occam-pi.org/occamdoc/sdlraster.html) uses channels of type "RASTER" to output the graphics on the screen but all the other raster libraries use channels of "INT[][]".
I have looked through the documentation and cannot find a way to convert the INT[][] to RASTER, unless I first output it as an image file (which is hardly efficient when doing animations).
Is there a process that will convert the INT[][] to RASTER or some other way of displaying the images that uses INT[][]?
Have you tried compiling code that uses both of these? The RASTER type is defined to be a "MOBILE [][]INT". Although we haven't taught you about MOBILE types yet (which use a movement semantics rather than copying semantics), you should be able to pass RASTERs to procedures that expect [][]INT parameters (although not vice-versa). Within your own code, it'd be more efficient to use things like "CHAN RASTER" rather than "CHAN [][]INT", as the latter will take an appreciable amount of time to copy large graphics windows. We'd recommend just trying to compile your code as-is, and if you run into any specific type errors, ask here again :-).
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. |