123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- #region MIT License
- #endregion
- using System;
- namespace SharpFont.Cache
- {
-
-
-
-
- public class ImageCache
- {
- #region Fields
- private IntPtr reference;
- private Manager parentManager;
- #endregion
- #region Constructors
-
-
-
-
- public ImageCache(Manager manager)
- {
- if (manager == null)
- throw new ArgumentNullException("manager");
- IntPtr cacheRef;
- Error err = FT.FTC_ImageCache_New(manager.Reference, out cacheRef);
- if (err != Error.Ok)
- throw new FreeTypeException(err);
- parentManager = manager;
- Reference = cacheRef;
- }
- #endregion
- #region Properties
- internal IntPtr Reference
- {
- get
- {
- if (parentManager.IsDisposed)
- throw new ObjectDisposedException("Reference", "Cannot access a disposed object.");
- return reference;
- }
- set
- {
- if (parentManager.IsDisposed)
- throw new ObjectDisposedException("Reference", "Cannot access a disposed object.");
- reference = value;
- }
- }
- #endregion
- #region Methods
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [CLSCompliant(false)]
- public Glyph Lookup(ImageType type, uint gIndex, out Node node)
- {
- if (parentManager.IsDisposed)
- throw new ObjectDisposedException("Reference", "Cannot access a disposed object.");
- IntPtr glyphRef, nodeRef;
- Error err = FT.FTC_ImageCache_Lookup(Reference, type.Reference, gIndex, out glyphRef, out nodeRef);
- if (err != Error.Ok)
- throw new FreeTypeException(err);
- node = new Node(nodeRef);
- return new Glyph(glyphRef, null);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [CLSCompliant(false)]
- public Glyph LookupScaler(Scaler scaler, LoadFlags loadFlags, uint gIndex, out Node node)
- {
- if (parentManager.IsDisposed)
- throw new ObjectDisposedException("Reference", "Cannot access a disposed object.");
- IntPtr glyphRef, nodeRef;
- Error err = FT.FTC_ImageCache_LookupScaler(Reference, scaler.Reference, loadFlags, gIndex, out glyphRef, out nodeRef);
- if (err != Error.Ok)
- throw new FreeTypeException(err);
- node = new Node(nodeRef);
- return new Glyph(glyphRef, null);
- }
- #endregion
- }
- }
|