public bool insert(bloTexture texture, int slot, double factor) { if (texture == null) { return(false); } if (slot < 0 || slot >= cTextureSlots || slot > mTextureCount) { return(false); } if (mTextureCount >= cTextureSlots) { return(false); } for (var i = (cTextureSlots - 1); i > slot; --i) { mTextures[i] = mTextures[i - 1]; mBlendColorFactors[i] = mBlendColorFactors[i - 1]; mBlendAlphaFactors[i] = mBlendAlphaFactors[i - 1]; } mTextures[slot] = texture; mBlendColorFactors[slot] = factor; mBlendAlphaFactors[slot] = factor; if (mTextureCount == 0) { mRect.set(0, 0, texture.getWidth(), texture.getHeight()); } ++mTextureCount; setBlendKonstColor(); setBlendKonstAlpha(); return(true); }
public bloPicture(bloTexture texture) { if (texture == null) { throw new ArgumentNullException("texture"); } mTextures[0] = texture; mTextureCount = 1; mRect.set(0, 0, texture.getWidth(), texture.getHeight()); }
public bloPicture(uint name, bloRectangle rectangle, bloTexture texture, bloPalette palette) { if (texture == null) { throw new ArgumentNullException("texture"); } mName = name; mRect = rectangle; mTextures[0] = texture; mTextureCount = 1; texture.attachPalette(palette); }
public bloTexture changeTexture(bloTexture texture, int slot) { if (texture == null) { return(null); } if (slot < 0 || slot >= cTextureSlots || slot >= mTextureCount) { return(null); } var old = mTextures[slot]; mTextures[slot] = texture; return(old); }
void initialize(bloTexture topLeft, bloTexture topRight, bloTexture bottomLeft, bloTexture bottomRight, bloWindowMirror mirror, bloRectangle rectangle) { mTextures[(int)bloTextureBase.TopLeft].texture = topLeft; mTextures[(int)bloTextureBase.TopRight].texture = topRight; mTextures[(int)bloTextureBase.BottomLeft].texture = bottomLeft; mTextures[(int)bloTextureBase.BottomRight].texture = bottomRight; for (var i = 0; i < 4; ++i) { mTextures[i].mirror = (bloMirror)(((int)mirror >> (6 - (i * 2))) & 3); } mRect = rectangle; mContentRect = new bloRectangle(0, 0, mRect.width, mRect.height); mFromColor = new bloColor(bloColor.cZero); mToColor = new bloColor(bloColor.cOne); initializeColor(); initializeMinSize(); }
protected override void loadCompact(aBinaryReader reader) { base.loadCompact(reader); var finder = bloResourceFinder.getFinder(); int x = reader.Read16(); int y = reader.Read16(); int width = reader.Read16(); int height = reader.Read16(); mContentRect.set(x, y, (x + width), (y + height)); for (int i = 0; i < 4; ++i) { mTextures[i].texture = finder.find <bloTexture>(reader, "timg"); } mPalette = finder.find <bloPalette>(reader, "tlut"); int bits = reader.Read8(); for (int i = 0; i < 4; ++i) { mTextures[i].mirror = (bloMirror)((bits >> (6 - (i * 2))) & 3); } for (int i = 0; i < 4; ++i) { mTextures[i].color = new bloColor(reader.Read32()); } mContentTexture = null; mFromColor.rgba = bloColor.cZero; mToColor.rgba = bloColor.cOne; reader.Skip(4); initializeMinSize(); }
protected override void loadXml(xElement element) { base.loadXml(element); var finder = bloResourceFinder.getFinder(); var content = element.Element("content"); mContentRect = bloXml.loadRectangle(content.Element("rectangle")); mContentTexture = finder.find <bloTexture>(content.Element("texture"), "timg"); mPalette = finder.find <bloPalette>(element.Element("palette"), "tlut"); var corners = element.Element("corners"); loadCornerXml(mTextures[cTopLeft], finder, corners.Element("top-left"), 0); loadCornerXml(mTextures[cTopRight], finder, corners.Element("top-right"), bloMirror.X); loadCornerXml(mTextures[cBottomLeft], finder, corners.Element("bottom-left"), bloMirror.Y); loadCornerXml(mTextures[cBottomRight], finder, corners.Element("bottom-right"), (bloMirror.X | bloMirror.Y)); bloXml.loadGradient(element.Element("gradient"), out mFromColor, out mToColor); initializeMinSize(); }
public bloWindow(uint name, bloRectangle rectangle, bloTexture topLeft, bloTexture topRight, bloTexture bottomLeft, bloTexture bottomRight, bloPalette palette) { mName = name; mPalette = palette; initialize(topLeft, topRight, bottomLeft, bottomRight, 0, rectangle); }
public bloWindow(uint name, bloRectangle rectangle, bloTexture texture, bloTextureBase tbase, bloPalette palette) { mName = name; mPalette = palette; initialize(texture, texture, texture, texture, bloEnum.convertMirror(tbase), rectangle); }
public bloWindow(bloTexture topLeft, bloTexture topRight, bloTexture bottomLeft, bloTexture bottomRight) { initialize(topLeft, topRight, bottomLeft, bottomRight, 0, new bloRectangle()); }
public bloWindow(bloTexture texture, bloTextureBase tbase) { initialize(texture, texture, texture, texture, bloEnum.convertMirror(tbase), new bloRectangle()); }