summaryrefslogtreecommitdiff
path: root/osframework/source/SexyAppFramework/MI_GetRLAlphaData.inc
diff options
context:
space:
mode:
Diffstat (limited to 'osframework/source/SexyAppFramework/MI_GetRLAlphaData.inc')
-rw-r--r--osframework/source/SexyAppFramework/MI_GetRLAlphaData.inc52
1 files changed, 52 insertions, 0 deletions
diff --git a/osframework/source/SexyAppFramework/MI_GetRLAlphaData.inc b/osframework/source/SexyAppFramework/MI_GetRLAlphaData.inc
new file mode 100644
index 0000000..2dcf3ec
--- /dev/null
+++ b/osframework/source/SexyAppFramework/MI_GetRLAlphaData.inc
@@ -0,0 +1,52 @@
+{
+
+ uchar* aWPtr = mRLAlphaData;
+
+ if (mWidth==1)
+ {
+ memset(aWPtr,1,mHeight);
+ }
+ else
+ {
+ for (int aRow = 0; aRow < mHeight; aRow++)
+ {
+ int aRCount = 1;
+ int aRLCount = 1;
+
+ int anAVal = NEXT_SRC_COLOR >> 24;
+ int aLastAClass = (anAVal == 0) ? 0 : (anAVal == 255) ? 1 : 2;
+
+ while (aRCount < mWidth)
+ {
+ aRCount++;
+
+ anAVal = NEXT_SRC_COLOR >> 24;
+ int aThisAClass = (anAVal == 0) ? 0 : (anAVal == 255) ? 1 : 2;
+
+ if ((aThisAClass != aLastAClass) || (aRCount == mWidth))
+ {
+ if (aThisAClass == aLastAClass)
+ aRLCount++;
+
+ for (int i = aRLCount; i > 0; i--)
+ {
+ if (i >= 255)
+ *aWPtr++ = 255;
+ else
+ *aWPtr++ = i;
+ }
+
+ if ((aRCount == mWidth) && (aThisAClass != aLastAClass))
+ *aWPtr++ = 1;
+
+ aLastAClass = aThisAClass;
+ aRLCount = 1;
+ }
+ else
+ {
+ aRLCount++;
+ }
+ }
+ }
+ }
+} \ No newline at end of file