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 [EMAIL PROTECTED];
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 [EMAIL PROTECTED];
         mode.PutPixel:={$ifdef [EMAIL PROTECTED];
         mode.GetPixel:={$ifdef [EMAIL PROTECTED];
         mode.SetRGBPalette := {$ifdef [EMAIL PROTECTED];
         mode.GetRGBPalette := {$ifdef [EMAIL PROTECTED];
mode.SetAllPalette := {$ifdef [EMAIL PROTECTED] SetVGARGBAllPalette;
         mode.SetVisualPage := {$ifdef [EMAIL PROTECTED];
         mode.SetActivePage := {$ifdef [EMAIL PROTECTED];
         mode.InitMode := {$ifdef [EMAIL PROTECTED];
         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@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to