Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reading a BMP
Message
De
09/12/2003 10:51:50
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Photos et traitement d'images
Titre:
Divers
Thread ID:
00857176
Message ID:
00857222
Vues:
20
>I have a need to read the contents of a BMP file. I have read the many papers describing the file format that still exist on the web. I am looking for sample code that would help me understand how to handle the bit data from VFP. I currently have a basic set of code using ASC(), but there are algorithms that I am not getting right in order to read the data section of the file.
>
>Thanks for any direction you can give.

On internet there are many sites clearly showing a bitmap structure (as you say you already found). You could read the BMP detail utilizing RtlMoveMemory. ie:
Local array arrBMPInfo[1]
ReadBMPHeader(GetFile('BMP'),@arrBMPInfo)
Display Memory like arrBMPInfo

Function ReadBMPHeader
Lparameters tcBMP, taInfo
Declare RtlMoveMemory In WIN32API ;
	INTEGER @DestNumeric, ;
	STRING @pVoidSource, ;
	INTEGER nLength
Local lcBMPStruc, lnHandle, lnSize
lcBMPStruc = '2422444422444444' && Only header part

dimension taInfo[Len(m.lcBMPStruc)]

lnHandle = Fopen(m.tcBMP)
For ix=1 to Len(m.lcBMPStruc)
  lnValue = 0
  lnSize = Val(Substr(m.lcBMPStruc,m.ix,1))
  RtlMoveMemory(@lnValue, Fread(m.lnHandle, m.lnSize), m.lnSize)
  taInfo[ix] = m.lnValue	
EndFor
Fclose(m.lnHandle)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform