something i begin today.
the beginning and end of barcode should be some space with same color white.
rem
rem AGK Application 108 Beta 15
rem barcode from image wip
rem MR 23.10.2013
SetDisplayAspect( 4.0/3.0 )
global imgBarcode
imgBarcode=loadimage("test.jpg") //read barcode photo
memblock=creatememblockfromimage(imgBarcode)
//just show a sprite as background
global spr
spr=createsprite(imgBarcode)
setspritesize(spr,100,100)
barcode as string
barcode=""
do
print("ESC for EXIT")
print(barcode)
if getpointerpressed()=1
barcode=""
endif
if getpointerstate()=1
y#=getpointery()
drawline(0,y#,100,y#,255,0,0)
endif
if getpointerreleased()=1
barcode=Scan(memblock,y#)
endif
if GetRawKeyPressed(27) then exit
Sync()
loop
deletesprite(spr)
deletememblock(memblock)
end
function Scan(memblock,yp#)
barcode as string
barcode=""
width = GetMemblockInt(memblock, 0)
height = GetMemblockInt(memblock, 4) //1944
size = GetMemblockSize(memblock)
heightf#=height
y=(yp#/100.0)*heightf# //522
for x=0 to width-1
o=(3*4)+y*(width*4)+x*4
if o=>0 and o<size
color=getMemblockInt(memblock,o)
//...
//barcode = barcode + char
//SetMemblockInt(memblock,o,0) //scan this line, only visible at fullscreen
endif
next
//createimagefrommemblock(imgBarcode,memblock)
endfunction barcode