Video display modes: Difference between revisions

m
→‎{{header|Wren}}: Removed a blank line
m (Added language identifier.)
m (→‎{{header|Wren}}: Removed a blank line)
 
(8 intermediate revisions by 3 users not shown)
Line 376:
9010 get k$:if k$="" then 9010
9020 return</syntaxhighlight>
 
=={{header|Delphi}}==
{{works with|Delphi|6.0}}
{{libheader|SysUtils,StdCtrls}}
Delphi is primarily a language used under advanced operating systems such as Windows, Linux and iOS. Under Windows, the video resolution and color depth is controlled by Windows, the monitor, the video card and the choices of the user. These days, color is almost always set to 32-bit pixels with 8-bits for Red, Green and Blue, plus an alpha channel for transparency. Most people run their displays at 1080P resolution or higher. So under Windows, you typically have the highest possible resolution. Given these resolutions and the size of monitors these days, there is so much graphics real estate on the average display, that most programs only need to use a portion of the screen to display all their information.
 
Under these circumstances, the only way you could change the screen resolution or color depth would be to change it downward. The only reason you'd ever want lower resolution displays is if you were simulating the pixelated, low quality graphics of old computers. And, if you really want to display a low graphics, it is pretty easy to simulate it with high resolution graphics.
 
Delphi supports working in the world of high resolution displays by allowing you to easily create windows that are sizable by the programmer or the user. It supports putting text in a window with components like the "TMemo" object. Likewise, you can draw or put images into a window with the "TImage" component.
 
As an example of how this works, here is some code that would wrote text into a text window:
 
<syntaxhighlight lang="Delphi">
begin
Memo.Line.Add('Hello World');
end;
</syntaxhighlight>
 
Here's an example of drawing lines in a graphics window;
 
<syntaxhighlight lang="Delphi">
 
begin
Image.Canvas.MoveTo(0,0);
Image.Canvas.LineTo(100,100);
end;
 
 
 
 
</syntaxhighlight>
{{out}}
[[File:DelphiMemoWindow.png|frame|none]]
[[File:DelphiImageWindow.png|frame|none]]
<pre>
 
</pre>
 
=={{header|ERRE}}==
Line 554 ⟶ 591:
=={{header|Java}}==
<syntaxhighlight lang="java">
 
import java.awt.Color;
import java.awt.DisplayMode;
Line 568 ⟶ 606:
public static void main(String[] aArgs) throws InterruptedException {
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] screens = environment.getScreenDevices();
System.out.println("Number of video screens: " + screens.length + System.lineSeparator());
for ( GraphicsDevice screen : screens ) {
System.out.println("ScreenFull ID:screen "display +is screen.isFullScreenSupported()supported: + System.lineSeparator());"
+ screen.isFullScreenSupported() + System.lineSeparator());
GraphicsConfiguration[] configurations = screen.getConfigurations();
System.out.println("This screen has number of configurations: " + configurations.length);
for System.out.println("This GraphicsConfigurationscreen confighas :number of configurations: )" {+ configurations.length);
for ( GraphicsConfiguration config : configurations ) {
System.out.println("Configuration supports translucency: " + config.isTranslucencyCapable());
}
}
}
DisplayMode[] modes = screen.getDisplayModes();
System.out.println(System.lineSeparator() + "This screen has " + modes.length + " modes of operation");
for ( DisplayMode mode : modes ) {
System.out.println(mode.getWidth() + " X " + mode.getHeight()
System.out.println(mode.getWidth() + " with refresh rateX " + mode.getRefreshRategetHeight() + " Hz");
+ " with refresh }rate " + mode.getRefreshRate() + " Hz");
}
}
// Uncomment the line below to see an example of programmatically changing the video display.
// new VideoDisplay();
}
Line 626 ⟶ 665:
Number of video screens: 1
 
Full screen display is supported: true
Screen ID: true
 
This screen has number of configurations: 1
Line 971 ⟶ 1,010:
=={{header|Wren}}==
The ability to call external processes such as ''xrandr'' is expected to be added to Wren-cli in the next release. In the meantime, we embed the following Wren script in a minimal C host (no error checking) to complete this task.
<syntaxhighlight lang="ecmascriptwren">/* video_display_modesVideo_display_modes.wren */
 
class C {
Line 995 ⟶ 1,034:
<br>
We now embed this in the following C program, compile and run it.
<syntaxhighlight lang="c">#include/* <stdiogcc Video_display_modes.h>c -o Video_display_modes -lwren -lm */
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Line 1,052 ⟶ 1,093:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "video_display_modesVideo_display_modes.wren";
char *script = readFile(fileName);
wrenInterpret(vm, module, script);
9,482

edits