![]() |
![]() |
![]() |
| 4.51.2.4.30. ogGetPal() | Table of Contents | 4.51.2.4.32. ogGetPixFmt() |
function ogGetPixel(x, y:int32):uInt32; virtual;Remarks:
Gets the pixel value at (x,y). If the surface's bit-depth is 8BPP, this will return the indexed colour value, otherwise it will return a packed pixel.
Restrictions:Any pixel out of bounds of the surface will return the transparent colour.
See also:
{ogGetPixel.pas}
uses
ObjGfx40, CRT;
var
buf:^ogSurface;
xx, yy:uInt32;
begin
new(buf, ogInit);
{Create a 640x480x8bpp surface}
if not buf^.ogCreate(640, 480, OG_PIXFMT_8BPP) then
begin
writeln('Error allocating memory');
halt
end;
{Fill Buf with vertical lines}
for xx:=0 to buf^.ogGetMaxX do
buf^.ogVLine(xx, 0, buf^.ogGetMaxY, xx);
{Init 640x480x8bpp video mode}
if not screen^.ogCreate(640, 480, OG_PIXFMT_8BPP) then
begin
writeln('Error setting video mode');
halt
end;
{Copy all the pixels in Buf to the screen using an inefficient method}
for yy:=0 to buf^.ogGetMaxY do
for xx:=0 to buf^.ogGetMaxX do
screen^.ogSetPixel(xx, yy, buf^.ogGetPixel(xx, yy));
readKey;
dispose(buf, ogDone);
end.
![]() |
![]() |
![]() |
| 4.51.2.4.30. ogGetPal() | Table of Contents | 4.51.2.4.32. ogGetPixFmt() |