text stringlengths 0 234 |
|---|
"][" & U8'Image(temp) & ']' |
); |
end if; |
case separator is |
when ',' => -- 16#2C# |
exit; |
-- Image descriptor will begin |
-- See: 20. Image Descriptor |
when ';' => -- 16#3B# |
if full_trace then |
Ada.Text_IO.Put(" - End of GIF"); |
end if; |
image.next_frame:= 0.0; |
next_frame:= image.next_frame; |
return; -- End of GIF image |
when '!' => -- 16#21# Extensions |
if full_trace then |
Ada.Text_IO.Put(" - Extension"); |
end if; |
Get_Byte(image.buffer, label ); |
Raw_Byte (label); |
case label is |
when 16#F9# => -- See: 23. Graphic Control Extension |
if full_trace then |
Ada.Text_IO.Put_Line(" - 16#F9#: Graphic Control Extension"); |
end if; |
Get_Byte(image.buffer, temp ); |
Raw_Byte(temp); |
if temp /= 4 then |
Raise_Exception( |
error_in_image_data'Identity, |
"GIF: error in Graphic Control Extension" |
); |
end if; |
Get_Byte(image.buffer, temp ); |
Raw_Byte(temp); |
-- Reserved 3 Bits |
-- Disposal Method 3 Bits |
-- User Input Flag 1 Bit |
-- Transparent Color Flag 1 Bit |
frame_transparency:= (temp and 1) = 1; |
Read_Intel(image.buffer, delay_frame); |
image.next_frame:= |
image.next_frame + Ada.Calendar.Day_Duration(delay_frame) / 100.0; |
next_frame:= image.next_frame; |
Get_Byte(image.buffer, temp ); |
Raw_Byte(temp); |
Transp_color:= Color_type(temp); |
-- zero sub-block: |
Get_Byte(image.buffer, temp ); |
Raw_Byte(temp); |
when 16#FE# => -- See: 24. Comment Extension |
if full_trace then |
Ada.Text_IO.Put_Line(" - 16#FE#: Comment Extension"); |
sub_blocks_sequence: |
loop |
Get_Byte(image.buffer, temp ); -- load sub-block length byte |
Raw_Byte(temp); |
exit sub_blocks_sequence when temp = 0; |
-- null sub-block = end of sub-block sequence |
for i in 1..temp loop |
Get_Byte(image.buffer, temp2); |
Raw_Byte(temp2); |
c:= Character'Val(temp2); |
Ada.Text_IO.Put(c); |
end loop; |
end loop sub_blocks_sequence; |
Ada.Text_IO.New_Line; |
else |
Skip_sub_blocks; |
end if; |
when 16#01# => -- See: 25. Plain Text Extension |
if full_trace then |
Ada.Text_IO.Put_Line(" - 16#01#: Plain Text Extension"); |
end if; |
Skip_sub_blocks; |
when 16#FF# => -- See: 26. Application Extension |
if full_trace then |
Ada.Text_IO.Put_Line(" - 16#FF#: Application Extension"); |
end if; |
Skip_sub_blocks; |
when others => |
if full_trace then |
Ada.Text_IO.Put_Line(" - Unused extension:" & U8'Image(label)); |
end if; |
Skip_sub_blocks; |
end case; |
when ASCII.NUL => |
-- Occurs in some buggy GIFs (2016). |
-- Seems a 2nd zero, the 1st marking the end of sub-block list. |
if full_trace then |
Ada.Text_IO.Put_Line(" - Wrong separator, skip and hope for the better..."); |
end if; |
when others => |
Raise_Exception( |
error_in_image_data'Identity, |
"Unknown GIF separator: [" & separator & |
"] code:" & Integer'Image(Character'Pos(separator)) |
); |
end case; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.