text stringlengths 0 234 |
|---|
when others => |
null; |
end case; |
end Get_pixel; |
tmp : GL.Ubyte; |
begin -- RLE_Pixel |
if RLE_pixels_remaining = 0 then -- load RLE code |
Get_Byte (stream_buf, tmp); |
Get_pixel; |
RLE_pixels_remaining := GL.Ubyte'Pos (tmp and 16#7F#); |
is_run_packet := (tmp and 16#80#) /= 0; |
if is_run_packet then |
case iBits is |
when 32 => |
pix_mem (1 .. 4) := pix; |
when 24 => |
pix_mem (1 .. 3) := pix; |
when 8 => |
pix_mem (1 .. 1) := pix; |
when others => |
null; |
end case; |
end if; |
else |
if is_run_packet then |
case iBits is |
when 32 => |
pix := pix_mem (1 .. 4); |
when 24 => |
pix := pix_mem (1 .. 3); |
when 8 => |
pix := pix_mem (1 .. 1); |
when others => |
null; |
end case; |
else |
Get_pixel; |
end if; |
RLE_pixels_remaining := RLE_pixels_remaining - 1; |
end if; |
end RLE_Pixel; |
-- ============= |
-- getRGBA |
-- Reads in RGBA data for a 32bit image. |
-- ============= |
procedure getRGBA (buffer : out Byte_Array) is |
i : Integer := buffer'First; |
begin |
if RLE then |
while i <= buffer'Last - 3 loop |
RLE_Pixel (32, buffer (i .. i + 3)); |
i := i + 4; |
end loop; |
else |
while i <= buffer'Last - 3 loop |
-- TGA is stored in BGRA, make it RGBA |
Get_Byte (stream_buf, buffer (i + 2)); |
Get_Byte (stream_buf, buffer (i + 1)); |
Get_Byte (stream_buf, buffer (i)); |
Get_Byte (stream_buf, buffer (i + 3)); |
i := i + 4; |
end loop; |
end if; |
the_Image.tex_Format := GL.RGBA; |
the_Image.tex_pixel_Format := GL.RGBA; |
end getRGBA; |
-- ============= |
-- getRGB |
-- Reads in RGB data for a 24bit image. |
-- ============= |
procedure getRGB (buffer : out Byte_Array) is |
i : Integer := buffer'First; |
begin |
if RLE then |
while i <= buffer'Last - 2 loop |
RLE_Pixel (24, buffer (i .. i + 2)); |
i := i + 3; |
end loop; |
else |
while i <= buffer'Last - 2 loop |
-- TGA is stored in BGR, make it RGB |
Get_Byte (stream_buf, buffer (i + 2)); |
Get_Byte (stream_buf, buffer (i + 1)); |
Get_Byte (stream_buf, buffer (i)); |
i := i + 3; |
end loop; |
end if; |
the_Image.tex_Format := GL.RGB; |
the_Image.tex_pixel_Format := GL.RGB; |
end getRGB; |
-- ============= |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.