When I did a search in the VPI Wiki, it referred a lot of references to VIP7.x
However, on one in the Wiki pages there is mention of a GUI class and it mentions being built on the VPI package. I do remember having to specifically declare (open) the vpidomains.
My question is simple (I hope), can I still pull in a BMP and strip out the binary?
Here is my code from 10+ years ago.
Code: Select all
class predicates
pull_binary : (string).
clauses
pull_binary(Filename):-
retractall(tempIn(_)),
try
PictIn = vpi::pictLoad(Filename),
pictBin := vpi::pictToBin(PictIn)
catch TraceId do
exceptionDump::dumpToStdOutput (TraceId)
end try,
TotalByteCount_Raw = binary::getSize(pictBin),
DELTA = TotalByteCount_Raw mod 3,
if 0= DELTA then
TotalByteCount = TotalByteCount_Raw
else
TotalByteCount = TotalByteCount_Raw - DELTA
end if,
Pad1 = binary::createAtomic(1),
Pad2 = binary::createAtomic(2),
% get the offset
B_out = binary::getBinaryAtomic(pictBin, 2,2),
% pad it out to 4 bytes for conversion
B_outPadded2 = binary::concatAtomic( B_out, Pad2),
% gets the offset
binary::getValue(B_outPadded2,0, integer(V)),
foreach S = std::fromToInStep(V, TotalByteCount-V, 3) do
% get the 2 bytes for color and pad
First = binary::getBinaryAtomic(pictBin,S,3),
B_outPadded1 = binary::concatAtomic( First, Pad1),
% convert bin to int
binary::getValue(B_outPadded1,0, integer(V1)),
output := convert(positive,V1),
assertz(tempIn(output))
end foreach,
if _X = string::search(Filename, "Neg",string::caseInsensitive() ) then
console::write("Neg found \n"),
globals::desired_Output := 0.0
else
console::write("Neg NOT found \n"),
globals::desired_Output := 1.0
end if/*,