text stringlengths 0 234 |
|---|
-- |
procedure Output_uncompressed( |
data : in Byte_array; |
reject: out Natural |
-- amount of bytes to be resent here next time, |
-- in order to have a full multi-byte pixel |
) |
is |
-- Display of pixels coded on 8 bits per channel in the PNG stream |
procedure Out_Pixel_8(br, bg, bb, ba: U8) is |
pragma Inline(Out_Pixel_8); |
function Times_257(x: Primary_color_range) return Primary_color_range is |
pragma Inline(Times_257); |
begin |
return 16 * (16 * x) + x; -- this is 257 * x, = 16#0101# * x |
-- Numbers 8-bit -> no OA warning at instanciation. Returns x if type Primary_color_range is mod 2**8. |
end Times_257; |
begin |
case Primary_color_range'Modulus is |
when 256 => |
Put_Pixel( |
Primary_color_range(br), |
Primary_color_range(bg), |
Primary_color_range(bb), |
Primary_color_range(ba) |
); |
when 65_536 => |
Put_Pixel( |
Times_257(Primary_color_range(br)), |
Times_257(Primary_color_range(bg)), |
Times_257(Primary_color_range(bb)), |
Times_257(Primary_color_range(ba)) |
-- Times_257 makes max intensity FF go to FFFF |
); |
when others => |
raise invalid_primary_color_range; |
end case; |
end Out_Pixel_8; |
procedure Out_Pixel_Palette(ix: U8) is |
pragma Inline(Out_Pixel_Palette); |
color_idx: constant Natural:= Integer(ix); |
begin |
Out_Pixel_8( |
image.palette(color_idx).red, |
image.palette(color_idx).green, |
image.palette(color_idx).blue, |
255 |
); |
end Out_Pixel_Palette; |
-- Display of pixels coded on 16 bits per channel in the PNG stream |
procedure Out_Pixel_16(br, bg, bb, ba: U16) is |
pragma Inline(Out_Pixel_16); |
begin |
case Primary_color_range'Modulus is |
when 256 => |
Put_Pixel( |
Primary_color_range(br / 256), |
Primary_color_range(bg / 256), |
Primary_color_range(bb / 256), |
Primary_color_range(ba / 256) |
); |
when 65_536 => |
Put_Pixel( |
Primary_color_range(br), |
Primary_color_range(bg), |
Primary_color_range(bb), |
Primary_color_range(ba) |
); |
when others => |
raise invalid_primary_color_range; |
end case; |
end Out_Pixel_16; |
procedure Inc_XY is |
pragma Inline(Inc_XY); |
xm, ym: Integer; |
begin |
if x < x_max then |
x:= x + 1; |
if interlaced then |
-- Position of pixels depending on pass: |
-- |
-- 1 6 4 6 2 6 4 6 |
-- 7 7 7 7 7 7 7 7 |
-- 5 6 5 6 5 6 5 6 |
-- 7 7 7 7 7 7 7 7 |
-- 3 6 4 6 3 6 4 6 |
-- 7 7 7 7 7 7 7 7 |
-- 5 6 5 6 5 6 5 6 |
-- 7 7 7 7 7 7 7 7 |
case pass is |
when 1 => |
Set_X_Y( x*8, Y_range'Last - y*8); |
when 2 => |
Set_X_Y(4 + x*8, Y_range'Last - y*8); |
when 3 => |
Set_X_Y( x*4, Y_range'Last - 4 - y*8); |
when 4 => |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.