Shadow Not visible
Blitz3D Forums/Blitz3D Beginners Area/Shadow Not visible
| ||
I'm sturggling to understand why the 'dropshadow' image idoesn't appear to be visible. I've checked the following: AMBIENT_R,G,B etc. values Creation of Image Drawing X Y Location Width & Height dimensions of Image Call to DrawImage actually processed All of which are valid and correct. Theonly thing I can think of, then, is the actual image itself is somehow transparent (alpha'd pixels maybe?) However in the creation function: Function him_UI_CreateGadgetDropShadow(n_W,n_H) Local Image=CreateImage(n_W,n_H) Local Buffer=ImageBuffer(Image) Local X Local Y Local Pixel=n_COL_RGBa(cm_EDT_AMBIENT_R,cm_EDT_AMBIENT_G,cm_EDT_AMBIENT_B,0) LockBuffer Buffer For Y=0 To n_H-1 For X=1 To n_W-1 WritePixelFast X,Y,Pixel,Buffer Next Next UnlockBuffer BufferDirty Buffer DebugLog("UI (Create Gadget DropShadow): Dropshadow Image created 0x"+Hex(Image)) Return Image End Function I have tried changing Pixel to -1, -255, 256 ,255, 65535 and 16777215 all to no avail. I also tried adding a MaskImage line to ensure that this was set to completely different colour Here's the actual drawing routine. This definitely runs: [code] Function v_UI_DisplayButtonGadgets() Local o.T_UI_ButtonGadget Local Frame=cm_UI_STATE_NORMAL go_UI_CURRENT_MOUSEOVER=Null For o=Each T_UI_ButtonGadget If (Not(nb_UI_GetButtonStateHidden(o))) If (nb_UI_GetButtonStateEnabled(o)) If (nb_UI_GetButtonMouseOver(o)) go_UI_CURRENT_MOUSEOVER=o Frame=cm_UI_STATE_MOUSEOVER Else Frame=nb_UI_GetButtonStateActive(o) End If Else Frame=cm_UI_STATE_DISABLED End If DrawImage o\yhim_ButtonGadget_DropShadow,o\yn_ButtonGadget_X-(cn_UI_DROPSHADOW_OFFSET*0.5),o\yn_ButtonGadget_Y+cn_UI_DROPSHADOW_OFFSET DrawImage o\yhim_ButtonGadget_ImageHandle,o\yn_ButtonGadget_X,o\yn_ButtonGadget_Y,Frame End If Next End Function [\code] |
| ||
! Apparently, it was because I didn't include the Buffer parameter for UnLockBuffer Once this was changed to UnLockBuffer Buffer everything worked as expected. |
| ||
That's a sneaky one. You specified the buffer in the WritePixelFast command and never used SetBuffer to change the default. Thus UnlockBuffer with no buffer specified was still referring to something other than the image buffer, probably the back buffer. |
| ||
Yep, that's exactly what was happening. |