In reference to this post, tinting an image in a scroll view via setFillColor doesn’t seem to work.
Is this something that is going to be addressed?
How should I go around this limitation without making separate images?
Thanks,
Gullie
In reference to this post, tinting an image in a scroll view via setFillColor doesn’t seem to work.
Is this something that is going to be addressed?
How should I go around this limitation without making separate images?
Thanks,
Gullie
Can you post some code showing how you are trying to tint an image?
Here the code is scaled down as much as i could. setFillColor isn’t working for some reason.
local storyboard = require( "storyboard" ) local widget = require "widget" local scene = storyboard.newScene() --ImageSheets for the dungeon select background boards and scrollBar local difficultyLevelIndicatorImageSheet local dungeonEntryGroup -- A display group holding the scrollViews and related dungeon selection objects local dungeonEntries --Table that will hold each dungeon selection object group -- Take the supplied dungeon table and get the text to show in the fields out local function populateDungeonList( dungeonLevelsToLoad ) local dungeonScrollView -- ScrollView for all the dungeon boards local dungonBoard = { width = 348, height = 94, yBase = 60, yOffSet = 100, xOffSet = -5, } --Dimensions of dungeon boards w, h, base y position, offset for each board --Builds the dungeon boards local function buildDungeonBoards() --Builds the dungeon boards here starting at cache 1 local function buildEachDungeonBoard ( boardNumber ) --Var to hold all the parts of a dungeon board --local dungeonEntry local difficultyLevelIndicatorObject --Builds a new groups to hold all of the background board objects dungeonEntries[boardNumber] = display.newGroup() -- create new image from the above image sheet difficultyLevelIndicatorObject = display.newImageRect( difficultyLevelIndicatorImageSheet, 1, 165, 79 ) ---This Doesn't work :( difficultyLevelIndicatorObject:setFillColor( 0, 0, 255 ) --Move the difficulty level indicator into position difficultyLevelIndicatorObject.x = 0 - ( difficultyLevelIndicatorObject.width / 2 ) difficultyLevelIndicatorObject.y = 0 - ( difficultyLevelIndicatorObject.height / 2 ) dungeonEntries[boardNumber]:insert( difficultyLevelIndicatorObject ) end for i = 1, 4 do buildEachDungeonBoard( i ) end end --Table that will hold each dungeon selection object group dungeonEntries = {} --Build the actual dungeonBoards buildDungeonBoards() --Move the Dungeon boards to the top of the scroll view + display.contentHeight for i = 1, # dungeonEntries do dungeonEntries[i].x = display.contentWidth \* 0.5 + dungonBoard.xOffSet dungeonEntries[i].y = dungonBoard.yBase + ( dungonBoard.yOffSet \* ( i - 1 ) ) end -- Create a ScrollView local scrollViewOptions = { top = gameUi.menuPositions.menuSeparatorPosition[2] + gameUi.menuPositions.menuSeparatorHeight, left = 0, width = display.contentWidth \* .98, height = ( gameUi.menuPositions.menuSeparatorPosition[3] ) - ( gameUi.menuPositions.menuSeparatorPosition[2] + gameUi.menuPositions.menuSeparatorHeight ), scrollWidth = display.contentWidth, scrollHeight = 0,-- maxNumberOfDungeonBoardsShown \* dungonBoard.yOffSet + dungonBoard.yBase, --670, horizontalScrollDisabled = true, maskFile = "art/menus/scrollViewMask1.png", backgroundColor = { 0,0,0,0 } } dungeonScrollView = widget.newScrollView ( scrollViewOptions ) -- Add the dungeon select boards to the scroll view for i = 1, # dungeonEntries do dungeonScrollView:insert( dungeonEntries[i] ) end -- Add the scroll view to the dungeon Entry Group dungeonEntryGroup:insert( dungeonScrollView ) dungeonEntryGroup.dungeonScrollView = dungeonScrollView end ----------------------Begin Storyboard Functions----------------------- -- Called when the scene's view does not exist: function scene:createScene( event ) --Get the scene group and look at self local screenGroup = self.view event.params.dungeonLevelsToLoad = { dungeon = {}, levels = { [1] = {1}, [2] = {2}, [3] = {3}, }, } --Build Image Sheet for the background boards local imageOptions = { -- The params below are required width = 165, height = 79, numFrames = 3, -- The params below are optional; used for dynamic resolution support sheetContentWidth = 165, -- width of original 1x size of entire sheet sheetContentHeight = 237 -- height of original 1x size of entire sheet } difficultyLevelIndicatorImageSheet = graphics.newImageSheet( "art/menus/difficultyIndicator\_white.png", imageOptions ) dungeonEntryGroup = display.newGroup() -- ----Builds and populates the Normal Dungeon List populateDungeonList( event.params.dungeonLevelsToLoad ) -- screenGroup:insert( dungeonEntryGroup ) -- end -- Called immediately after scene has moved onscreen: function scene:enterScene( event ) end -- Called when scene is about to move offscreen: function scene:exitScene( event ) end -- Called prior to the removal of scene's "view" (display group) function scene:destroyScene( event ) end --------------------------------------------------------------------------------- -- END OF YOUR IMPLEMENTATION --------------------------------------------------------------------------------- -- "createScene" event is dispatched if scene's view does not exist scene:addEventListener( "createScene", scene ) -- "enterScene" event is dispatched whenever scene transition has finished scene:addEventListener( "enterScene", scene ) -- "exitScene" event is dispatched before next scene's transition begins scene:addEventListener( "exitScene", scene ) -- "destroyScene" event is dispatched before view is unloaded, which can be -- automatically unloaded in low memory situations, or explicitly via a call to -- storyboard.purgeScene() or storyboard.removeScene(). scene:addEventListener( "destroyScene", scene ) --------------------------------------------------------------------------------- return scene
Hi @gullie667,
Are you using V1 Compatibility? If not, then your color settings should be in the 0-1 range (not 0-255).
That being aside the point, I tried tinting an image from an image sheet, and it works fine. So, I don’t know what’s occurring in your case. What does “difficultyLevelIndicatorObject” look like?
Brent
The image is a PNG and the image tint works fine if it isn’t inserted into the scroll view (as in commenting out line 78.)
As soon as its is put into the scroll view the image goes back to a medium grey instead of blue.
I am using this on a PC, simulator 2013.8.28.
I can’t figure it out
It’s hard to know what build that is. We use build numbers like 2013.1202 It should be 2013 + a 4 digit number. A date of 8.28 will be pre-dating graphics 2.0. Can you confirm the version number you are on?
Rob
The build is CoronaSDK-2013.1202.msi
So… the image tints fine when inserted into a scroll view by it self. It must have something to do with the nested group/table/scrollview hierarchy I am using.
Are there limitations to nesting? What are they?
There are masking limits thats about 2-3 deep depending on the device.
I think tinting is tied to this limit. What is your hierarchy?
Rob
The hierarchy is in the code above. I can’t seem to figure it out so I am gonna give up and just color the images in photoshop.
May not be a bad idea.
Rob
Can you post some code showing how you are trying to tint an image?
Here the code is scaled down as much as i could. setFillColor isn’t working for some reason.
local storyboard = require( "storyboard" ) local widget = require "widget" local scene = storyboard.newScene() --ImageSheets for the dungeon select background boards and scrollBar local difficultyLevelIndicatorImageSheet local dungeonEntryGroup -- A display group holding the scrollViews and related dungeon selection objects local dungeonEntries --Table that will hold each dungeon selection object group -- Take the supplied dungeon table and get the text to show in the fields out local function populateDungeonList( dungeonLevelsToLoad ) local dungeonScrollView -- ScrollView for all the dungeon boards local dungonBoard = { width = 348, height = 94, yBase = 60, yOffSet = 100, xOffSet = -5, } --Dimensions of dungeon boards w, h, base y position, offset for each board --Builds the dungeon boards local function buildDungeonBoards() --Builds the dungeon boards here starting at cache 1 local function buildEachDungeonBoard ( boardNumber ) --Var to hold all the parts of a dungeon board --local dungeonEntry local difficultyLevelIndicatorObject --Builds a new groups to hold all of the background board objects dungeonEntries[boardNumber] = display.newGroup() -- create new image from the above image sheet difficultyLevelIndicatorObject = display.newImageRect( difficultyLevelIndicatorImageSheet, 1, 165, 79 ) ---This Doesn't work :( difficultyLevelIndicatorObject:setFillColor( 0, 0, 255 ) --Move the difficulty level indicator into position difficultyLevelIndicatorObject.x = 0 - ( difficultyLevelIndicatorObject.width / 2 ) difficultyLevelIndicatorObject.y = 0 - ( difficultyLevelIndicatorObject.height / 2 ) dungeonEntries[boardNumber]:insert( difficultyLevelIndicatorObject ) end for i = 1, 4 do buildEachDungeonBoard( i ) end end --Table that will hold each dungeon selection object group dungeonEntries = {} --Build the actual dungeonBoards buildDungeonBoards() --Move the Dungeon boards to the top of the scroll view + display.contentHeight for i = 1, # dungeonEntries do dungeonEntries[i].x = display.contentWidth \* 0.5 + dungonBoard.xOffSet dungeonEntries[i].y = dungonBoard.yBase + ( dungonBoard.yOffSet \* ( i - 1 ) ) end -- Create a ScrollView local scrollViewOptions = { top = gameUi.menuPositions.menuSeparatorPosition[2] + gameUi.menuPositions.menuSeparatorHeight, left = 0, width = display.contentWidth \* .98, height = ( gameUi.menuPositions.menuSeparatorPosition[3] ) - ( gameUi.menuPositions.menuSeparatorPosition[2] + gameUi.menuPositions.menuSeparatorHeight ), scrollWidth = display.contentWidth, scrollHeight = 0,-- maxNumberOfDungeonBoardsShown \* dungonBoard.yOffSet + dungonBoard.yBase, --670, horizontalScrollDisabled = true, maskFile = "art/menus/scrollViewMask1.png", backgroundColor = { 0,0,0,0 } } dungeonScrollView = widget.newScrollView ( scrollViewOptions ) -- Add the dungeon select boards to the scroll view for i = 1, # dungeonEntries do dungeonScrollView:insert( dungeonEntries[i] ) end -- Add the scroll view to the dungeon Entry Group dungeonEntryGroup:insert( dungeonScrollView ) dungeonEntryGroup.dungeonScrollView = dungeonScrollView end ----------------------Begin Storyboard Functions----------------------- -- Called when the scene's view does not exist: function scene:createScene( event ) --Get the scene group and look at self local screenGroup = self.view event.params.dungeonLevelsToLoad = { dungeon = {}, levels = { [1] = {1}, [2] = {2}, [3] = {3}, }, } --Build Image Sheet for the background boards local imageOptions = { -- The params below are required width = 165, height = 79, numFrames = 3, -- The params below are optional; used for dynamic resolution support sheetContentWidth = 165, -- width of original 1x size of entire sheet sheetContentHeight = 237 -- height of original 1x size of entire sheet } difficultyLevelIndicatorImageSheet = graphics.newImageSheet( "art/menus/difficultyIndicator\_white.png", imageOptions ) dungeonEntryGroup = display.newGroup() -- ----Builds and populates the Normal Dungeon List populateDungeonList( event.params.dungeonLevelsToLoad ) -- screenGroup:insert( dungeonEntryGroup ) -- end -- Called immediately after scene has moved onscreen: function scene:enterScene( event ) end -- Called when scene is about to move offscreen: function scene:exitScene( event ) end -- Called prior to the removal of scene's "view" (display group) function scene:destroyScene( event ) end --------------------------------------------------------------------------------- -- END OF YOUR IMPLEMENTATION --------------------------------------------------------------------------------- -- "createScene" event is dispatched if scene's view does not exist scene:addEventListener( "createScene", scene ) -- "enterScene" event is dispatched whenever scene transition has finished scene:addEventListener( "enterScene", scene ) -- "exitScene" event is dispatched before next scene's transition begins scene:addEventListener( "exitScene", scene ) -- "destroyScene" event is dispatched before view is unloaded, which can be -- automatically unloaded in low memory situations, or explicitly via a call to -- storyboard.purgeScene() or storyboard.removeScene(). scene:addEventListener( "destroyScene", scene ) --------------------------------------------------------------------------------- return scene
Hi @gullie667,
Are you using V1 Compatibility? If not, then your color settings should be in the 0-1 range (not 0-255).
That being aside the point, I tried tinting an image from an image sheet, and it works fine. So, I don’t know what’s occurring in your case. What does “difficultyLevelIndicatorObject” look like?
Brent
The image is a PNG and the image tint works fine if it isn’t inserted into the scroll view (as in commenting out line 78.)
As soon as its is put into the scroll view the image goes back to a medium grey instead of blue.
I am using this on a PC, simulator 2013.8.28.
I can’t figure it out
It’s hard to know what build that is. We use build numbers like 2013.1202 It should be 2013 + a 4 digit number. A date of 8.28 will be pre-dating graphics 2.0. Can you confirm the version number you are on?
Rob
The build is CoronaSDK-2013.1202.msi
So… the image tints fine when inserted into a scroll view by it self. It must have something to do with the nested group/table/scrollview hierarchy I am using.
Are there limitations to nesting? What are they?
There are masking limits thats about 2-3 deep depending on the device.
I think tinting is tied to this limit. What is your hierarchy?
Rob
The hierarchy is in the code above. I can’t seem to figure it out so I am gonna give up and just color the images in photoshop.
May not be a bad idea.
Rob