Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-07

graphh.inc - few questions.

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Evgeniy Ivanov

Hi!
I'm doing sdlgraph - so I put my self to packages/base/graph.

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 ;

But in windows and go32v2 there are no any routines for PutPixel from 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...

I will thankful for answers.

I may rewrite somethings, but as I have undersood - the best way is to use graph.inc and graphh.inc.

E.I.
Jonas Maebe
to Evgeniy Ivanov
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.

Show quoted text 6 lines
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 ; 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.

Show quoted text 17 lines
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 ;
mode.PutPixel:={$ifdef ;
          mode.GetPixel:={$ifdef ;
          mode.SetRGBPalette := {$ifdef ;
          mode.GetRGBPalette := {$ifdef ;
          mode.SetAllPalette := {$ifdef
SetVGARGBAllPalette;
          mode.SetVisualPage := {$ifdef ;
          mode.SetActivePage := {$ifdef ;
          mode.InitMode := {$ifdef ;
          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

Evgeniy Ivanov
to Jonas Maebe

Thanks, Jonas. I will deep inside it.

2007/7/16, Jonas Maebe :

Show quoted text 77 lines
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 ; > 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 ; > mode.PutPixel:={$ifdef ; mode.GetPixel:={$ifdef ; mode.SetRGBPalette := {$ifdef ; mode.GetRGBPalette := {$ifdef ; mode.SetAllPalette := {$ifdef SetVGARGBAllPalette; mode.SetVisualPage := {$ifdef ; mode.SetActivePage := {$ifdef ; mode.InitMode := {$ifdef ; 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 - http://lists.freepascal.org/mailman/listinfo/fpc-devel
E.I.