[comp.lang.pascal] Turbo Pascal Graphics. HELP!

dmurdoch@watstat.waterloo.edu (Duncan Murdoch) (02/10/91)

In article <1991Feb8.060006.1333@uwasa.fi> ts@uwasa.fi (Timo Salmi) writes:
>
>The obvious solution is to save the screen in parts, each one < 64K. 
>It is simple as that.  And it works.  Usually four parts is enough,
>but this naturally depends. 

The trouble is that the Imagesize function returns a word, so you're never
quite sure that you haven't miscalculated, especially if you're trying to
write a device-independent program.  What if someone wants to run it on a 
machine with a 1024x1024 screen, with 24 bits per pixel?  

Duncan Murdoch

ts@uwasa.fi (Timo Salmi) (02/11/91)

In article <2910@oucsace.cs.OHIOU.EDU> tswingle@oucsace.cs.OHIOU.EDU (Tom Swingle) writes:
>
>In article <1991Feb10.031517.26075@maytag.waterloo.edu> dmurdoch@watstat.waterloo.edu (Duncan Murdoch) writes:
>>In article <1991Feb8.060006.1333@uwasa.fi> ts@uwasa.fi (Timo Salmi) writes:
>>>
>>>The obvious solution is to save the screen in parts, each one < 64K. 
>>>It is simple as that.  And it works.  Usually four parts is enough,
>>>but this naturally depends. 
>>
>>The trouble is that the Imagesize function returns a word, so you're never
>>quite sure that you haven't miscalculated, especially if you're trying to
>
>Don't use Imagesize if you're worried about miscalculating.  Use the formula
>round((x2-x1+1)*(y2-y1+1)*(getmaxcolor+1)/256) to roughly calculate the number

This is a nice solution.  But there is also a simple kludge with
ImageSize.  Set your ImageSize condition as < 63K.  I may be
mistaken, but doesn't ImageSize return 64K, if the actual size of
the screen portion exceeds the 64K.  

...................................................................
Prof. Timo Salmi        
Moderating at garbo.uwasa.fi anonymous ftp archives 128.214.12.37
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun

mcastle@mcs213f.cs.umr.edu (Mike Castle {Nexus}) (02/11/91)

In article <1991Feb11.073446.700@uwasa.fi> ts@uwasa.fi (Timo Salmi) writes:
>( trying to stop that nasty habit of including every referenced article :-)
>This is a nice solution.  But there is also a simple kludge with
>ImageSize.  Set your ImageSize condition as < 63K.  I may be
>mistaken, but doesn't ImageSize return 64K, if the actual size of
>the screen portion exceeds the 64K.  

From Turbo Pascal 5.0 Reference Guide, page 312:

    If the memory required to save the region is greater then
    or equal to 64K, a value of 0 is returned and _GraphResult_
    will return -11 (_grError_).

Nice try, Timo.  :->
-- 
Mike Castle (Nexus) S087891@UMRVMA.UMR.EDU (preferred)       | RN ate my 
                mcastle@mcs213k.cs.umr.edu (unix mail-YEACH!)| .newsrc!
Life is like a clock:  You can work constantly, and be right | I am not
all the time, or not work at all, and be right twice a day.  | happy :-<

CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) (02/11/91)

In article <1991Feb10.031517.26075@maytag.waterloo.edu>,
  dmurdoch@watstat.waterloo.edu (Duncan Murdoch) wrote:

In article <1991Feb8.060006.1333@uwasa.fi> ts@uwasa.fi (Timo Salmi) writes:

>>The obvious solution is to save the screen in parts, each one < 64K.
>>It is simple as that.  And it works.  Usually four parts is enough,
>>but this naturally depends.
>
>The trouble is that the Imagesize function returns a word, so you're
>never quite sure that you haven't miscalculated, especially if
>you're trying to write a device-independent program.  What if
>someone wants to run it on a machine with a 1024x1024 screen, with
>24 bits per pixel?

According to the 5.X Ref Guide, if the returned value of ImageSize
should equal or exceed 64K, it is returned as 0 and GraphResult will
return -11. If that is correct, you can be quite sure you haven't
miscalculated if you check for a 0 return from ImageSize.

(I Am Not A Graphics Programmer and just report what the manual
says.)

+--------------------------------------------------------------------+
| Karl Brendel                           Centers for Disease Control |
| Internet: CDCKAB@EMUVM1.BITNET         Epidemiology Program Office |
| Bitnet: CDCKAB@EMUVM1                  Atlanta, GA, USA            |
|                        Home of Epi Info 5.0                        |
+--------------------------------------------------------------------+