// NOTE: I am not sure if we should allow the nIndex since this can be determined by spec. public bool addRatioRecord(ushort nIndex, byte bCharSet, byte xRatio, byte yStartRatio, byte yEndRatio, ushort VDMXGroupThisRatio) { bool bResult = true; if (nIndex > m_numRatios) { bResult = false; throw new ArgumentOutOfRangeException("nIndex is greater than the number of Ratio Records + 1."); } else if (VDMXGroupThisRatio >= m_numRecs) { bResult = false; throw new ArgumentOutOfRangeException("VDMXGroupThisRatio is greater than the number of VDMX Groups."); } else { RatioCache rc = new RatioCache(bCharSet, xRatio, yStartRatio, yEndRatio, VDMXGroupThisRatio); m_ratRange.Insert(nIndex, rc); m_numRatios++; m_bDirty = true; } return(bResult); }
public RatioCache getRatioRecord(ushort nIndex) { RatioCache rc = null; if (nIndex >= m_numRatios) { throw new ArgumentOutOfRangeException("nIndex is greater than the number of Ratio Records."); } else { rc = (RatioCache)((RatioCache)m_ratRange[nIndex]).Clone(); } return(rc); }
// NOTE: I am not sure if we should allow the nIndex since this can be determined by spec. public bool addRatioRecord( ushort nIndex, byte bCharSet, byte xRatio, byte yStartRatio, byte yEndRatio, ushort VDMXGroupThisRatio ) { bool bResult = true; if( nIndex > m_numRatios ) { bResult = false; throw new ArgumentOutOfRangeException( "nIndex is greater than the number of Ratio Records + 1." ); } else if( VDMXGroupThisRatio >= m_numRecs ) { bResult = false; throw new ArgumentOutOfRangeException( "VDMXGroupThisRatio is greater than the number of VDMX Groups." ); } else { RatioCache rc = new RatioCache( bCharSet, xRatio, yStartRatio, yEndRatio, VDMXGroupThisRatio ); m_ratRange.Insert( nIndex, rc ); m_numRatios++; m_bDirty = true; } return bResult; }
protected ArrayList m_groups; // VDMXGroupCache[] // constructor public VDMX_cache(Table_VDMX OwnerTable) { m_version = OwnerTable.version; m_numRecs = OwnerTable.numRecs; m_numRatios = OwnerTable.numRatios; m_ratRange = new ArrayList( m_numRatios ); m_groups = new ArrayList( m_numRecs ); // Used to detrmine which vdmx goes with which ratio ushort[] VDMXOffsets = new ushort[m_numRecs]; VDMXOffsets[0] = (ushort)(Table_VDMX.FieldOffsets.ratRange + (m_numRatios * 4) + (m_numRatios * 2)); // Fill in the VDMX groups for( ushort i = 0; i < m_numRecs; i++ ) { VDMXGroupCache vgc = new VDMXGroupCache(); vgc.recs = OwnerTable.GetVdmxGroup( i ).recs; vgc.startsz = OwnerTable.GetVdmxGroup( i ).startsz; vgc.endsz = OwnerTable.GetVdmxGroup( i ).endsz; for( ushort ii = 0; ii < vgc.recs; ii++ ) { Vdmx.vTable vt = OwnerTable.GetVdmxGroup( i ).GetEntry( ii ); vgc.addVTableRecordCache( ii, vt.yPelHeight, vt.yMax, vt. yMin ); } m_groups.Add( vgc ); if( i < (m_numRecs - 1)) { VDMXOffsets[i+1] = (ushort)(VDMXOffsets[i] + 4 + ( vgc.recs * 6 )); } } // Fill in the ratios for( ushort i = 0; i < m_numRatios; i++ ) { RatioCache rc = new RatioCache(); rc.bCharSet = OwnerTable.GetRatioRange( i ).bCharSet; rc.xRatio = OwnerTable.GetRatioRange( i ).xRatio; rc.yStartRatio = OwnerTable.GetRatioRange( i ).yStartRatio; rc.yEndRatio = OwnerTable.GetRatioRange( i ).yEndRatio; // Go through each of the offsets I saved above and match with this ratios offset // When we find the right one save this group to this ratio // later when we save the buffer we will redetermine these offsets for( ushort ii = 0; ii < m_numRatios; ii++ ) { if( VDMXOffsets[ii] == OwnerTable.GetVdmxGroupOffset( i )) { rc.VDMXGroupThisRatio = ii; break; } } m_ratRange.Add( rc ); } }
protected ArrayList m_groups; // VDMXGroupCache[] // constructor public VDMX_cache(Table_VDMX OwnerTable) { m_version = OwnerTable.version; m_numRecs = OwnerTable.numRecs; m_numRatios = OwnerTable.numRatios; m_ratRange = new ArrayList(m_numRatios); m_groups = new ArrayList(m_numRecs); // Used to detrmine which vdmx goes with which ratio ushort[] VDMXOffsets = new ushort[m_numRecs]; VDMXOffsets[0] = (ushort)(Table_VDMX.FieldOffsets.ratRange + (m_numRatios * 4) + (m_numRatios * 2)); // Fill in the VDMX groups for (ushort i = 0; i < m_numRecs; i++) { VDMXGroupCache vgc = new VDMXGroupCache(); vgc.recs = OwnerTable.GetVdmxGroup(i).recs; vgc.startsz = OwnerTable.GetVdmxGroup(i).startsz; vgc.endsz = OwnerTable.GetVdmxGroup(i).endsz; for (ushort ii = 0; ii < vgc.recs; ii++) { Vdmx.vTable vt = OwnerTable.GetVdmxGroup(i).GetEntry(ii); vgc.addVTableRecordCache(ii, vt.yPelHeight, vt.yMax, vt.yMin); } m_groups.Add(vgc); if (i < (m_numRecs - 1)) { VDMXOffsets[i + 1] = (ushort)(VDMXOffsets[i] + 4 + (vgc.recs * 6)); } } // Fill in the ratios for (ushort i = 0; i < m_numRatios; i++) { RatioCache rc = new RatioCache(); rc.bCharSet = OwnerTable.GetRatioRange(i).bCharSet; rc.xRatio = OwnerTable.GetRatioRange(i).xRatio; rc.yStartRatio = OwnerTable.GetRatioRange(i).yStartRatio; rc.yEndRatio = OwnerTable.GetRatioRange(i).yEndRatio; // Go through each of the offsets I saved above and match with this ratios offset // When we find the right one save this group to this ratio // later when we save the buffer we will redetermine these offsets for (ushort ii = 0; ii < m_numRatios; ii++) { if (VDMXOffsets[ii] == OwnerTable.GetVdmxGroupOffset(i)) { rc.VDMXGroupThisRatio = ii; break; } } m_ratRange.Add(rc); } }