[fpc-devel] graphh.inc - few questions.

Evgeniy Ivanov lolkaantimat at gmail.com
Wed Jul 18 11:40:10 CEST 2007


Thanks, Jonas. I will deep inside it.

2007/7/16, Jonas Maebe <jonas.maebe at elis.ugent.be>:
>
>
> On 14 Jul 2007, at 16:01, Evgeniy Ivanov wrote:
>
> > I'm doing sdlgraph - so I put my self to packages/base/graph.
>
> graph probably has to be moved to packages/extra, so it can easily
> use things like sdl and the (Mac OS X) universal interfaces.
>
> > I can't understand the method (where are they used?) using routines in
> > TModeInfo (from graphh.inc).
> > In custom graph modules it's used in such way:
> >             mode.PutPixel:={$ifdef fpc}@{$endif}PutPixVESA32kOr64k;
> > But in windows and go32v2 there are no any routines for PutPixel from
> > interface.
>
> They don't need to be in the interface. PutPixel is a procedure
> variable, and the only thing that needs to be in the interface (and
> it's declared in graphh.inc, which is included in the interface of
> the go32v2 and win32 unts). The procedures which are assigned to this
> procvar do not have to be in the interface.
>
> > I mean someting like
> > PutPixel       := @custom_PutPixel;   (PutPixel       :=
> > @libvga_PutPixelProc;   - in the unix graph.pp).
> >
> > So, if there are no such assignations (sorry, I don't know the
> > right word)
> > PutPixelDefault from graph.inc will be used...
> > And it is:
> >  procedure PutPixelDefault(X,Y: smallint; Color: Word);
> >   begin
> >     Writeln(stderr,'Error: Not in graphics mode (use InitGraph and
> > test
> > GraphResult afterwards)');
> >     Halt(1);
> >   end;
> >
> > But windows module works...
>
> Have a look at QueryAdapterInfo in graph.pp of go32v2. It has many
> blocks like this:
>
>           InitMode(mode);
>           { now add all standard VGA modes...       }
>           mode.DriverNumber:= LowRes;
>           mode.HardwarePages:= 0;
>           mode.ModeNumber:=0;
>           mode.ModeName:='320 x 200 VGA';
>           mode.MaxColor := 256;
>           mode.PaletteSize := mode.MaxColor;
>           mode.DirectColor := FALSE;
>           mode.MaxX := 319;
>           mode.MaxY := 199;
>           mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel320;
> >          mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel320;
>           mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel320;
>           mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
>           mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
>           mode.SetAllPalette := {$ifdef fpc}@{$endif}
> SetVGARGBAllPalette;
>           mode.SetVisualPage := {$ifdef fpc}@{$endif}SetVisual320;
>           mode.SetActivePage := {$ifdef fpc}@{$endif}SetActive320;
>           mode.InitMode := {$ifdef fpc}@{$endif}Init320;
>           mode.XAspect := 10000;
>           mode.YAspect := 10000;
>           AddMode(mode);
>
> When switching to a mode, initgraph will assign the putpixel field of
> that mode to the global putpixel procvar.
>
>
> Jonas
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>



-- 
E.I.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20070718/73a9e01b/attachment.html>


More information about the fpc-devel mailing list