[fpc-pascal] PTC Graph - Custom window sizes
James Richters
james.richters at productionautomation.net
Thu Nov 19 22:40:16 CET 2020
So far it's working great! But now I have another question... Since I can now have a small little PTCGraph window... is there any possibility of having more than one in the same program? Perhaps running each window in a different thread? Or is there something fundamental that prevents this?
James
-----Original Message-----
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of James Richters via fpc-pascal
Sent: Thursday, November 19, 2020 1:49 PM
To: 'FPC-Pascal users discussions' <fpc-pascal at lists.freepascal.org>
Cc: James Richters <james.richters at productionautomation.net>; 'Nikolay Nikolov' <nickysn at gmail.com>
Subject: Re: [fpc-pascal] PTC Graph - Custom window sizes
Thank you very much Nikolay! I will test it and let you know the results.
James
-----Original Message-----
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of Nikolay Nikolov via fpc-pascal
Sent: Thursday, November 19, 2020 1:07 PM
To: fpc-pascal at lists.freepascal.org
Cc: Nikolay Nikolov <nickysn at gmail.com>
Subject: Re: [fpc-pascal] PTC Graph - Custom window sizes
On 11/19/20 7:37 PM, Nikolay Nikolov wrote:
>
> On 11/19/20 3:44 PM, James Richters via fpc-pascal wrote:
>> I've been using PTCGraph from PTCPas and so far I can only use
>> windows sizes that there happens to be a display driver for, even if
>> they are in a window.. so I can make a 640x480 or 1024x768 window,
>> but if I have a screen in a vertical configuration now I can't get a
>> 640x480 window, I can only get a 480x640 window because with the
>> screen vertical, only vertical orientation graphics drivers are
>> available. There are times I want a totally custom size window as
>> well, like a 100x50. I see a lot of procedure like
>> ptc_Init640x480x32bpp with all kinds of configurations of screen
>> resolutions and color densities, but there is also some named
>> ptc_InitNonStandard32k.. with other color densities.. but I don't
>> know how to initialize PTCGraph into my own custom window size.
>> Does anyone know how I could make my PTCGraph windows a custom weird
>> size that doesn't necessarily match the available video drivers?
>
> It's not possible with the current implementation, but right now I'm
> working on a patch that would make this possible. I'll post here when
> it's ready for testing.
Implemented and committed in ptcpas and fpc trunk. The new function is called InstallUserMode:
function InstallUserMode(Width, Height: SmallInt; Colors: LongInt;
HardwarePages: SmallInt; XAspect, YAspect: Word): smallint;
Example use:
uses
{$ifdef UNIX}cthreads,{$endif} ptcgraph, ptccrt; var
gd, gm: SmallInt;
begin
gd := VESA;
gm := InstallUserMode(100, 160, 16, 1, 10000, 10000);
if gm < 0 then
begin
Writeln(ErrOutput, 'Error installing user mode: ', GraphErrorMsg(gm));
Halt(1);
end;
InitGraph(gd, gm, '');
OutText('Hello!');
ReadKey;
CloseGraph;
end.
It supports adding modes with 16, 256, 32768, 65536 and 16777216 colors with a custom X and Y resolution, custom number of hardware pages (for use with SetActivePage and SetVisualPage) and a custom pixel aspect ratio (used for drawing circles instead of ellipses on displays without square pixels - for square pixels, use "10000, 10000").
Please test. :)
Best regards,
Nikolay
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list