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@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal